rpcb_st_xdr.c revision 1.1.2.1 1 /* $NetBSD: rpcb_st_xdr.c,v 1.1.2.1 2000/07/14 16:48:12 fvdl Exp $ */
2
3 /*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or
9 * program developed by the user.
10 *
11 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 *
15 * Sun RPC is provided with no support and without any obligation on the
16 * part of Sun Microsystems, Inc. to assist in its use, correction,
17 * modification or enhancement.
18 *
19 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21 * OR ANY PART THEREOF.
22 *
23 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24 * or profits or other special, indirect and consequential damages, even if
25 * Sun has been advised of the possibility of such damages.
26 *
27 * Sun Microsystems, Inc.
28 * 2550 Garcia Avenue
29 * Mountain View, California 94043
30 */
31 /*
32 * Copyright 1991 Sun Microsystems, Inc.
33 * rpcb_stat_xdr.c
34 */
35
36 /*
37 * This file was generated from rpcb_prot.x, but includes only those
38 * routines used with the rpcbind stats facility.
39 */
40
41 #include "namespace.h"
42 #include <rpc/rpc.h>
43
44 /* Link list of all the stats about getport and getaddr */
45
46 #ifdef __weak_alias
47 __weak_alias(xdr_rpcbs_addrlist,_xdr_rpcbs_addrlist)
48 __weak_alias(xdr_rpcbs_rmtcalllist,_xdr_rpcbs_rmtcalllist)
49 __weak_alias(xdr_rpcbs_proc,_xdr_rpcbs_proc)
50 __weak_alias(xdr_rpcbs_addrlist_ptr,_xdr_rpcbs_addrlist_ptr)
51 __weak_alias(xdr_rpcbs_rmtcalllist_ptr,_xdr_rpcbs_rmtcalllist_ptr)
52 __weak_alias(xdr_rpcb_stat,_xdr_rpcb_stat)
53 __weak_alias(xdr_rpcb_stat_byvers,_xdr_rpcb_stat_byvers)
54 #endif
55
56 bool_t
57 xdr_rpcbs_addrlist(xdrs, objp)
58 XDR *xdrs;
59 rpcbs_addrlist *objp;
60 {
61
62 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
63 return (FALSE);
64 }
65 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
66 return (FALSE);
67 }
68 if (!xdr_int(xdrs, &objp->success)) {
69 return (FALSE);
70 }
71 if (!xdr_int(xdrs, &objp->failure)) {
72 return (FALSE);
73 }
74 if (!xdr_string(xdrs, &objp->netid, ~0)) {
75 return (FALSE);
76 }
77
78 if (!xdr_pointer(xdrs, (char **)&objp->next,
79 sizeof (rpcbs_addrlist),
80 (xdrproc_t)xdr_rpcbs_addrlist)) {
81 return (FALSE);
82 }
83
84 return (TRUE);
85 }
86
87 /* Link list of all the stats about rmtcall */
88
89 bool_t
90 xdr_rpcbs_rmtcalllist(xdrs, objp)
91 XDR *xdrs;
92 rpcbs_rmtcalllist *objp;
93 {
94 register int32_t *buf;
95
96 if (xdrs->x_op == XDR_ENCODE) {
97 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
98 if (buf == NULL) {
99 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
100 return (FALSE);
101 }
102 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
103 return (FALSE);
104 }
105 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
106 return (FALSE);
107 }
108 if (!xdr_int(xdrs, &objp->success)) {
109 return (FALSE);
110 }
111 if (!xdr_int(xdrs, &objp->failure)) {
112 return (FALSE);
113 }
114 if (!xdr_int(xdrs, &objp->indirect)) {
115 return (FALSE);
116 }
117 } else {
118 IXDR_PUT_U_INT32(buf, objp->prog);
119 IXDR_PUT_U_INT32(buf, objp->vers);
120 IXDR_PUT_U_INT32(buf, objp->proc);
121 IXDR_PUT_INT32(buf, objp->success);
122 IXDR_PUT_INT32(buf, objp->failure);
123 IXDR_PUT_INT32(buf, objp->indirect);
124 }
125 if (!xdr_string(xdrs, &objp->netid, ~0)) {
126 return (FALSE);
127 }
128 if (!xdr_pointer(xdrs, (char **)&objp->next,
129 sizeof (rpcbs_rmtcalllist),
130 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
131 return (FALSE);
132 }
133 return (TRUE);
134 } else if (xdrs->x_op == XDR_DECODE) {
135 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
136 if (buf == NULL) {
137 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
138 return (FALSE);
139 }
140 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
141 return (FALSE);
142 }
143 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
144 return (FALSE);
145 }
146 if (!xdr_int(xdrs, &objp->success)) {
147 return (FALSE);
148 }
149 if (!xdr_int(xdrs, &objp->failure)) {
150 return (FALSE);
151 }
152 if (!xdr_int(xdrs, &objp->indirect)) {
153 return (FALSE);
154 }
155 } else {
156 objp->prog = IXDR_GET_U_INT32(buf);
157 objp->vers = IXDR_GET_U_INT32(buf);
158 objp->proc = IXDR_GET_U_INT32(buf);
159 objp->success = IXDR_GET_INT32(buf);
160 objp->failure = IXDR_GET_INT32(buf);
161 objp->indirect = IXDR_GET_INT32(buf);
162 }
163 if (!xdr_string(xdrs, &objp->netid, ~0)) {
164 return (FALSE);
165 }
166 if (!xdr_pointer(xdrs, (char **)&objp->next,
167 sizeof (rpcbs_rmtcalllist),
168 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
169 return (FALSE);
170 }
171 return (TRUE);
172 }
173 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
174 return (FALSE);
175 }
176 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
177 return (FALSE);
178 }
179 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
180 return (FALSE);
181 }
182 if (!xdr_int(xdrs, &objp->success)) {
183 return (FALSE);
184 }
185 if (!xdr_int(xdrs, &objp->failure)) {
186 return (FALSE);
187 }
188 if (!xdr_int(xdrs, &objp->indirect)) {
189 return (FALSE);
190 }
191 if (!xdr_string(xdrs, &objp->netid, ~0)) {
192 return (FALSE);
193 }
194 if (!xdr_pointer(xdrs, (char **)&objp->next,
195 sizeof (rpcbs_rmtcalllist),
196 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
197 return (FALSE);
198 }
199 return (TRUE);
200 }
201
202 bool_t
203 xdr_rpcbs_proc(xdrs, objp)
204 XDR *xdrs;
205 rpcbs_proc objp;
206 {
207 if (!xdr_vector(xdrs, (char *)objp, RPCBSTAT_HIGHPROC, sizeof (int),
208 (xdrproc_t)xdr_int)) {
209 return (FALSE);
210 }
211 return (TRUE);
212 }
213
214 bool_t
215 xdr_rpcbs_addrlist_ptr(xdrs, objp)
216 XDR *xdrs;
217 rpcbs_addrlist_ptr *objp;
218 {
219 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
220 (xdrproc_t)xdr_rpcbs_addrlist)) {
221 return (FALSE);
222 }
223 return (TRUE);
224 }
225
226 bool_t
227 xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
228 XDR *xdrs;
229 rpcbs_rmtcalllist_ptr *objp;
230 {
231 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
232 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
233 return (FALSE);
234 }
235 return (TRUE);
236 }
237
238 bool_t
239 xdr_rpcb_stat(xdrs, objp)
240 XDR *xdrs;
241 rpcb_stat *objp;
242 {
243
244 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
245 return (FALSE);
246 }
247 if (!xdr_int(xdrs, &objp->setinfo)) {
248 return (FALSE);
249 }
250 if (!xdr_int(xdrs, &objp->unsetinfo)) {
251 return (FALSE);
252 }
253 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
254 return (FALSE);
255 }
256 return (TRUE);
257 }
258
259 /*
260 * One rpcb_stat structure is returned for each version of rpcbind
261 * being monitored.
262 */
263 bool_t
264 xdr_rpcb_stat_byvers(xdrs, objp)
265 XDR *xdrs;
266 rpcb_stat_byvers objp;
267 {
268 if (!xdr_vector(xdrs, (char *)objp, RPCBVERS_STAT, sizeof (rpcb_stat),
269 (xdrproc_t)xdr_rpcb_stat)) {
270 return (FALSE);
271 }
272 return (TRUE);
273 }
274