1 /* $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */ 2 /* $FreeBSD$ */ 3 4 /* 5 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 6 * unrestricted use provided that this legend is included on all tape 7 * media and as a part of the software program in whole or part. Users 8 * may copy or modify Sun RPC without charge, but are not authorized 9 * to license or distribute it to anyone else except as part of a product or 10 * program developed by the user. 11 * 12 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 13 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 14 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 15 * 16 * Sun RPC is provided with no support and without any obligation on the 17 * part of Sun Microsystems, Inc. to assist in its use, correction, 18 * modification or enhancement. 19 * 20 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 21 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 22 * OR ANY PART THEREOF. 23 * 24 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 25 * or profits or other special, indirect and consequential damages, even if 26 * Sun has been advised of the possibility of such damages. 27 * 28 * Sun Microsystems, Inc. 29 * 2550 Garcia Avenue 30 * Mountain View, California 94043 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 "namespace.h" 43 #include <rpc/rpc.h> 44 #include "un-namespace.h" 45 46 /* Link list of all the stats about getport and getaddr */ 47 48 bool_t 49 xdr_rpcbs_addrlist(xdrs, objp) 50 XDR *xdrs; 51 rpcbs_addrlist *objp; 52 { 53 54 if (!xdr_u_int32_t(xdrs, &objp->prog)) { 55 return (FALSE); 56 } 57 if (!xdr_u_int32_t(xdrs, &objp->vers)) { 58 return (FALSE); 59 } 60 if (!xdr_int(xdrs, &objp->success)) { 61 return (FALSE); 62 } 63 if (!xdr_int(xdrs, &objp->failure)) { 64 return (FALSE); 65 } 66 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { 67 return (FALSE); 68 } 69 70 if (!xdr_pointer(xdrs, (char **)&objp->next, 71 sizeof (rpcbs_addrlist), 72 (xdrproc_t)xdr_rpcbs_addrlist)) { 73 return (FALSE); 74 } 75 76 return (TRUE); 77 } 78 79 /* Link list of all the stats about rmtcall */ 80 81 bool_t 82 xdr_rpcbs_rmtcalllist(xdrs, objp) 83 XDR *xdrs; 84 rpcbs_rmtcalllist *objp; 85 { 86 int32_t *buf; 87 88 if (xdrs->x_op == XDR_ENCODE) { 89 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT); 90 if (buf == NULL) { 91 if (!xdr_u_int32_t(xdrs, &objp->prog)) { 92 return (FALSE); 93 } 94 if (!xdr_u_int32_t(xdrs, &objp->vers)) { 95 return (FALSE); 96 } 97 if (!xdr_u_int32_t(xdrs, &objp->proc)) { 98 return (FALSE); 99 } 100 if (!xdr_int(xdrs, &objp->success)) { 101 return (FALSE); 102 } 103 if (!xdr_int(xdrs, &objp->failure)) { 104 return (FALSE); 105 } 106 if (!xdr_int(xdrs, &objp->indirect)) { 107 return (FALSE); 108 } 109 } else { 110 IXDR_PUT_U_INT32(buf, objp->prog); 111 IXDR_PUT_U_INT32(buf, objp->vers); 112 IXDR_PUT_U_INT32(buf, objp->proc); 113 IXDR_PUT_INT32(buf, objp->success); 114 IXDR_PUT_INT32(buf, objp->failure); 115 IXDR_PUT_INT32(buf, objp->indirect); 116 } 117 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { 118 return (FALSE); 119 } 120 if (!xdr_pointer(xdrs, (char **)&objp->next, 121 sizeof (rpcbs_rmtcalllist), 122 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 123 return (FALSE); 124 } 125 return (TRUE); 126 } else if (xdrs->x_op == XDR_DECODE) { 127 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT); 128 if (buf == NULL) { 129 if (!xdr_u_int32_t(xdrs, &objp->prog)) { 130 return (FALSE); 131 } 132 if (!xdr_u_int32_t(xdrs, &objp->vers)) { 133 return (FALSE); 134 } 135 if (!xdr_u_int32_t(xdrs, &objp->proc)) { 136 return (FALSE); 137 } 138 if (!xdr_int(xdrs, &objp->success)) { 139 return (FALSE); 140 } 141 if (!xdr_int(xdrs, &objp->failure)) { 142 return (FALSE); 143 } 144 if (!xdr_int(xdrs, &objp->indirect)) { 145 return (FALSE); 146 } 147 } else { 148 objp->prog = (rpcprog_t)IXDR_GET_U_INT32(buf); 149 objp->vers = (rpcvers_t)IXDR_GET_U_INT32(buf); 150 objp->proc = (rpcproc_t)IXDR_GET_U_INT32(buf); 151 objp->success = (int)IXDR_GET_INT32(buf); 152 objp->failure = (int)IXDR_GET_INT32(buf); 153 objp->indirect = (int)IXDR_GET_INT32(buf); 154 } 155 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { 156 return (FALSE); 157 } 158 if (!xdr_pointer(xdrs, (char **)&objp->next, 159 sizeof (rpcbs_rmtcalllist), 160 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 161 return (FALSE); 162 } 163 return (TRUE); 164 } 165 if (!xdr_u_int32_t(xdrs, &objp->prog)) { 166 return (FALSE); 167 } 168 if (!xdr_u_int32_t(xdrs, &objp->vers)) { 169 return (FALSE); 170 } 171 if (!xdr_u_int32_t(xdrs, &objp->proc)) { 172 return (FALSE); 173 } 174 if (!xdr_int(xdrs, &objp->success)) { 175 return (FALSE); 176 } 177 if (!xdr_int(xdrs, &objp->failure)) { 178 return (FALSE); 179 } 180 if (!xdr_int(xdrs, &objp->indirect)) { 181 return (FALSE); 182 } 183 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { 184 return (FALSE); 185 } 186 if (!xdr_pointer(xdrs, (char **)&objp->next, 187 sizeof (rpcbs_rmtcalllist), 188 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 189 return (FALSE); 190 } 191 return (TRUE); 192 } 193 194 bool_t 195 xdr_rpcbs_proc(xdrs, objp) 196 XDR *xdrs; 197 rpcbs_proc objp; 198 { 199 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC, 200 sizeof (int), (xdrproc_t)xdr_int)) { 201 return (FALSE); 202 } 203 return (TRUE); 204 } 205 206 bool_t 207 xdr_rpcbs_addrlist_ptr(xdrs, objp) 208 XDR *xdrs; 209 rpcbs_addrlist_ptr *objp; 210 { 211 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist), 212 (xdrproc_t)xdr_rpcbs_addrlist)) { 213 return (FALSE); 214 } 215 return (TRUE); 216 } 217 218 bool_t 219 xdr_rpcbs_rmtcalllist_ptr(xdrs, objp) 220 XDR *xdrs; 221 rpcbs_rmtcalllist_ptr *objp; 222 { 223 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist), 224 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 225 return (FALSE); 226 } 227 return (TRUE); 228 } 229 230 bool_t 231 xdr_rpcb_stat(xdrs, objp) 232 XDR *xdrs; 233 rpcb_stat *objp; 234 { 235 236 if (!xdr_rpcbs_proc(xdrs, objp->info)) { 237 return (FALSE); 238 } 239 if (!xdr_int(xdrs, &objp->setinfo)) { 240 return (FALSE); 241 } 242 if (!xdr_int(xdrs, &objp->unsetinfo)) { 243 return (FALSE); 244 } 245 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) { 246 return (FALSE); 247 } 248 return (TRUE); 249 } 250 251 /* 252 * One rpcb_stat structure is returned for each version of rpcbind 253 * being monitored. 254 */ 255 bool_t 256 xdr_rpcb_stat_byvers(xdrs, objp) 257 XDR *xdrs; 258 rpcb_stat_byvers objp; 259 { 260 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT, 261 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) { 262 return (FALSE); 263 } 264 return (TRUE); 265 } 266