xref: /netbsd-src/external/bsd/am-utils/dist/amq/amq_clnt.c (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1 /*	$NetBSD: amq_clnt.c,v 1.1.1.1 2008/09/19 20:07:17 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-2007 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. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgment:
23  *      This product includes software developed by the University of
24  *      California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *
42  * File: am-utils/amq/amq_clnt.c
43  *
44  */
45 
46 #ifdef HAVE_CONFIG_H
47 # include <config.h>
48 #endif /* HAVE_CONFIG_H */
49 #include <am_defs.h>
50 #include <amq.h>
51 
52 
53 static struct timeval TIMEOUT = {ALLOWED_MOUNT_TIME, 0};
54 
55 
56 voidp
57 amqproc_null_1(voidp argp, CLIENT *clnt)
58 {
59   static char res;
60 
61   memset((char *) &res, 0, sizeof(res));
62   if (clnt_call(clnt, AMQPROC_NULL,
63 		(XDRPROC_T_TYPE) xdr_void, argp,
64 		(XDRPROC_T_TYPE) xdr_void, &res, TIMEOUT)
65       != RPC_SUCCESS) {
66     return (NULL);
67   }
68   return ((voidp) &res);
69 }
70 
71 
72 amq_mount_tree_p *
73 amqproc_mnttree_1(amq_string *argp, CLIENT *clnt)
74 {
75   static amq_mount_tree_p res;
76 
77   memset((char *) &res, 0, sizeof(res));
78   if (clnt_call(clnt, AMQPROC_MNTTREE,
79 		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
80 		(XDRPROC_T_TYPE) xdr_amq_mount_tree_p, (SVC_IN_ARG_TYPE) &res,
81 		TIMEOUT) != RPC_SUCCESS) {
82     return (NULL);
83   }
84   return (&res);
85 }
86 
87 
88 voidp
89 amqproc_umnt_1(amq_string *argp, CLIENT *clnt)
90 {
91   static char res;
92 
93   memset((char *) &res, 0, sizeof(res));
94   if (clnt_call(clnt, AMQPROC_UMNT,
95 		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
96 		(XDRPROC_T_TYPE) xdr_void, &res,
97 		TIMEOUT) != RPC_SUCCESS) {
98     return (NULL);
99   }
100   return ((voidp) &res);
101 }
102 
103 
104 amq_mount_stats *
105 amqproc_stats_1(voidp argp, CLIENT *clnt)
106 {
107   static amq_mount_stats res;
108 
109   memset((char *) &res, 0, sizeof(res));
110   if (clnt_call(clnt, AMQPROC_STATS,
111 		(XDRPROC_T_TYPE) xdr_void, argp,
112 		(XDRPROC_T_TYPE) xdr_amq_mount_stats,
113 		(SVC_IN_ARG_TYPE) &res,
114 		TIMEOUT) != RPC_SUCCESS) {
115     return (NULL);
116   }
117   return (&res);
118 }
119 
120 
121 amq_mount_tree_list *
122 amqproc_export_1(voidp argp, CLIENT *clnt)
123 {
124   static amq_mount_tree_list res;
125 
126   memset((char *) &res, 0, sizeof(res));
127   if (clnt_call(clnt, AMQPROC_EXPORT,
128 		(XDRPROC_T_TYPE) xdr_void, argp,
129 		(XDRPROC_T_TYPE) xdr_amq_mount_tree_list,
130 		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
131     return (NULL);
132   }
133   return (&res);
134 }
135 
136 
137 int *
138 amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt)
139 {
140   static int res;
141 
142   memset((char *) &res, 0, sizeof(res));
143   if (clnt_call(clnt, AMQPROC_SETOPT, (XDRPROC_T_TYPE) xdr_amq_setopt,
144 		(SVC_IN_ARG_TYPE) argp, (XDRPROC_T_TYPE) xdr_int,
145 		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
146     return (NULL);
147   }
148   return (&res);
149 }
150 
151 
152 amq_mount_info_list *
153 amqproc_getmntfs_1(voidp argp, CLIENT *clnt)
154 {
155   static amq_mount_info_list res;
156 
157   memset((char *) &res, 0, sizeof(res));
158   if (clnt_call(clnt, AMQPROC_GETMNTFS, (XDRPROC_T_TYPE) xdr_void, argp,
159 		(XDRPROC_T_TYPE) xdr_amq_mount_info_list,
160 		(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
161     return (NULL);
162   }
163   return (&res);
164 }
165 
166 
167 int *
168 amqproc_mount_1(voidp argp, CLIENT *clnt)
169 {
170   static int res;
171 
172   memset((char *) &res, 0, sizeof(res));
173   if (clnt_call(clnt, AMQPROC_MOUNT, (XDRPROC_T_TYPE) xdr_amq_string, argp,
174 		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
175 		TIMEOUT) != RPC_SUCCESS) {
176     return (NULL);
177   }
178   return (&res);
179 }
180 
181 
182 amq_string *
183 amqproc_getvers_1(voidp argp, CLIENT *clnt)
184 {
185   static amq_string res;
186 
187   memset((char *) &res, 0, sizeof(res));
188   if (clnt_call(clnt, AMQPROC_GETVERS, (XDRPROC_T_TYPE) xdr_void, argp,
189 		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
190 		TIMEOUT) != RPC_SUCCESS) {
191     return (NULL);
192   }
193   return (&res);
194 }
195 
196 
197 int *
198 amqproc_getpid_1(voidp argp, CLIENT *clnt)
199 {
200   static int res;
201 
202   memset((char *) &res, 0, sizeof(res));
203   if (clnt_call(clnt, AMQPROC_GETPID, (XDRPROC_T_TYPE) xdr_void, argp,
204 		(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res,
205 		TIMEOUT) != RPC_SUCCESS) {
206     return (NULL);
207   }
208   return (&res);
209 }
210 
211 
212 amq_string *
213 amqproc_pawd_1(amq_string *argp, CLIENT *clnt)
214 {
215   static amq_string res;
216 
217   memset((char *) &res, 0, sizeof(res));
218   if (clnt_call(clnt, AMQPROC_PAWD,
219 		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
220 		(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res,
221 		TIMEOUT) != RPC_SUCCESS) {
222     return (NULL);
223   }
224   return (&res);
225 }
226