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