1 /* $NetBSD: rpcb_st_xdr.c,v 1.10 2013/03/11 20:19:29 tron Exp $ */
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
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.
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 $");
48 #include "namespace.h"
53 /* Link list of all the stats about getport and getaddr */
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
)
66 xdr_rpcbs_addrlist(XDR
*xdrs
, rpcbs_addrlist
*objp
)
69 _DIAGASSERT(objp
!= NULL
);
71 if (!xdr_u_int32_t(xdrs
, &objp
->prog
)) {
74 if (!xdr_u_int32_t(xdrs
, &objp
->vers
)) {
77 if (!xdr_int(xdrs
, &objp
->success
)) {
80 if (!xdr_int(xdrs
, &objp
->failure
)) {
83 if (!xdr_string(xdrs
, &objp
->netid
, (u_int
)~0)) {
87 if (!xdr_pointer(xdrs
, (char **)(void *)&objp
->next
,
88 (u_int
)sizeof (rpcbs_addrlist
),
89 (xdrproc_t
)xdr_rpcbs_addrlist
)) {
96 /* Link list of all the stats about rmtcall */
99 xdr_rpcbs_rmtcalllist(XDR
*xdrs
, rpcbs_rmtcalllist
*objp
)
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
);
109 if (!xdr_u_int32_t(xdrs
, &objp
->prog
)) {
112 if (!xdr_u_int32_t(xdrs
, &objp
->vers
)) {
115 if (!xdr_u_int32_t(xdrs
, &objp
->proc
)) {
118 if (!xdr_int(xdrs
, &objp
->success
)) {
121 if (!xdr_int(xdrs
, &objp
->failure
)) {
124 if (!xdr_int(xdrs
, &objp
->indirect
)) {
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)) {
138 if (!xdr_pointer(xdrs
, (char **)(void *)&objp
->next
,
139 (u_int
)sizeof (rpcbs_rmtcalllist
),
140 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
144 } else if (xdrs
->x_op
== XDR_DECODE
) {
145 buf
= XDR_INLINE(xdrs
, 6 * BYTES_PER_XDR_UNIT
);
147 if (!xdr_u_int32_t(xdrs
, &objp
->prog
)) {
150 if (!xdr_u_int32_t(xdrs
, &objp
->vers
)) {
153 if (!xdr_u_int32_t(xdrs
, &objp
->proc
)) {
156 if (!xdr_int(xdrs
, &objp
->success
)) {
159 if (!xdr_int(xdrs
, &objp
->failure
)) {
162 if (!xdr_int(xdrs
, &objp
->indirect
)) {
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)) {
176 if (!xdr_pointer(xdrs
, (char **)(void *)&objp
->next
,
177 (u_int
)sizeof (rpcbs_rmtcalllist
),
178 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
183 if (!xdr_u_int32_t(xdrs
, &objp
->prog
)) {
186 if (!xdr_u_int32_t(xdrs
, &objp
->vers
)) {
189 if (!xdr_u_int32_t(xdrs
, &objp
->proc
)) {
192 if (!xdr_int(xdrs
, &objp
->success
)) {
195 if (!xdr_int(xdrs
, &objp
->failure
)) {
198 if (!xdr_int(xdrs
, &objp
->indirect
)) {
201 if (!xdr_string(xdrs
, &objp
->netid
, (u_int
)~0)) {
204 if (!xdr_pointer(xdrs
, (char **)(void *)&objp
->next
,
205 (u_int
)sizeof (rpcbs_rmtcalllist
),
206 (xdrproc_t
)xdr_rpcbs_rmtcalllist
)) {
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
)) {
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
)) {
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
)) {
243 xdr_rpcb_stat(XDR
*xdrs
, rpcb_stat
*objp
)
246 _DIAGASSERT(objp
!= NULL
);
248 if (!xdr_rpcbs_proc(xdrs
, objp
->info
)) {
251 if (!xdr_int(xdrs
, &objp
->setinfo
)) {
254 if (!xdr_int(xdrs
, &objp
->unsetinfo
)) {
257 if (!xdr_rpcbs_addrlist_ptr(xdrs
, &objp
->addrinfo
)) {
264 * One rpcb_stat structure is returned for each version of rpcbind
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
)) {