1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1991, 1997-2002 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 /* 30 * This file was generated from rpcb_prot.x, but includes only those 31 * routines used with the rpcbind stats facility. 32 */ 33 34 #include <rpc/rpc.h> 35 #include <rpc/trace.h> 36 37 /* Link list of all the stats about getport and getaddr */ 38 39 bool_t 40 xdr_rpcbs_addrlist(xdrs, objp) 41 XDR *xdrs; 42 rpcbs_addrlist *objp; 43 { 44 trace1(TR_xdr_rpcbs_addrlist, 0); 45 46 if (!xdr_u_int(xdrs, (uint_t *)&objp->prog)) { 47 trace1(TR_xdr_rpcbs_addrlist, 1); 48 return (FALSE); 49 } 50 if (!xdr_u_int(xdrs, (uint_t *)&objp->vers)) { 51 trace1(TR_xdr_rpcbs_addrlist, 1); 52 return (FALSE); 53 } 54 if (!xdr_int(xdrs, &objp->success)) { 55 trace1(TR_xdr_rpcbs_addrlist, 1); 56 return (FALSE); 57 } 58 if (!xdr_int(xdrs, &objp->failure)) { 59 trace1(TR_xdr_rpcbs_addrlist, 1); 60 return (FALSE); 61 } 62 if (!xdr_string(xdrs, &objp->netid, ~0)) { 63 trace1(TR_xdr_rpcbs_addrlist, 1); 64 return (FALSE); 65 } 66 67 return (TRUE); 68 } 69 70 /* Link list of all the stats about rmtcall */ 71 72 bool_t 73 xdr_rpcbs_rmtcalllist(xdrs, objp) 74 XDR *xdrs; 75 rpcbs_rmtcalllist *objp; 76 { 77 register rpc_inline_t *buf; 78 79 trace1(TR_xdr_rpcbs_rmtcalllist, 0); 80 if (xdrs->x_op == XDR_ENCODE) { 81 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT); 82 if (buf == NULL) { 83 if (!xdr_u_int(xdrs, (uint_t *)&objp->prog)) { 84 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 85 return (FALSE); 86 } 87 if (!xdr_u_int(xdrs, (uint_t *)&objp->vers)) { 88 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 89 return (FALSE); 90 } 91 if (!xdr_u_int(xdrs, (uint_t *)&objp->proc)) { 92 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 93 return (FALSE); 94 } 95 if (!xdr_int(xdrs, &objp->success)) { 96 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 97 return (FALSE); 98 } 99 if (!xdr_int(xdrs, &objp->failure)) { 100 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 101 return (FALSE); 102 } 103 if (!xdr_int(xdrs, &objp->indirect)) { 104 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 105 return (FALSE); 106 } 107 } else { 108 IXDR_PUT_U_INT32(buf, objp->prog); 109 IXDR_PUT_U_INT32(buf, objp->vers); 110 IXDR_PUT_U_INT32(buf, objp->proc); 111 IXDR_PUT_INT32(buf, objp->success); 112 IXDR_PUT_INT32(buf, objp->failure); 113 IXDR_PUT_INT32(buf, objp->indirect); 114 } 115 if (!xdr_string(xdrs, &objp->netid, ~0)) { 116 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 117 return (FALSE); 118 } 119 if (!xdr_pointer(xdrs, (char **)&objp->next, 120 (uint_t)sizeof (rpcbs_rmtcalllist), 121 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 122 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 123 return (FALSE); 124 } 125 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 126 return (TRUE); 127 } else if (xdrs->x_op == XDR_DECODE) { 128 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT); 129 if (buf == NULL) { 130 if (!xdr_u_int(xdrs, (uint_t *)&objp->prog)) { 131 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 132 return (FALSE); 133 } 134 if (!xdr_u_int(xdrs, (uint_t *)&objp->vers)) { 135 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 136 return (FALSE); 137 } 138 if (!xdr_u_int(xdrs, (uint_t *)&objp->proc)) { 139 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 140 return (FALSE); 141 } 142 if (!xdr_int(xdrs, &objp->success)) { 143 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 144 return (FALSE); 145 } 146 if (!xdr_int(xdrs, &objp->failure)) { 147 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 148 return (FALSE); 149 } 150 if (!xdr_int(xdrs, &objp->indirect)) { 151 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 152 return (FALSE); 153 } 154 } else { 155 objp->prog = IXDR_GET_U_INT32(buf); 156 objp->vers = IXDR_GET_U_INT32(buf); 157 objp->proc = IXDR_GET_U_INT32(buf); 158 objp->success = IXDR_GET_INT32(buf); 159 objp->failure = IXDR_GET_INT32(buf); 160 objp->indirect = IXDR_GET_INT32(buf); 161 } 162 if (!xdr_string(xdrs, &objp->netid, ~0)) { 163 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 164 return (FALSE); 165 } 166 if (!xdr_pointer(xdrs, (char **)&objp->next, 167 (uint_t)sizeof (rpcbs_rmtcalllist), 168 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 169 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 170 return (FALSE); 171 } 172 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 173 return (TRUE); 174 } 175 if (!xdr_u_int(xdrs, (uint_t *)&objp->prog)) { 176 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 177 return (FALSE); 178 } 179 if (!xdr_u_int(xdrs, (uint_t *)&objp->vers)) { 180 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 181 return (FALSE); 182 } 183 if (!xdr_u_int(xdrs, (uint_t *)&objp->proc)) { 184 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 185 return (FALSE); 186 } 187 if (!xdr_int(xdrs, &objp->success)) { 188 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 189 return (FALSE); 190 } 191 if (!xdr_int(xdrs, &objp->failure)) { 192 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 193 return (FALSE); 194 } 195 if (!xdr_int(xdrs, &objp->indirect)) { 196 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 197 return (FALSE); 198 } 199 if (!xdr_string(xdrs, &objp->netid, ~0)) { 200 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 201 return (FALSE); 202 } 203 if (!xdr_pointer(xdrs, (char **)&objp->next, 204 (uint_t)sizeof (rpcbs_rmtcalllist), 205 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 206 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 207 return (FALSE); 208 } 209 trace1(TR_xdr_rpcbs_rmtcalllist, 1); 210 return (TRUE); 211 } 212 213 bool_t 214 xdr_rpcbs_proc(xdrs, objp) 215 XDR *xdrs; 216 rpcbs_proc objp; 217 { 218 trace1(TR_xdr_rpcbs_proc, 0); 219 if (!xdr_vector(xdrs, (char *)objp, RPCBSTAT_HIGHPROC, sizeof (int), 220 (xdrproc_t)xdr_int)) { 221 trace1(TR_xdr_rpcbs_proc, 1); 222 return (FALSE); 223 } 224 trace1(TR_xdr_rpcbs_proc, 1); 225 return (TRUE); 226 } 227 228 bool_t 229 xdr_rpcbs_addrlist_ptr(xdrs, objp) 230 XDR *xdrs; 231 rpcbs_addrlist_ptr *objp; 232 { 233 bool_t more_data; 234 rpcbs_addrlist_ptr *nextp; 235 236 trace1(TR_xdr_rpcbs_addrlist_ptr, 0); 237 238 for (;;) { 239 240 more_data = (*objp != NULL); 241 242 if (!xdr_bool(xdrs, &more_data)) { 243 trace1(TR_xdr_rpcbs_addrlist_ptr, 1); 244 return (FALSE); 245 } 246 247 if (!more_data) 248 break; 249 250 if (xdrs->x_op == XDR_FREE) 251 nextp = &(*objp)->next; 252 253 if (!xdr_reference(xdrs, (char **)objp, 254 (uint_t)sizeof (rpcbs_addrlist), 255 (xdrproc_t)xdr_rpcbs_addrlist)) { 256 trace1(TR_xdr_rpcbs_addrlist_ptr, 1); 257 return (FALSE); 258 } 259 260 objp = (xdrs->x_op == XDR_FREE) ? nextp : &(*objp)->next; 261 262 } 263 *objp = NULL; 264 trace1(TR_xdr_rpcbs_addrlist_ptr, 1); 265 return (TRUE); 266 } 267 268 bool_t 269 xdr_rpcbs_rmtcalllist_ptr(xdrs, objp) 270 XDR *xdrs; 271 rpcbs_rmtcalllist_ptr *objp; 272 { 273 trace1(TR_xdr_rpcbs_rmtcalllist_ptr, 0); 274 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist), 275 (xdrproc_t)xdr_rpcbs_rmtcalllist)) { 276 trace1(TR_xdr_rpcbs_rmtcalllist_ptr, 1); 277 return (FALSE); 278 } 279 trace1(TR_xdr_rpcbs_rmtcalllist_ptr, 1); 280 return (TRUE); 281 } 282 283 bool_t 284 xdr_rpcb_stat(xdrs, objp) 285 XDR *xdrs; 286 rpcb_stat *objp; 287 { 288 289 trace1(TR_xdr_rpcb_stat, 0); 290 if (!xdr_rpcbs_proc(xdrs, objp->info)) { 291 trace1(TR_xdr_rpcb_stat, 1); 292 return (FALSE); 293 } 294 if (!xdr_int(xdrs, &objp->setinfo)) { 295 trace1(TR_xdr_rpcb_stat, 1); 296 return (FALSE); 297 } 298 if (!xdr_int(xdrs, &objp->unsetinfo)) { 299 trace1(TR_xdr_rpcb_stat, 1); 300 return (FALSE); 301 } 302 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) { 303 trace1(TR_xdr_rpcb_stat, 1); 304 return (FALSE); 305 } 306 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) { 307 trace1(TR_xdr_rpcb_stat, 1); 308 return (FALSE); 309 } 310 trace1(TR_xdr_rpcb_stat, 1); 311 return (TRUE); 312 } 313 314 /* 315 * One rpcb_stat structure is returned for each version of rpcbind 316 * being monitored. 317 */ 318 bool_t 319 xdr_rpcb_stat_byvers(xdrs, objp) 320 XDR *xdrs; 321 rpcb_stat_byvers objp; 322 { 323 trace1(TR_xdr_rpcb_stat_byvers, 0); 324 if (!xdr_vector(xdrs, (char *)objp, RPCBVERS_STAT, sizeof (rpcb_stat), 325 (xdrproc_t)xdr_rpcb_stat)) { 326 trace1(TR_xdr_rpcb_stat_byvers, 1); 327 return (FALSE); 328 } 329 trace1(TR_xdr_rpcb_stat_byvers, 1); 330 return (TRUE); 331 } 332