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