tools/llvm: Do not build with symbols
[minix3.git] / lib / libc / rpc / rpcb_st_xdr.c
blobd901c183d57ce92856efd654a1e0c786d23f97e3
1 /* $NetBSD: rpcb_st_xdr.c,v 1.10 2013/03/11 20:19:29 tron Exp $ */
3 /*
4 * Copyright (c) 2010, Oracle America, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
16 * * Neither the name of the "Oracle America, Inc." nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * Copyright 1991 Sun Microsystems, Inc.
35 * rpcb_stat_xdr.c
39 * This file was generated from rpcb_prot.x, but includes only those
40 * routines used with the rpcbind stats facility.
43 #include <sys/cdefs.h>
44 #if defined(LIBC_SCCS) && !defined(lint)
45 __RCSID("$NetBSD: rpcb_st_xdr.c,v 1.10 2013/03/11 20:19:29 tron Exp $");
46 #endif
48 #include "namespace.h"
49 #include <rpc/rpc.h>
51 #include <assert.h>
53 /* Link list of all the stats about getport and getaddr */
55 #ifdef __weak_alias
56 __weak_alias(xdr_rpcbs_addrlist,_xdr_rpcbs_addrlist)
57 __weak_alias(xdr_rpcbs_rmtcalllist,_xdr_rpcbs_rmtcalllist)
58 __weak_alias(xdr_rpcbs_proc,_xdr_rpcbs_proc)
59 __weak_alias(xdr_rpcbs_addrlist_ptr,_xdr_rpcbs_addrlist_ptr)
60 __weak_alias(xdr_rpcbs_rmtcalllist_ptr,_xdr_rpcbs_rmtcalllist_ptr)
61 __weak_alias(xdr_rpcb_stat,_xdr_rpcb_stat)
62 __weak_alias(xdr_rpcb_stat_byvers,_xdr_rpcb_stat_byvers)
63 #endif
65 bool_t
66 xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
69 _DIAGASSERT(objp != NULL);
71 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
72 return (FALSE);
74 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
75 return (FALSE);
77 if (!xdr_int(xdrs, &objp->success)) {
78 return (FALSE);
80 if (!xdr_int(xdrs, &objp->failure)) {
81 return (FALSE);
83 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
84 return (FALSE);
87 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
88 (u_int)sizeof (rpcbs_addrlist),
89 (xdrproc_t)xdr_rpcbs_addrlist)) {
90 return (FALSE);
93 return (TRUE);
96 /* Link list of all the stats about rmtcall */
98 bool_t
99 xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
101 int32_t *buf;
103 _DIAGASSERT(xdrs != NULL);
104 _DIAGASSERT(objp != NULL);
106 if (xdrs->x_op == XDR_ENCODE) {
107 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
108 if (buf == NULL) {
109 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
110 return (FALSE);
112 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
113 return (FALSE);
115 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
116 return (FALSE);
118 if (!xdr_int(xdrs, &objp->success)) {
119 return (FALSE);
121 if (!xdr_int(xdrs, &objp->failure)) {
122 return (FALSE);
124 if (!xdr_int(xdrs, &objp->indirect)) {
125 return (FALSE);
127 } else {
128 IXDR_PUT_U_INT32(buf, objp->prog);
129 IXDR_PUT_U_INT32(buf, objp->vers);
130 IXDR_PUT_U_INT32(buf, objp->proc);
131 IXDR_PUT_INT32(buf, objp->success);
132 IXDR_PUT_INT32(buf, objp->failure);
133 IXDR_PUT_INT32(buf, objp->indirect);
135 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
136 return (FALSE);
138 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
139 (u_int)sizeof (rpcbs_rmtcalllist),
140 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
141 return (FALSE);
143 return (TRUE);
144 } else if (xdrs->x_op == XDR_DECODE) {
145 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
146 if (buf == NULL) {
147 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
148 return (FALSE);
150 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
151 return (FALSE);
153 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
154 return (FALSE);
156 if (!xdr_int(xdrs, &objp->success)) {
157 return (FALSE);
159 if (!xdr_int(xdrs, &objp->failure)) {
160 return (FALSE);
162 if (!xdr_int(xdrs, &objp->indirect)) {
163 return (FALSE);
165 } else {
166 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
167 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
168 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
169 objp->success = (int)IXDR_GET_INT32(buf);
170 objp->failure = (int)IXDR_GET_INT32(buf);
171 objp->indirect = (int)IXDR_GET_INT32(buf);
173 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
174 return (FALSE);
176 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
177 (u_int)sizeof (rpcbs_rmtcalllist),
178 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
179 return (FALSE);
181 return (TRUE);
183 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
184 return (FALSE);
186 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
187 return (FALSE);
189 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
190 return (FALSE);
192 if (!xdr_int(xdrs, &objp->success)) {
193 return (FALSE);
195 if (!xdr_int(xdrs, &objp->failure)) {
196 return (FALSE);
198 if (!xdr_int(xdrs, &objp->indirect)) {
199 return (FALSE);
201 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
202 return (FALSE);
204 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
205 (u_int)sizeof (rpcbs_rmtcalllist),
206 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
207 return (FALSE);
209 return (TRUE);
212 bool_t
213 xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
215 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
216 (u_int)sizeof (int), (xdrproc_t)xdr_int)) {
217 return (FALSE);
219 return (TRUE);
222 bool_t
223 xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
225 if (!xdr_pointer(xdrs, (char **)objp, (u_int)sizeof (rpcbs_addrlist),
226 (xdrproc_t)xdr_rpcbs_addrlist)) {
227 return (FALSE);
229 return (TRUE);
232 bool_t
233 xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
235 if (!xdr_pointer(xdrs, (char **)objp, (u_int)sizeof (rpcbs_rmtcalllist),
236 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
237 return (FALSE);
239 return (TRUE);
242 bool_t
243 xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
246 _DIAGASSERT(objp != NULL);
248 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
249 return (FALSE);
251 if (!xdr_int(xdrs, &objp->setinfo)) {
252 return (FALSE);
254 if (!xdr_int(xdrs, &objp->unsetinfo)) {
255 return (FALSE);
257 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
258 return (FALSE);
260 return (TRUE);
264 * One rpcb_stat structure is returned for each version of rpcbind
265 * being monitored.
267 bool_t
268 xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
270 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
271 (u_int)sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
272 return (FALSE);
274 return (TRUE);