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