Debian Codegraph @

extra/tirpc/libtirpc-1.3.5/src/rpcb_st_xdr.c

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