libutil: add O_NOCTTY back to old pty open code
[minix.git] / lib / libc / rpc / rpcb_st_xdr.c
blobed235e3e2a80b302341f224966dfdf7b75f74c44
1 /* $NetBSD: rpcb_st_xdr.c,v 1.7 2006/05/11 17:11:57 mrg Exp $ */
3 /*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or
9 * program developed by the user.
11 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
15 * Sun RPC is provided with no support and without any obligation on the
16 * part of Sun Microsystems, Inc. to assist in its use, correction,
17 * modification or enhancement.
19 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21 * OR ANY PART THEREOF.
23 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24 * or profits or other special, indirect and consequential damages, even if
25 * Sun has been advised of the possibility of such damages.
27 * Sun Microsystems, Inc.
28 * 2550 Garcia Avenue
29 * Mountain View, California 94043
32 * Copyright 1991 Sun Microsystems, Inc.
33 * rpcb_stat_xdr.c
37 * This file was generated from rpcb_prot.x, but includes only those
38 * routines used with the rpcbind stats facility.
41 #include <sys/cdefs.h>
42 #if defined(LIBC_SCCS) && !defined(lint)
43 __RCSID("$NetBSD: rpcb_st_xdr.c,v 1.7 2006/05/11 17:11:57 mrg Exp $");
44 #endif
46 #include "namespace.h"
47 #include <rpc/rpc.h>
49 #include <assert.h>
51 /* Link list of all the stats about getport and getaddr */
53 #ifdef __weak_alias
54 __weak_alias(xdr_rpcbs_addrlist,_xdr_rpcbs_addrlist)
55 __weak_alias(xdr_rpcbs_rmtcalllist,_xdr_rpcbs_rmtcalllist)
56 __weak_alias(xdr_rpcbs_proc,_xdr_rpcbs_proc)
57 __weak_alias(xdr_rpcbs_addrlist_ptr,_xdr_rpcbs_addrlist_ptr)
58 __weak_alias(xdr_rpcbs_rmtcalllist_ptr,_xdr_rpcbs_rmtcalllist_ptr)
59 __weak_alias(xdr_rpcb_stat,_xdr_rpcb_stat)
60 __weak_alias(xdr_rpcb_stat_byvers,_xdr_rpcb_stat_byvers)
61 #endif
63 bool_t
64 xdr_rpcbs_addrlist(xdrs, objp)
65 XDR *xdrs;
66 rpcbs_addrlist *objp;
69 _DIAGASSERT(objp != NULL);
71 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
72 return (FALSE);
74 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
75 return (FALSE);
77 if (!xdr_int(xdrs, &objp->success)) {
78 return (FALSE);
80 if (!xdr_int(xdrs, &objp->failure)) {
81 return (FALSE);
83 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
84 return (FALSE);
87 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
88 sizeof (rpcbs_addrlist),
89 (xdrproc_t)xdr_rpcbs_addrlist)) {
90 return (FALSE);
93 return (TRUE);
96 /* Link list of all the stats about rmtcall */
98 bool_t
99 xdr_rpcbs_rmtcalllist(xdrs, objp)
100 XDR *xdrs;
101 rpcbs_rmtcalllist *objp;
103 int32_t *buf;
105 _DIAGASSERT(xdrs != NULL);
106 _DIAGASSERT(objp != NULL);
108 if (xdrs->x_op == XDR_ENCODE) {
109 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
110 if (buf == NULL) {
111 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
112 return (FALSE);
114 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
115 return (FALSE);
117 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
118 return (FALSE);
120 if (!xdr_int(xdrs, &objp->success)) {
121 return (FALSE);
123 if (!xdr_int(xdrs, &objp->failure)) {
124 return (FALSE);
126 if (!xdr_int(xdrs, &objp->indirect)) {
127 return (FALSE);
129 } else {
130 IXDR_PUT_U_INT32(buf, objp->prog);
131 IXDR_PUT_U_INT32(buf, objp->vers);
132 IXDR_PUT_U_INT32(buf, objp->proc);
133 IXDR_PUT_INT32(buf, objp->success);
134 IXDR_PUT_INT32(buf, objp->failure);
135 IXDR_PUT_INT32(buf, objp->indirect);
137 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
138 return (FALSE);
140 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
141 sizeof (rpcbs_rmtcalllist),
142 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
143 return (FALSE);
145 return (TRUE);
146 } else if (xdrs->x_op == XDR_DECODE) {
147 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
148 if (buf == NULL) {
149 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
150 return (FALSE);
152 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
153 return (FALSE);
155 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
156 return (FALSE);
158 if (!xdr_int(xdrs, &objp->success)) {
159 return (FALSE);
161 if (!xdr_int(xdrs, &objp->failure)) {
162 return (FALSE);
164 if (!xdr_int(xdrs, &objp->indirect)) {
165 return (FALSE);
167 } else {
168 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf);
169 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf);
170 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf);
171 objp->success = (int)IXDR_GET_INT32(buf);
172 objp->failure = (int)IXDR_GET_INT32(buf);
173 objp->indirect = (int)IXDR_GET_INT32(buf);
175 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
176 return (FALSE);
178 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
179 sizeof (rpcbs_rmtcalllist),
180 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
181 return (FALSE);
183 return (TRUE);
185 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
186 return (FALSE);
188 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
189 return (FALSE);
191 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
192 return (FALSE);
194 if (!xdr_int(xdrs, &objp->success)) {
195 return (FALSE);
197 if (!xdr_int(xdrs, &objp->failure)) {
198 return (FALSE);
200 if (!xdr_int(xdrs, &objp->indirect)) {
201 return (FALSE);
203 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
204 return (FALSE);
206 if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
207 sizeof (rpcbs_rmtcalllist),
208 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
209 return (FALSE);
211 return (TRUE);
214 bool_t
215 xdr_rpcbs_proc(xdrs, objp)
216 XDR *xdrs;
217 rpcbs_proc objp;
219 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
220 sizeof (int), (xdrproc_t)xdr_int)) {
221 return (FALSE);
223 return (TRUE);
226 bool_t
227 xdr_rpcbs_addrlist_ptr(xdrs, objp)
228 XDR *xdrs;
229 rpcbs_addrlist_ptr *objp;
231 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
232 (xdrproc_t)xdr_rpcbs_addrlist)) {
233 return (FALSE);
235 return (TRUE);
238 bool_t
239 xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
240 XDR *xdrs;
241 rpcbs_rmtcalllist_ptr *objp;
243 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
244 (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
245 return (FALSE);
247 return (TRUE);
250 bool_t
251 xdr_rpcb_stat(xdrs, objp)
252 XDR *xdrs;
253 rpcb_stat *objp;
256 _DIAGASSERT(objp != NULL);
258 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
259 return (FALSE);
261 if (!xdr_int(xdrs, &objp->setinfo)) {
262 return (FALSE);
264 if (!xdr_int(xdrs, &objp->unsetinfo)) {
265 return (FALSE);
267 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
268 return (FALSE);
270 return (TRUE);
274 * One rpcb_stat structure is returned for each version of rpcbind
275 * being monitored.
277 bool_t
278 xdr_rpcb_stat_byvers(xdrs, objp)
279 XDR *xdrs;
280 rpcb_stat_byvers objp;
282 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
283 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
284 return (FALSE);
286 return (TRUE);