amq_clnt.c revision 310490
1/*
2 * Copyright (c) 1997-2014 Erez Zadok
3 * Copyright (c) 1990 Jan-Simon Pendry
4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 *    may be used to endorse or promote products derived from this software
21 *    without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 *
36 * File: am-utils/amq/amq_clnt.c
37 *
38 */
39
40#ifdef HAVE_CONFIG_H
41# include <config.h>
42#endif /* HAVE_CONFIG_H */
43#include <am_defs.h>
44#include <amq.h>
45
46
47static struct timeval TIMEOUT = {ALLOWED_MOUNT_TIME, 0};
48
49
50voidp
51amqproc_null_1(voidp argp, CLIENT *clnt)
52{
53  static char res;
54
55  memset((char *) &res, 0, sizeof(res));
56  if (clnt_call(clnt, AMQPROC_NULL,
57		(XDRPROC_T_TYPE) xdr_void, argp,
58		(XDRPROC_T_TYPE) xdr_void, &res, TIMEOUT)
59      != RPC_SUCCESS) {
60    return (NULL);
61  }
62  return ((voidp) &res);
63}
64
65
66amq_mount_tree_p *
67amqproc_mnttree_1(amq_string *argp, CLIENT *clnt)
68{
69  static amq_mount_tree_p res;
70
71  memset((char *) &res, 0, sizeof(res));
72  if (clnt_call(clnt, AMQPROC_MNTTREE,
73		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
74		(XDRPROC_T_TYPE) xdr_amq_mount_tree_p, (SVC_IN_ARG_TYPE) &res,
75		TIMEOUT) != RPC_SUCCESS) {
76    return (NULL);
77  }
78  return (&res);
79}
80
81
82voidp
83amqproc_umnt_1(amq_string *argp, CLIENT *clnt)
84{
85  static char res;
86
87  memset((char *) &res, 0, sizeof(res));
88  if (clnt_call(clnt, AMQPROC_UMNT,
89		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
90		(XDRPROC_T_TYPE) xdr_void, &res,
91		TIMEOUT) != RPC_SUCCESS) {
92    return (NULL);
93  }
94  return ((voidp) &res);
95}
96
97
98amq_sync_umnt *
99amqproc_sync_umnt_1(amq_string *argp, CLIENT *clnt)
100{
101  static amq_sync_umnt res;
102  enum clnt_stat rv;
103
104  memset((char *) &res, 0, sizeof(res));
105  if ((rv = clnt_call(clnt, AMQPROC_SYNC_UMNT,
106		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
107		(XDRPROC_T_TYPE) xdr_amq_sync_umnt, (SVC_IN_ARG_TYPE) &res,
108		TIMEOUT)) != RPC_SUCCESS) {
109    return (NULL);
110  }
111  return &res;
112}
113
114
115amq_mount_stats *
116amqproc_stats_1(voidp argp, CLIENT *clnt)
117{
118  static amq_mount_stats res;
119
120  memset((char *) &res, 0, sizeof(res));
121  if (clnt_call(clnt, AMQPROC_STATS,
122		(XDRPROC_T_TYPE) xdr_void, argp,
123		(XDRPROC_T_TYPE) xdr_amq_mount_stats,
124		(SVC_IN_ARG_TYPE) &res,
125		TIMEOUT) != RPC_SUCCESS) {
126    return (NULL);
127  }
128  return (&res);
129}
130
131
132amq_mount_tree_list *
133amqproc_export_1(voidp argp, CLIENT *clnt)
134{
135  static amq_mount_tree_list res;
136
137  memset((char *) &res, 0, sizeof(res));
138  if (clnt_call(clnt, AMQPROC_EXPORT,
139		(XDRPROC_T_TYPE) xdr_void, argp,
140		(XDRPROC_T_TYPE) xdr_amq_mount_tree_list,
141		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
142    return (NULL);
143  }
144  return (&res);
145}
146
147
148int *
149amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt)
150{
151  static int res;
152
153  memset((char *) &res, 0, sizeof(res));
154  if (clnt_call(clnt, AMQPROC_SETOPT, (XDRPROC_T_TYPE) xdr_amq_setopt,
155		(SVC_IN_ARG_TYPE) argp, (XDRPROC_T_TYPE) xdr_int,
156		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
157    return (NULL);
158  }
159  return (&res);
160}
161
162
163amq_mount_info_list *
164amqproc_getmntfs_1(voidp argp, CLIENT *clnt)
165{
166  static amq_mount_info_list res;
167
168  memset((char *) &res, 0, sizeof(res));
169  if (clnt_call(clnt, AMQPROC_GETMNTFS, (XDRPROC_T_TYPE) xdr_void, argp,
170		(XDRPROC_T_TYPE) xdr_amq_mount_info_list,
171		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
172    return (NULL);
173  }
174  return (&res);
175}
176
177amq_map_info_list *
178amqproc_getmapinfo_1(voidp argp, CLIENT *clnt)
179{
180  static amq_map_info_list res;
181
182  memset((char *) &res, 0, sizeof(res));
183  if (clnt_call(clnt, AMQPROC_GETMAPINFO, (XDRPROC_T_TYPE) xdr_void, argp,
184		(XDRPROC_T_TYPE) xdr_amq_map_info_list,
185		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
186    return (NULL);
187  }
188  return (&res);
189}
190
191
192int *
193amqproc_mount_1(voidp argp, CLIENT *clnt)
194{
195  static int res;
196
197  memset((char *) &res, 0, sizeof(res));
198  if (clnt_call(clnt, AMQPROC_MOUNT, (XDRPROC_T_TYPE) xdr_amq_string, argp,
199		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
200		TIMEOUT) != RPC_SUCCESS) {
201    return (NULL);
202  }
203  return (&res);
204}
205
206
207amq_string *
208amqproc_getvers_1(voidp argp, CLIENT *clnt)
209{
210  static amq_string res;
211
212  memset((char *) &res, 0, sizeof(res));
213  if (clnt_call(clnt, AMQPROC_GETVERS, (XDRPROC_T_TYPE) xdr_void, argp,
214		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
215		TIMEOUT) != RPC_SUCCESS) {
216    return (NULL);
217  }
218  return (&res);
219}
220
221
222int *
223amqproc_getpid_1(voidp argp, CLIENT *clnt)
224{
225  static int res;
226
227  memset((char *) &res, 0, sizeof(res));
228  if (clnt_call(clnt, AMQPROC_GETPID, (XDRPROC_T_TYPE) xdr_void, argp,
229		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
230		TIMEOUT) != RPC_SUCCESS) {
231    return (NULL);
232  }
233  return (&res);
234}
235
236
237amq_string *
238amqproc_pawd_1(amq_string *argp, CLIENT *clnt)
239{
240  static amq_string res;
241
242  memset((char *) &res, 0, sizeof(res));
243  if (clnt_call(clnt, AMQPROC_PAWD,
244		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
245		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
246		TIMEOUT) != RPC_SUCCESS) {
247    return (NULL);
248  }
249  return (&res);
250}
251