2 * Copyright (c) 2009, Sun Microsystems, Inc.
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.
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.
28 * $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $
29 * $FreeBSD: src/lib/libc/rpc/rpcb_st_xdr.c,v 1.4 2007/11/20 01:51:20 jb Exp $
32 * Copyright 1991 Sun Microsystems, Inc.
37 * This file was generated from rpcb_prot.x, but includes only those
38 * routines used with the rpcbind stats facility.
41 #include "namespace.h"
43 #include <rpc/rpc_com.h>
44 #include "un-namespace.h"
46 /* Link list of all the stats about getport and getaddr */
49 xdr_rpcbs_addrlist(XDR
*xdrs
, rpcbs_addrlist
*objp
)
51 struct rpcbs_addrlist
**pnext
;
53 if (!xdr_rpcprog(xdrs
, &objp
->prog
)) {
56 if (!xdr_rpcvers(xdrs
, &objp
->vers
)) {
59 if (!xdr_int(xdrs
, &objp
->success
)) {
62 if (!xdr_int(xdrs
, &objp
->failure
)) {
65 if (!xdr_string(xdrs
, &objp
->netid
, RPC_MAXDATASIZE
)) {
71 if (!xdr_pointer(xdrs
, (char **) pnext
,
72 sizeof (rpcbs_addrlist
),
73 (xdrproc_t
)xdr_rpcbs_addrlist
)) {
80 /* Link list of all the stats about rmtcall */
83 xdr_rpcbs_rmtcalllist(XDR
*xdrs
, rpcbs_rmtcalllist
*objp
)
87 if (xdrs
->x_op
== XDR_ENCODE
) {
88 buf
= XDR_INLINE(xdrs
, 6 * BYTES_PER_XDR_UNIT
);
90 if (!xdr_rpcvers(xdrs
, &objp
->prog
)) {
93 if (!xdr_rpcvers(xdrs
, &objp
->vers
)) {
96 if (!xdr_rpcproc(xdrs
, &objp
->proc
)) {
99 if (!xdr_int(xdrs
, &objp
->success
)) {
102 if (!xdr_int(xdrs
, &objp
->failure
)) {
105 if (!xdr_int(xdrs
, &objp
->indirect
)) {
109 IXDR_PUT_U_INT32(buf
, objp
->prog
);
110 IXDR_PUT_U_INT32(buf
, objp
->vers
);
111 IXDR_PUT_U_INT32(buf
, objp
->proc
);
112 IXDR_PUT_INT32(buf
, objp
->success
);
113 IXDR_PUT_INT32(buf
, objp
->failure
);
114 IXDR_PUT_INT32(buf
, objp
->indirect
);
116 if (!xdr_string(xdrs
, &objp
->netid
, RPC_MAXDATASIZE
)) {
119 if (!xdr_pointer(xdrs
, (char **)&objp
->next
,
120 sizeof (rpcbs_rmtcalllist
),
121 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
125 } else if (xdrs
->x_op
== XDR_DECODE
) {
126 buf
= XDR_INLINE(xdrs
, 6 * BYTES_PER_XDR_UNIT
);
128 if (!xdr_rpcprog(xdrs
, &objp
->prog
)) {
131 if (!xdr_rpcvers(xdrs
, &objp
->vers
)) {
134 if (!xdr_rpcproc(xdrs
, &objp
->proc
)) {
137 if (!xdr_int(xdrs
, &objp
->success
)) {
140 if (!xdr_int(xdrs
, &objp
->failure
)) {
143 if (!xdr_int(xdrs
, &objp
->indirect
)) {
147 objp
->prog
= (rpcprog_t
)IXDR_GET_U_INT32(buf
);
148 objp
->vers
= (rpcvers_t
)IXDR_GET_U_INT32(buf
);
149 objp
->proc
= (rpcproc_t
)IXDR_GET_U_INT32(buf
);
150 objp
->success
= (int)IXDR_GET_INT32(buf
);
151 objp
->failure
= (int)IXDR_GET_INT32(buf
);
152 objp
->indirect
= (int)IXDR_GET_INT32(buf
);
154 if (!xdr_string(xdrs
, &objp
->netid
, RPC_MAXDATASIZE
)) {
157 if (!xdr_pointer(xdrs
, (char **)&objp
->next
,
158 sizeof (rpcbs_rmtcalllist
),
159 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
164 if (!xdr_rpcprog(xdrs
, &objp
->prog
)) {
167 if (!xdr_rpcvers(xdrs
, &objp
->vers
)) {
170 if (!xdr_rpcproc(xdrs
, &objp
->proc
)) {
173 if (!xdr_int(xdrs
, &objp
->success
)) {
176 if (!xdr_int(xdrs
, &objp
->failure
)) {
179 if (!xdr_int(xdrs
, &objp
->indirect
)) {
182 if (!xdr_string(xdrs
, &objp
->netid
, RPC_MAXDATASIZE
)) {
185 if (!xdr_pointer(xdrs
, (char **)&objp
->next
,
186 sizeof (rpcbs_rmtcalllist
),
187 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
194 xdr_rpcbs_proc(XDR
*xdrs
, rpcbs_proc objp
)
196 if (!xdr_vector(xdrs
, (char *)(void *)objp
, RPCBSTAT_HIGHPROC
,
197 sizeof (int), (xdrproc_t
)xdr_int
)) {
204 xdr_rpcbs_addrlist_ptr(XDR
*xdrs
, rpcbs_addrlist_ptr
*objp
)
206 if (!xdr_pointer(xdrs
, (char **)objp
, sizeof (rpcbs_addrlist
),
207 (xdrproc_t
)xdr_rpcbs_addrlist
)) {
214 xdr_rpcbs_rmtcalllist_ptr(XDR
*xdrs
, rpcbs_rmtcalllist_ptr
*objp
)
216 if (!xdr_pointer(xdrs
, (char **)objp
, sizeof (rpcbs_rmtcalllist
),
217 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
224 xdr_rpcb_stat(XDR
*xdrs
, rpcb_stat
*objp
)
227 if (!xdr_rpcbs_proc(xdrs
, objp
->info
)) {
230 if (!xdr_int(xdrs
, &objp
->setinfo
)) {
233 if (!xdr_int(xdrs
, &objp
->unsetinfo
)) {
236 if (!xdr_rpcbs_addrlist_ptr(xdrs
, &objp
->addrinfo
)) {
239 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs
, &objp
->rmtinfo
)) {
246 * One rpcb_stat structure is returned for each version of rpcbind
250 xdr_rpcb_stat_byvers(XDR
*xdrs
, rpcb_stat_byvers objp
)
252 if (!xdr_vector(xdrs
, (char *)(void *)objp
, RPCBVERS_STAT
,
253 sizeof (rpcb_stat
), (xdrproc_t
)xdr_rpcb_stat
)) {