Deleted Added
full compact
rpcb_st_xdr.c (258578) rpcb_st_xdr.c (288113)
1/* $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */
2
3/*-
4 * Copyright (c) 2009, Sun Microsystems, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * - Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * - Neither the name of Sun Microsystems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30/*
31 * Copyright 1991 Sun Microsystems, Inc.
32 * rpcb_stat_xdr.c
33 */
34
35/*
36 * This file was generated from rpcb_prot.x, but includes only those
37 * routines used with the rpcbind stats facility.
38 */
39
40#include <sys/cdefs.h>
1/* $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */
2
3/*-
4 * Copyright (c) 2009, Sun Microsystems, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * - Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * - Neither the name of Sun Microsystems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30/*
31 * Copyright 1991 Sun Microsystems, Inc.
32 * rpcb_stat_xdr.c
33 */
34
35/*
36 * This file was generated from rpcb_prot.x, but includes only those
37 * routines used with the rpcbind stats facility.
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/lib/libc/rpc/rpcb_st_xdr.c 258578 2013-11-25 19:04:36Z hrs $");
41__FBSDID("$FreeBSD: head/lib/libc/rpc/rpcb_st_xdr.c 288113 2015-09-22 15:40:07Z rodrigc $");
42
43#include "namespace.h"
44#include <rpc/rpc.h>
45#include "un-namespace.h"
46
47/* Link list of all the stats about getport and getaddr */
48
49bool_t
42
43#include "namespace.h"
44#include <rpc/rpc.h>
45#include "un-namespace.h"
46
47/* Link list of all the stats about getport and getaddr */
48
49bool_t
50xdr_rpcbs_addrlist(xdrs, objp)
51 XDR *xdrs;
52 rpcbs_addrlist *objp;
50xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
53{
54 struct rpcbs_addrlist **pnext;
55
56 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
57 return (FALSE);
58 }
59 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
60 return (FALSE);
61 }
62 if (!xdr_int(xdrs, &objp->success)) {
63 return (FALSE);
64 }
65 if (!xdr_int(xdrs, &objp->failure)) {
66 return (FALSE);
67 }
68 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
69 return (FALSE);
70 }
71
72 pnext = &objp->next;
73
74 if (!xdr_pointer(xdrs, (char **) pnext,
75 sizeof (rpcbs_addrlist),
76 (xdrproc_t)xdr_rpcbs_addrlist)) {
77 return (FALSE);
78 }
79
80 return (TRUE);
81}
82
83/* Link list of all the stats about rmtcall */
84
85bool_t
51{
52 struct rpcbs_addrlist **pnext;
53
54 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
55 return (FALSE);
56 }
57 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
58 return (FALSE);
59 }
60 if (!xdr_int(xdrs, &objp->success)) {
61 return (FALSE);
62 }
63 if (!xdr_int(xdrs, &objp->failure)) {
64 return (FALSE);
65 }
66 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
67 return (FALSE);
68 }
69
70 pnext = &objp->next;
71
72 if (!xdr_pointer(xdrs, (char **) pnext,
73 sizeof (rpcbs_addrlist),
74 (xdrproc_t)xdr_rpcbs_addrlist)) {
75 return (FALSE);
76 }
77
78 return (TRUE);
79}
80
81/* Link list of all the stats about rmtcall */
82
83bool_t
86xdr_rpcbs_rmtcalllist(xdrs, objp)
87 XDR *xdrs;
88 rpcbs_rmtcalllist *objp;
84xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
89{
90 int32_t *buf;
91 struct rpcbs_rmtcalllist **pnext;
92
93 if (xdrs->x_op == XDR_ENCODE) {
94 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
95 if (buf == NULL) {
96 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
97 return (FALSE);
98 }
99 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
100 return (FALSE);
101 }
102 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
103 return (FALSE);
104 }
105 if (!xdr_int(xdrs, &objp->success)) {
106 return (FALSE);
107 }
108 if (!xdr_int(xdrs, &objp->failure)) {
109 return (FALSE);
110 }
111 if (!xdr_int(xdrs, &objp->indirect)) {
112 return (FALSE);
113 }
114 } else {
115 IXDR_PUT_U_INT32(buf, objp->prog);
116 IXDR_PUT_U_INT32(buf, objp->vers);
117 IXDR_PUT_U_INT32(buf, objp->proc);
118 IXDR_PUT_INT32(buf, objp->success);
119 IXDR_PUT_INT32(buf, objp->failure);
120 IXDR_PUT_INT32(buf, objp->indirect);
121 }
122 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
123 return (FALSE);
124 }
125 pnext = &objp->next;
126 if (!xdr_pointer(xdrs, (char **) pnext,
127 sizeof (rpcbs_rmtcalllist),
128 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
129 return (FALSE);
130 }
131 return (TRUE);
132 } else if (xdrs->x_op == XDR_DECODE) {
133 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
134 if (buf == NULL) {
135 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
136 return (FALSE);
137 }
138 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
139 return (FALSE);
140 }
141 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
142 return (FALSE);
143 }
144 if (!xdr_int(xdrs, &objp->success)) {
145 return (FALSE);
146 }
147 if (!xdr_int(xdrs, &objp->failure)) {
148 return (FALSE);
149 }
150 if (!xdr_int(xdrs, &objp->indirect)) {
151 return (FALSE);
152 }
153 } else {
154 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
155 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
156 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
157 objp->success = (int)IXDR_GET_INT32(buf);
158 objp->failure = (int)IXDR_GET_INT32(buf);
159 objp->indirect = (int)IXDR_GET_INT32(buf);
160 }
161 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
162 return (FALSE);
163 }
164 if (!xdr_pointer(xdrs, (char **) pnext,
165 sizeof (rpcbs_rmtcalllist),
166 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
167 return (FALSE);
168 }
169 return (TRUE);
170 }
171 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
172 return (FALSE);
173 }
174 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
175 return (FALSE);
176 }
177 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
178 return (FALSE);
179 }
180 if (!xdr_int(xdrs, &objp->success)) {
181 return (FALSE);
182 }
183 if (!xdr_int(xdrs, &objp->failure)) {
184 return (FALSE);
185 }
186 if (!xdr_int(xdrs, &objp->indirect)) {
187 return (FALSE);
188 }
189 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
190 return (FALSE);
191 }
192 if (!xdr_pointer(xdrs, (char **) pnext,
193 sizeof (rpcbs_rmtcalllist),
194 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
195 return (FALSE);
196 }
197 return (TRUE);
198}
199
200bool_t
85{
86 int32_t *buf;
87 struct rpcbs_rmtcalllist **pnext;
88
89 if (xdrs->x_op == XDR_ENCODE) {
90 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
91 if (buf == NULL) {
92 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
93 return (FALSE);
94 }
95 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
96 return (FALSE);
97 }
98 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
99 return (FALSE);
100 }
101 if (!xdr_int(xdrs, &objp->success)) {
102 return (FALSE);
103 }
104 if (!xdr_int(xdrs, &objp->failure)) {
105 return (FALSE);
106 }
107 if (!xdr_int(xdrs, &objp->indirect)) {
108 return (FALSE);
109 }
110 } else {
111 IXDR_PUT_U_INT32(buf, objp->prog);
112 IXDR_PUT_U_INT32(buf, objp->vers);
113 IXDR_PUT_U_INT32(buf, objp->proc);
114 IXDR_PUT_INT32(buf, objp->success);
115 IXDR_PUT_INT32(buf, objp->failure);
116 IXDR_PUT_INT32(buf, objp->indirect);
117 }
118 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
119 return (FALSE);
120 }
121 pnext = &objp->next;
122 if (!xdr_pointer(xdrs, (char **) pnext,
123 sizeof (rpcbs_rmtcalllist),
124 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
125 return (FALSE);
126 }
127 return (TRUE);
128 } else if (xdrs->x_op == XDR_DECODE) {
129 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
130 if (buf == NULL) {
131 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
132 return (FALSE);
133 }
134 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
135 return (FALSE);
136 }
137 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
138 return (FALSE);
139 }
140 if (!xdr_int(xdrs, &objp->success)) {
141 return (FALSE);
142 }
143 if (!xdr_int(xdrs, &objp->failure)) {
144 return (FALSE);
145 }
146 if (!xdr_int(xdrs, &objp->indirect)) {
147 return (FALSE);
148 }
149 } else {
150 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
151 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
152 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
153 objp->success = (int)IXDR_GET_INT32(buf);
154 objp->failure = (int)IXDR_GET_INT32(buf);
155 objp->indirect = (int)IXDR_GET_INT32(buf);
156 }
157 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
158 return (FALSE);
159 }
160 if (!xdr_pointer(xdrs, (char **) pnext,
161 sizeof (rpcbs_rmtcalllist),
162 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
163 return (FALSE);
164 }
165 return (TRUE);
166 }
167 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
168 return (FALSE);
169 }
170 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
171 return (FALSE);
172 }
173 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
174 return (FALSE);
175 }
176 if (!xdr_int(xdrs, &objp->success)) {
177 return (FALSE);
178 }
179 if (!xdr_int(xdrs, &objp->failure)) {
180 return (FALSE);
181 }
182 if (!xdr_int(xdrs, &objp->indirect)) {
183 return (FALSE);
184 }
185 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
186 return (FALSE);
187 }
188 if (!xdr_pointer(xdrs, (char **) pnext,
189 sizeof (rpcbs_rmtcalllist),
190 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
191 return (FALSE);
192 }
193 return (TRUE);
194}
195
196bool_t
201xdr_rpcbs_proc(xdrs, objp)
202 XDR *xdrs;
203 rpcbs_proc objp;
197xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
204{
205 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
206 sizeof (int), (xdrproc_t)xdr_int)) {
207 return (FALSE);
208 }
209 return (TRUE);
210}
211
212bool_t
198{
199 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
200 sizeof (int), (xdrproc_t)xdr_int)) {
201 return (FALSE);
202 }
203 return (TRUE);
204}
205
206bool_t
213xdr_rpcbs_addrlist_ptr(xdrs, objp)
214 XDR *xdrs;
215 rpcbs_addrlist_ptr *objp;
207xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
216{
217 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
218 (xdrproc_t)xdr_rpcbs_addrlist)) {
219 return (FALSE);
220 }
221 return (TRUE);
222}
223
224bool_t
208{
209 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
210 (xdrproc_t)xdr_rpcbs_addrlist)) {
211 return (FALSE);
212 }
213 return (TRUE);
214}
215
216bool_t
225xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
226 XDR *xdrs;
227 rpcbs_rmtcalllist_ptr *objp;
217xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
228{
229 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
230 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
231 return (FALSE);
232 }
233 return (TRUE);
234}
235
236bool_t
218{
219 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
220 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
221 return (FALSE);
222 }
223 return (TRUE);
224}
225
226bool_t
237xdr_rpcb_stat(xdrs, objp)
238 XDR *xdrs;
239 rpcb_stat *objp;
227xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
240{
241
242 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
243 return (FALSE);
244 }
245 if (!xdr_int(xdrs, &objp->setinfo)) {
246 return (FALSE);
247 }
248 if (!xdr_int(xdrs, &objp->unsetinfo)) {
249 return (FALSE);
250 }
251 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
252 return (FALSE);
253 }
254 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) {
255 return (FALSE);
256 }
257 return (TRUE);
258}
259
260/*
261 * One rpcb_stat structure is returned for each version of rpcbind
262 * being monitored.
263 */
264bool_t
228{
229
230 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
231 return (FALSE);
232 }
233 if (!xdr_int(xdrs, &objp->setinfo)) {
234 return (FALSE);
235 }
236 if (!xdr_int(xdrs, &objp->unsetinfo)) {
237 return (FALSE);
238 }
239 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
240 return (FALSE);
241 }
242 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) {
243 return (FALSE);
244 }
245 return (TRUE);
246}
247
248/*
249 * One rpcb_stat structure is returned for each version of rpcbind
250 * being monitored.
251 */
252bool_t
265xdr_rpcb_stat_byvers(xdrs, objp)
266 XDR *xdrs;
267 rpcb_stat_byvers objp;
253xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
268{
269 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
270 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
271 return (FALSE);
272 }
273 return (TRUE);
274}
254{
255 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
256 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
257 return (FALSE);
258 }
259 return (TRUE);
260}