source: rtems-libbsd/freebsd/lib/libc/rpc/rpcb_st_xdr.c @ 60b1d40

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 60b1d40 was 60b1d40, checked in by Sebastian Huber <sebastian.huber@…>, on 06/09/16 at 08:23:57

RPC(3): Import from FreeBSD

  • Property mode set to 100644
File size: 6.8 KB
Line 
1#include <machine/rtems-bsd-user-space.h>
2
3/*      $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $     */
4
5/*-
6 * Copyright (c) 2009, Sun Microsystems, Inc.
7 * All rights reserved.
8 *
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.
19 *
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.
31 */
32/*
33 * Copyright 1991 Sun Microsystems, Inc.
34 * rpcb_stat_xdr.c
35 */
36
37/*
38 * This file was generated from rpcb_prot.x, but includes only those
39 * routines used with the rpcbind stats facility.
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD$");
44
45#include "namespace.h"
46#include <rpc/rpc.h>
47#include "un-namespace.h"
48
49/* Link list of all the stats about getport and getaddr */
50
51bool_t
52xdr_rpcbs_addrlist(xdrs, objp)
53        XDR *xdrs;
54        rpcbs_addrlist *objp;
55{
56        struct rpcbs_addrlist **pnext;
57
58            if (!xdr_u_int32_t(xdrs, &objp->prog)) {
59                return (FALSE);
60            }
61            if (!xdr_u_int32_t(xdrs, &objp->vers)) {
62                return (FALSE);
63            }
64            if (!xdr_int(xdrs, &objp->success)) {
65                return (FALSE);
66            }
67            if (!xdr_int(xdrs, &objp->failure)) {
68                return (FALSE);
69            }
70            if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
71                return (FALSE);
72            }
73
74            pnext = &objp->next;
75
76            if (!xdr_pointer(xdrs, (char **) pnext,
77                        sizeof (rpcbs_addrlist),
78                        (xdrproc_t)xdr_rpcbs_addrlist)) {
79                return (FALSE);
80            }
81
82        return (TRUE);
83}
84
85/* Link list of all the stats about rmtcall */
86
87bool_t
88xdr_rpcbs_rmtcalllist(xdrs, objp)
89        XDR *xdrs;
90        rpcbs_rmtcalllist *objp;
91{
92        int32_t *buf;
93        struct rpcbs_rmtcalllist **pnext;
94
95        if (xdrs->x_op == XDR_ENCODE) {
96        buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
97        if (buf == NULL) {
98                if (!xdr_u_int32_t(xdrs, &objp->prog)) {
99                        return (FALSE);
100                }
101                if (!xdr_u_int32_t(xdrs, &objp->vers)) {
102                        return (FALSE);
103                }
104                if (!xdr_u_int32_t(xdrs, &objp->proc)) {
105                        return (FALSE);
106                }
107                if (!xdr_int(xdrs, &objp->success)) {
108                        return (FALSE);
109                }
110                if (!xdr_int(xdrs, &objp->failure)) {
111                        return (FALSE);
112                }
113                if (!xdr_int(xdrs, &objp->indirect)) {
114                        return (FALSE);
115                }
116        } else {
117                IXDR_PUT_U_INT32(buf, objp->prog);
118                IXDR_PUT_U_INT32(buf, objp->vers);
119                IXDR_PUT_U_INT32(buf, objp->proc);
120                IXDR_PUT_INT32(buf, objp->success);
121                IXDR_PUT_INT32(buf, objp->failure);
122                IXDR_PUT_INT32(buf, objp->indirect);
123        }
124        if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
125                return (FALSE);
126        }
127        pnext = &objp->next;
128        if (!xdr_pointer(xdrs, (char **) pnext,
129                        sizeof (rpcbs_rmtcalllist),
130                        (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
131                return (FALSE);
132        }
133        return (TRUE);
134        } else if (xdrs->x_op == XDR_DECODE) {
135        buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
136        if (buf == NULL) {
137                if (!xdr_u_int32_t(xdrs, &objp->prog)) {
138                        return (FALSE);
139                }
140                if (!xdr_u_int32_t(xdrs, &objp->vers)) {
141                        return (FALSE);
142                }
143                if (!xdr_u_int32_t(xdrs, &objp->proc)) {
144                        return (FALSE);
145                }
146                if (!xdr_int(xdrs, &objp->success)) {
147                        return (FALSE);
148                }
149                if (!xdr_int(xdrs, &objp->failure)) {
150                        return (FALSE);
151                }
152                if (!xdr_int(xdrs, &objp->indirect)) {
153                        return (FALSE);
154                }
155        } else {
156                objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
157                objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
158                objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
159                objp->success = (int)IXDR_GET_INT32(buf);
160                objp->failure = (int)IXDR_GET_INT32(buf);
161                objp->indirect = (int)IXDR_GET_INT32(buf);
162        }
163        if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
164                return (FALSE);
165        }
166        if (!xdr_pointer(xdrs, (char **) pnext,
167                        sizeof (rpcbs_rmtcalllist),
168                        (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
169                return (FALSE);
170        }
171        return (TRUE);
172        }
173        if (!xdr_u_int32_t(xdrs, &objp->prog)) {
174                return (FALSE);
175        }
176        if (!xdr_u_int32_t(xdrs, &objp->vers)) {
177                return (FALSE);
178        }
179        if (!xdr_u_int32_t(xdrs, &objp->proc)) {
180                return (FALSE);
181        }
182        if (!xdr_int(xdrs, &objp->success)) {
183                return (FALSE);
184        }
185        if (!xdr_int(xdrs, &objp->failure)) {
186                return (FALSE);
187        }
188        if (!xdr_int(xdrs, &objp->indirect)) {
189                return (FALSE);
190        }
191        if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
192                return (FALSE);
193        }
194        if (!xdr_pointer(xdrs, (char **) pnext,
195                        sizeof (rpcbs_rmtcalllist),
196                        (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
197                return (FALSE);
198        }
199        return (TRUE);
200}
201
202bool_t
203xdr_rpcbs_proc(xdrs, objp)
204        XDR *xdrs;
205        rpcbs_proc objp;
206{
207        if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
208            sizeof (int), (xdrproc_t)xdr_int)) {
209                return (FALSE);
210        }
211        return (TRUE);
212}
213
214bool_t
215xdr_rpcbs_addrlist_ptr(xdrs, objp)
216        XDR *xdrs;
217        rpcbs_addrlist_ptr *objp;
218{
219        if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
220                        (xdrproc_t)xdr_rpcbs_addrlist)) {
221                return (FALSE);
222        }
223        return (TRUE);
224}
225
226bool_t
227xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
228        XDR *xdrs;
229        rpcbs_rmtcalllist_ptr *objp;
230{
231        if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
232                        (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
233                return (FALSE);
234        }
235        return (TRUE);
236}
237
238bool_t
239xdr_rpcb_stat(xdrs, objp)
240        XDR *xdrs;
241        rpcb_stat *objp;
242{
243
244        if (!xdr_rpcbs_proc(xdrs, objp->info)) {
245                return (FALSE);
246        }
247        if (!xdr_int(xdrs, &objp->setinfo)) {
248                return (FALSE);
249        }
250        if (!xdr_int(xdrs, &objp->unsetinfo)) {
251                return (FALSE);
252        }
253        if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
254                return (FALSE);
255        }
256        if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) {
257                return (FALSE);
258        }
259        return (TRUE);
260}
261
262/*
263 * One rpcb_stat structure is returned for each version of rpcbind
264 * being monitored.
265 */
266bool_t
267xdr_rpcb_stat_byvers(xdrs, objp)
268    XDR *xdrs;
269    rpcb_stat_byvers objp;
270{
271        if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
272            sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
273                return (FALSE);
274        }
275        return (TRUE);
276}
Note: See TracBrowser for help on using the repository browser.