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