138494Sobrien/*
2174294Sobrien * Copyright (c) 1997-2006 Erez Zadok
338494Sobrien * Copyright (c) 1990 Jan-Simon Pendry
438494Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
538494Sobrien * Copyright (c) 1990 The Regents of the University of California.
638494Sobrien * All rights reserved.
738494Sobrien *
838494Sobrien * This code is derived from software contributed to Berkeley by
938494Sobrien * Jan-Simon Pendry at Imperial College, London.
1038494Sobrien *
1138494Sobrien * Redistribution and use in source and binary forms, with or without
1238494Sobrien * modification, are permitted provided that the following conditions
1338494Sobrien * are met:
1438494Sobrien * 1. Redistributions of source code must retain the above copyright
1538494Sobrien *    notice, this list of conditions and the following disclaimer.
1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1738494Sobrien *    notice, this list of conditions and the following disclaimer in the
1838494Sobrien *    documentation and/or other materials provided with the distribution.
1938494Sobrien * 3. All advertising materials mentioning features or use of this software
2042629Sobrien *    must display the following acknowledgment:
2138494Sobrien *      This product includes software developed by the University of
2238494Sobrien *      California, Berkeley and its contributors.
2338494Sobrien * 4. Neither the name of the University nor the names of its contributors
2438494Sobrien *    may be used to endorse or promote products derived from this software
2538494Sobrien *    without specific prior written permission.
2638494Sobrien *
2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3038494Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3738494Sobrien * SUCH DAMAGE.
3838494Sobrien *
3938494Sobrien *
40174294Sobrien * File: am-utils/amq/amq_clnt.c
4138494Sobrien *
4238494Sobrien */
4338494Sobrien
4438494Sobrien#ifdef HAVE_CONFIG_H
4538494Sobrien# include <config.h>
4638494Sobrien#endif /* HAVE_CONFIG_H */
4738494Sobrien#include <am_defs.h>
4838494Sobrien#include <amq.h>
4938494Sobrien
5038494Sobrien
5138494Sobrienstatic struct timeval TIMEOUT = {ALLOWED_MOUNT_TIME, 0};
5238494Sobrien
5338494Sobrien
5438494Sobrienvoidp
5538494Sobrienamqproc_null_1(voidp argp, CLIENT *clnt)
5638494Sobrien{
5738494Sobrien  static char res;
5838494Sobrien
5938494Sobrien  memset((char *) &res, 0, sizeof(res));
6038494Sobrien  if (clnt_call(clnt, AMQPROC_NULL,
6138494Sobrien		(XDRPROC_T_TYPE) xdr_void, argp,
6238494Sobrien		(XDRPROC_T_TYPE) xdr_void, &res, TIMEOUT)
6338494Sobrien      != RPC_SUCCESS) {
6438494Sobrien    return (NULL);
6538494Sobrien  }
6638494Sobrien  return ((voidp) &res);
6738494Sobrien}
6838494Sobrien
6938494Sobrien
7038494Sobrienamq_mount_tree_p *
7138494Sobrienamqproc_mnttree_1(amq_string *argp, CLIENT *clnt)
7238494Sobrien{
7338494Sobrien  static amq_mount_tree_p res;
7438494Sobrien
7538494Sobrien  memset((char *) &res, 0, sizeof(res));
7638494Sobrien  if (clnt_call(clnt, AMQPROC_MNTTREE,
7738494Sobrien		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
78174294Sobrien		(XDRPROC_T_TYPE) xdr_amq_mount_tree_p, (SVC_IN_ARG_TYPE) &res,
7938494Sobrien		TIMEOUT) != RPC_SUCCESS) {
8038494Sobrien    return (NULL);
8138494Sobrien  }
8238494Sobrien  return (&res);
8338494Sobrien}
8438494Sobrien
8538494Sobrien
8638494Sobrienvoidp
8738494Sobrienamqproc_umnt_1(amq_string *argp, CLIENT *clnt)
8838494Sobrien{
8938494Sobrien  static char res;
9038494Sobrien
9138494Sobrien  memset((char *) &res, 0, sizeof(res));
9238494Sobrien  if (clnt_call(clnt, AMQPROC_UMNT,
9338494Sobrien		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
9438494Sobrien		(XDRPROC_T_TYPE) xdr_void, &res,
9538494Sobrien		TIMEOUT) != RPC_SUCCESS) {
9638494Sobrien    return (NULL);
9738494Sobrien  }
9838494Sobrien  return ((voidp) &res);
9938494Sobrien}
10038494Sobrien
10138494Sobrien
10238494Sobrienamq_mount_stats *
10338494Sobrienamqproc_stats_1(voidp argp, CLIENT *clnt)
10438494Sobrien{
10538494Sobrien  static amq_mount_stats res;
10638494Sobrien
10738494Sobrien  memset((char *) &res, 0, sizeof(res));
10838494Sobrien  if (clnt_call(clnt, AMQPROC_STATS,
10938494Sobrien		(XDRPROC_T_TYPE) xdr_void, argp,
11038494Sobrien		(XDRPROC_T_TYPE) xdr_amq_mount_stats,
111174294Sobrien		(SVC_IN_ARG_TYPE) &res,
11238494Sobrien		TIMEOUT) != RPC_SUCCESS) {
11338494Sobrien    return (NULL);
11438494Sobrien  }
11538494Sobrien  return (&res);
11638494Sobrien}
11738494Sobrien
11838494Sobrien
11938494Sobrienamq_mount_tree_list *
12038494Sobrienamqproc_export_1(voidp argp, CLIENT *clnt)
12138494Sobrien{
12238494Sobrien  static amq_mount_tree_list res;
12338494Sobrien
12438494Sobrien  memset((char *) &res, 0, sizeof(res));
12538494Sobrien  if (clnt_call(clnt, AMQPROC_EXPORT,
12638494Sobrien		(XDRPROC_T_TYPE) xdr_void, argp,
12738494Sobrien		(XDRPROC_T_TYPE) xdr_amq_mount_tree_list,
128174294Sobrien		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
12938494Sobrien    return (NULL);
13038494Sobrien  }
13138494Sobrien  return (&res);
13238494Sobrien}
13338494Sobrien
13438494Sobrien
13538494Sobrienint *
13638494Sobrienamqproc_setopt_1(amq_setopt *argp, CLIENT *clnt)
13738494Sobrien{
13838494Sobrien  static int res;
13938494Sobrien
14038494Sobrien  memset((char *) &res, 0, sizeof(res));
14138494Sobrien  if (clnt_call(clnt, AMQPROC_SETOPT, (XDRPROC_T_TYPE) xdr_amq_setopt,
14238494Sobrien		(SVC_IN_ARG_TYPE) argp, (XDRPROC_T_TYPE) xdr_int,
143174294Sobrien		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
14438494Sobrien    return (NULL);
14538494Sobrien  }
14638494Sobrien  return (&res);
14738494Sobrien}
14838494Sobrien
14938494Sobrien
15038494Sobrienamq_mount_info_list *
15138494Sobrienamqproc_getmntfs_1(voidp argp, CLIENT *clnt)
15238494Sobrien{
15338494Sobrien  static amq_mount_info_list res;
15438494Sobrien
15538494Sobrien  memset((char *) &res, 0, sizeof(res));
15638494Sobrien  if (clnt_call(clnt, AMQPROC_GETMNTFS, (XDRPROC_T_TYPE) xdr_void, argp,
15738494Sobrien		(XDRPROC_T_TYPE) xdr_amq_mount_info_list,
158174294Sobrien		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
15938494Sobrien    return (NULL);
16038494Sobrien  }
16138494Sobrien  return (&res);
16238494Sobrien}
16338494Sobrien
16438494Sobrien
16538494Sobrienint *
16638494Sobrienamqproc_mount_1(voidp argp, CLIENT *clnt)
16738494Sobrien{
16838494Sobrien  static int res;
16938494Sobrien
17038494Sobrien  memset((char *) &res, 0, sizeof(res));
17138494Sobrien  if (clnt_call(clnt, AMQPROC_MOUNT, (XDRPROC_T_TYPE) xdr_amq_string, argp,
172174294Sobrien		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
17338494Sobrien		TIMEOUT) != RPC_SUCCESS) {
17438494Sobrien    return (NULL);
17538494Sobrien  }
17638494Sobrien  return (&res);
17738494Sobrien}
17838494Sobrien
17938494Sobrien
18038494Sobrienamq_string *
18138494Sobrienamqproc_getvers_1(voidp argp, CLIENT *clnt)
18238494Sobrien{
18338494Sobrien  static amq_string res;
18438494Sobrien
18538494Sobrien  memset((char *) &res, 0, sizeof(res));
18638494Sobrien  if (clnt_call(clnt, AMQPROC_GETVERS, (XDRPROC_T_TYPE) xdr_void, argp,
187174294Sobrien		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
18838494Sobrien		TIMEOUT) != RPC_SUCCESS) {
18938494Sobrien    return (NULL);
19038494Sobrien  }
19138494Sobrien  return (&res);
19238494Sobrien}
19338494Sobrien
19438494Sobrien
19538494Sobrienint *
19638494Sobrienamqproc_getpid_1(voidp argp, CLIENT *clnt)
19738494Sobrien{
19838494Sobrien  static int res;
19938494Sobrien
20038494Sobrien  memset((char *) &res, 0, sizeof(res));
20138494Sobrien  if (clnt_call(clnt, AMQPROC_GETPID, (XDRPROC_T_TYPE) xdr_void, argp,
202174294Sobrien		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
20338494Sobrien		TIMEOUT) != RPC_SUCCESS) {
20438494Sobrien    return (NULL);
20538494Sobrien  }
20638494Sobrien  return (&res);
20738494Sobrien}
208174294Sobrien
209174294Sobrien
210174294Sobrienamq_string *
211174294Sobrienamqproc_pawd_1(amq_string *argp, CLIENT *clnt)
212174294Sobrien{
213174294Sobrien  static amq_string res;
214174294Sobrien
215174294Sobrien  memset((char *) &res, 0, sizeof(res));
216174294Sobrien  if (clnt_call(clnt, AMQPROC_PAWD,
217174294Sobrien		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
218174294Sobrien		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
219174294Sobrien		TIMEOUT) != RPC_SUCCESS) {
220174294Sobrien    return (NULL);
221174294Sobrien  }
222174294Sobrien  return (&res);
223174294Sobrien}
224