1 /* $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */
4 * SPDX-License-Identifier: BSD-3-Clause
6 * Copyright (c) 2009, Sun Microsystems, Inc.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * - Neither the name of Sun Microsystems, 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 "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
33 * Copyright 1991 Sun Microsystems, Inc.
38 * This file was generated from rpcb_prot.x, but includes only those
39 * routines used with the rpcbind stats facility.
42 #include <sys/cdefs.h>
43 __FBSDID("$FreeBSD$");
45 #include "namespace.h"
47 #include <rpc/rpc_com.h>
48 #include "un-namespace.h"
50 /* Link list of all the stats about getport and getaddr */
53 xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
55 struct rpcbs_addrlist **pnext;
57 if (!xdr_rpcprog(xdrs, &objp->prog)) {
60 if (!xdr_rpcvers(xdrs, &objp->vers)) {
63 if (!xdr_int(xdrs, &objp->success)) {
66 if (!xdr_int(xdrs, &objp->failure)) {
69 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
75 if (!xdr_pointer(xdrs, (char **) pnext,
76 sizeof (rpcbs_addrlist),
77 (xdrproc_t)xdr_rpcbs_addrlist)) {
84 /* Link list of all the stats about rmtcall */
87 xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
90 struct rpcbs_rmtcalllist **pnext;
92 if (xdrs->x_op == XDR_ENCODE) {
93 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
95 if (!xdr_rpcprog(xdrs, &objp->prog)) {
98 if (!xdr_rpcvers(xdrs, &objp->vers)) {
101 if (!xdr_rpcproc(xdrs, &objp->proc)) {
104 if (!xdr_int(xdrs, &objp->success)) {
107 if (!xdr_int(xdrs, &objp->failure)) {
110 if (!xdr_int(xdrs, &objp->indirect)) {
114 IXDR_PUT_U_INT32(buf, objp->prog);
115 IXDR_PUT_U_INT32(buf, objp->vers);
116 IXDR_PUT_U_INT32(buf, objp->proc);
117 IXDR_PUT_INT32(buf, objp->success);
118 IXDR_PUT_INT32(buf, objp->failure);
119 IXDR_PUT_INT32(buf, objp->indirect);
121 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
125 if (!xdr_pointer(xdrs, (char **) pnext,
126 sizeof (rpcbs_rmtcalllist),
127 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
131 } else if (xdrs->x_op == XDR_DECODE) {
132 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
134 if (!xdr_rpcprog(xdrs, &objp->prog)) {
137 if (!xdr_rpcvers(xdrs, &objp->vers)) {
140 if (!xdr_rpcproc(xdrs, &objp->proc)) {
143 if (!xdr_int(xdrs, &objp->success)) {
146 if (!xdr_int(xdrs, &objp->failure)) {
149 if (!xdr_int(xdrs, &objp->indirect)) {
153 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
154 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
155 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
156 objp->success = (int)IXDR_GET_INT32(buf);
157 objp->failure = (int)IXDR_GET_INT32(buf);
158 objp->indirect = (int)IXDR_GET_INT32(buf);
160 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
163 if (!xdr_pointer(xdrs, (char **) pnext,
164 sizeof (rpcbs_rmtcalllist),
165 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
170 if (!xdr_rpcprog(xdrs, &objp->prog)) {
173 if (!xdr_rpcvers(xdrs, &objp->vers)) {
176 if (!xdr_rpcproc(xdrs, &objp->proc)) {
179 if (!xdr_int(xdrs, &objp->success)) {
182 if (!xdr_int(xdrs, &objp->failure)) {
185 if (!xdr_int(xdrs, &objp->indirect)) {
188 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
191 if (!xdr_pointer(xdrs, (char **) pnext,
192 sizeof (rpcbs_rmtcalllist),
193 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
200 xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
202 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
203 sizeof (int), (xdrproc_t)xdr_int)) {
210 xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
212 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
213 (xdrproc_t)xdr_rpcbs_addrlist)) {
220 xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
222 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
223 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
230 xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
233 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
236 if (!xdr_int(xdrs, &objp->setinfo)) {
239 if (!xdr_int(xdrs, &objp->unsetinfo)) {
242 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
245 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) {
252 * One rpcb_stat structure is returned for each version of rpcbind
256 xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
258 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
259 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {