|
|
1.1 ! root 1: .H A "Synopsis of XDR Routines" ! 2: .SH ! 3: xdr_array() ! 4: .LP ! 5: .LS ! 6: xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc) ! 7: XDR *xdrs; ! 8: char **arrp; ! 9: u_int *sizep, maxsize, elsize; ! 10: xdrproc_t elproc; ! 11: .LE ! 12: A filter primitive that translates between arrays ! 13: and their corresponding external representations. ! 14: The parameter ! 15: .L arrp ! 16: is the address of the pointer to the array, while ! 17: .L sizep ! 18: is the address of the element count of the array; ! 19: this element count cannot exceed ! 20: .L maxsize . ! 21: The parameter ! 22: .L elsize ! 23: is the ! 24: .L sizeof() ! 25: each of the array's elements, and ! 26: .L elproc ! 27: is an XDR filter that translates between ! 28: the array elements' C form, and their external representation. ! 29: This routine returns one if it succeeds, zero otherwise. ! 30: .SH ! 31: xdr_bool() ! 32: .LP ! 33: .LS ! 34: xdr_bool(xdrs, bp) ! 35: XDR *xdrs; ! 36: bool_t *bp; ! 37: .LE ! 38: A filter primitive that translates between booleans (C integers) ! 39: and their external representations. ! 40: When encoding data, this filter produces values of either one or zero. ! 41: This routine returns one if it succeeds, zero otherwise. ! 42: .SH ! 43: xdr_bytes() ! 44: .LP ! 45: .LS ! 46: xdr_bytes(xdrs, sp, sizep, maxsize) ! 47: XDR *xdrs; ! 48: char **sp; ! 49: u_int *sizep, maxsize; ! 50: .LE ! 51: A filter primitive that translates between counted byte strings ! 52: and their external representations. ! 53: The parameter ! 54: .L sp ! 55: is the address of the string pointer. ! 56: The length of the string is located at address ! 57: .L sizep ; ! 58: strings cannot be longer than ! 59: .L maxsize . ! 60: This routine returns one if it succeeds, zero otherwise. ! 61: .SH ! 62: xdr_destroy() ! 63: .LP ! 64: .LS ! 65: void ! 66: xdr_destroy(xdrs) ! 67: XDR *xdrs; ! 68: .LE ! 69: A macro that invokes the destroy routine ! 70: associated with the XDR stream, ! 71: .L xdrs . ! 72: Destruction usually involves freeing private data structures ! 73: associated with the stream. Using ! 74: .L xdrs ! 75: after invoking ! 76: .L xdr_destroy() ! 77: is undefined. ! 78: .SH ! 79: xdr_double() ! 80: .LP ! 81: .LS ! 82: xdr_double(xdrs, dp) ! 83: XDR *xdrs; ! 84: double *dp; ! 85: .LE ! 86: A filter primitive that translates between C ! 87: .L double ! 88: precision numbers and their external representations. ! 89: This routine returns one if it succeeds, zero otherwise. ! 90: .SH ! 91: xdr_enum() ! 92: .LP ! 93: .LS ! 94: xdr_enum(xdrs, ep) ! 95: XDR *xdrs; ! 96: enum_t *ep; ! 97: .LE ! 98: A filter primitive that translates between C ! 99: .L enum s ! 100: (actually integers) and their external representations. ! 101: This routine returns one if it succeeds, zero otherwise. ! 102: .SH ! 103: xdr_float() ! 104: .LP ! 105: .LS ! 106: xdr_float(xdrs, fp) ! 107: XDR *xdrs; ! 108: float *fp; ! 109: .LE ! 110: A filter primitive that translates between C ! 111: .L float s ! 112: and their external representations. ! 113: This routine returns one if it succeeds, zero otherwise. ! 114: .SH ! 115: xdr_getpos() ! 116: .LP ! 117: .LS ! 118: u_int ! 119: xdr_getpos(xdrs) ! 120: XDR *xdrs; ! 121: .LE ! 122: A macro that invokes the get-position routine ! 123: associated with the XDR stream, ! 124: .L xdrs . ! 125: The routine returns an unsigned integer, ! 126: which indicates the position of the XDR byte stream. ! 127: A desirable feature of XDR streams ! 128: is that simple arithmetic works with this number, ! 129: although the XDR stream instances need not guarantee this. ! 130: .SH ! 131: xdr_inline() ! 132: .LP ! 133: .LS ! 134: long * ! 135: xdr_inline(xdrs, len) ! 136: XDR *xdrs; ! 137: int len; ! 138: .LE ! 139: A macro that invokes the in-line routine associated with the XDR stream, ! 140: .L xdrs . ! 141: The routine returns a pointer ! 142: to a contiguous piece of the stream's buffer; ! 143: .L len ! 144: is the byte length of the desired buffer. ! 145: Note that the pointer is cast to ! 146: .L "long *" . ! 147: Warning: ! 148: .L xdr_inline() ! 149: may return 0 (NULL) if it cannot allocate ! 150: a contiguous piece of a buffer. ! 151: Therefore the behavior may vary among stream instances; ! 152: it exists for the sake of efficiency. ! 153: .SH ! 154: xdr_int() ! 155: .LP ! 156: .LS ! 157: xdr_int(xdrs, ip) ! 158: XDR *xdrs; ! 159: int *ip; ! 160: .LE ! 161: A filter primitive that translates between C integers ! 162: and their external representations. ! 163: This routine returns one if it succeeds, zero otherwise. ! 164: .SH ! 165: xdr_long() ! 166: .LP ! 167: .LS ! 168: xdr_long(xdrs, lp) ! 169: XDR *xdrs; ! 170: long *lp; ! 171: .LE ! 172: A filter primitive that translates between C ! 173: .L long ! 174: integers and their external representations. ! 175: This routine returns one if it succeeds, zero otherwise. ! 176: .SH ! 177: xdr_opaque() ! 178: .LP ! 179: .LS ! 180: xdr_opaque(xdrs, cp, cnt) ! 181: XDR *xdrs; ! 182: char *cp; ! 183: u_int cnt; ! 184: .LE ! 185: A filter primitive that translates between fixed size opaque data ! 186: and its external representation. ! 187: The parameter ! 188: .L cp ! 189: is the address of the opaque object, and ! 190: .L cnt ! 191: is its size in bytes. ! 192: This routine returns one if it succeeds, zero otherwise. ! 193: .SH ! 194: xdr_reference() ! 195: .LP ! 196: .LS ! 197: xdr_reference(xdrs, pp, size, proc) ! 198: XDR *xdrs; ! 199: char **pp; ! 200: u_int size; ! 201: xdrproc_t proc; ! 202: .LE ! 203: A primitive that provides pointer chasing within structures. ! 204: The parameter ! 205: .L pp ! 206: is the address of the pointer; ! 207: .L size ! 208: is the ! 209: .L sizeof() ! 210: the structure that ! 211: .L *pp ! 212: points to; and ! 213: .L proc ! 214: is an XDR procedure that filters the structure ! 215: between its C form and its external representation. ! 216: This routine returns one if it succeeds, zero otherwise. ! 217: .SH ! 218: xdr_setpos() ! 219: .LP ! 220: .LS ! 221: xdr_setpos(xdrs, pos) ! 222: XDR *xdrs; ! 223: u_int pos; ! 224: .LE ! 225: A macro that invokes the set position routine associated with the XDR stream ! 226: .L xdrs . ! 227: The parameter ! 228: .L pos ! 229: is a position value obtained from ! 230: .L xdr_getpos() . ! 231: This routine returns one if the XDR stream could be repositioned, ! 232: and zero otherwise. ! 233: Warning: it is difficult to reposition some types of XDR streams, ! 234: so this routine may fail with one type of stream and succeed with another. ! 235: .SH ! 236: xdr_short() ! 237: .LP ! 238: .LS ! 239: xdr_short(xdrs, sp) ! 240: XDR *xdrs; ! 241: short *sp; ! 242: .LE ! 243: A filter primitive that translates between C ! 244: .L short ! 245: integers and their external representations. ! 246: This routine returns one if it succeeds, zero otherwise. ! 247: .SH ! 248: xdr_string() ! 249: .LP ! 250: .LS ! 251: xdr_string(xdrs, sp, maxsize) ! 252: XDR *xdrs; ! 253: char **sp; ! 254: u_int maxsize; ! 255: .LE ! 256: A filter primitive that translates between C strings and their ! 257: corresponding external representations. ! 258: Strings cannot cannot be longer than ! 259: .L maxsize . ! 260: Note that ! 261: .L sp ! 262: is the address of the string's pointer. ! 263: This routine returns one if it succeeds, zero otherwise. ! 264: .SH ! 265: xdr_u_int() ! 266: .LP ! 267: .LS ! 268: xdr_u_int(xdrs, up) ! 269: XDR *xdrs; ! 270: unsigned *up; ! 271: .LE ! 272: A filter primitive that translates between C ! 273: .L unsigned ! 274: integers and their external representations. ! 275: This routine returns one if it succeeds, zero otherwise. ! 276: .SH ! 277: xdr_u_long() ! 278: .LP ! 279: .LS ! 280: xdr_u_long(xdrs, ulp) ! 281: XDR *xdrs; ! 282: unsigned long *ulp; ! 283: .LE ! 284: A filter primitive that translates between C ! 285: .L "unsigned long" ! 286: integers and their external representations. ! 287: This routine returns one if it succeeds, zero otherwise. ! 288: .SH ! 289: xdr_u_short() ! 290: .LP ! 291: .LS ! 292: xdr_u_short(xdrs, usp) ! 293: XDR *xdrs; ! 294: unsigned short *usp; ! 295: .LE ! 296: A filter primitive that translates between C ! 297: .L "unsigned short" ! 298: integers and their external representations. ! 299: This routine returns one if it succeeds, zero otherwise. ! 300: .SH ! 301: xdr_union() ! 302: .LP ! 303: .LS ! 304: xdr_union(xdrs, dscmp, unp, choices, dfault) ! 305: XDR *xdrs; ! 306: int *dscmp; ! 307: char *unp; ! 308: struct xdr_discrim *choices; ! 309: xdrproc_t dfault; ! 310: .LE ! 311: A filter primitive that translates between a discriminated C ! 312: .L union ! 313: and its corresponding external representation. The parameter ! 314: .L dscmp ! 315: is the address of the union's discriminant, while ! 316: .L unp ! 317: in the address of the union. ! 318: This routine returns one if it succeeds, zero otherwise. ! 319: .SH ! 320: xdr_void() ! 321: .LP ! 322: .LS ! 323: xdr_void() ! 324: .LE ! 325: This routine always returns one. ! 326: It may be passed to RPC routines that require a function parameter, ! 327: where nothing is to be done. ! 328: .SH ! 329: xdr_wrapstring() ! 330: .LP ! 331: .LS ! 332: xdr_wrapstring(xdrs, sp) ! 333: XDR *xdrs; ! 334: char **sp; ! 335: .LE ! 336: A primitive that calls ! 337: .L xdr_string(xdrs,sp,MAXUNSIGNED); ! 338: where MAXUNSIGNED is the maximum value of an unsigned integer. ! 339: This is handy because the RPC package passes ! 340: only two parameters XDR routines, whereas ! 341: .L xdr_string() , ! 342: one of the most frequently used primitives, requires three parameters. ! 343: This routine returns one if it succeeds, zero otherwise. ! 344: .SH ! 345: xdrmem_create() ! 346: .LP ! 347: .LS ! 348: void ! 349: xdrmem_create(xdrs, addr, size, op) ! 350: XDR *xdrs; ! 351: char *addr; ! 352: u_int size; ! 353: enum xdr_op op; ! 354: .LE ! 355: This routine initializes the XDR stream object pointed to by ! 356: .L xdrs . ! 357: The stream's data is written to, or read from, ! 358: a chunk of memory at location ! 359: .L addr ! 360: whose length is no more than ! 361: .L size ! 362: bytes long. The ! 363: .L op ! 364: determines the direction of the XDR stream ! 365: (either XDR_ENCODE, XDR_DECODE, or XDR_FREE). ! 366: .SH ! 367: xdrrec_create() ! 368: .LP ! 369: .LS ! 370: void ! 371: xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit) ! 372: XDR *xdrs; ! 373: u_int sendsize, recvsize; ! 374: char *handle; ! 375: int (*readit)(), (*writeit)(); ! 376: .LE ! 377: This routine initializes the XDR stream object pointed to by ! 378: .L xdrs . ! 379: The stream's data is written to a buffer of size ! 380: .L sendsize ; ! 381: a value of zero indicates the system should use a suitable default. ! 382: The stream's data is read from a buffer of size ! 383: .L recvsize ; ! 384: it too can be set to a suitable default by passing a zero value. ! 385: When a stream's output buffer is full, ! 386: .L writeit() ! 387: is called. Similarly, when a stream's input buffer is empty, ! 388: .L readit() ! 389: is called. The behavior of these two routines ! 390: is similar to the UNIX system calls ! 391: .L read ! 392: and ! 393: .L write , ! 394: except that ! 395: .L handle ! 396: is passed to the former routines as the first parameter. ! 397: Note that the XDR stream's ! 398: .L op ! 399: field must be set by the caller. ! 400: Warning: this XDR stream implements an intermediate record stream. ! 401: Therefore there are additional bytes in the stream ! 402: to provide record boundary information. ! 403: .SH ! 404: xdrrec_endofrecord() ! 405: .LP ! 406: .LS ! 407: xdrrec_endofrecord(xdrs, sendnow) ! 408: XDR *xdrs; ! 409: int sendnow; ! 410: .LE ! 411: This routine can be invoked only on streams created by ! 412: .L xdrrec_create() . ! 413: The data in the output buffer is marked as a completed record, ! 414: and the output buffer is optionally written out if ! 415: .L sendnow ! 416: is non-zero. This routine returns one if it succeeds, zero otherwise. ! 417: .SH ! 418: xdrrec_eof() ! 419: .LP ! 420: .LS ! 421: xdrrec_eof(xdrs) ! 422: XDR *xdrs; ! 423: int empty; ! 424: .LE ! 425: This routine can be invoked only on streams created by ! 426: .L xdrrec_create() . ! 427: After consuming the rest of the current record in the stream, ! 428: this routine returns one if the stream has no more input, zero otherwise. ! 429: .SH ! 430: xdrrec_skiprecord() ! 431: .LP ! 432: .LS ! 433: xdrrec_skiprecord(xdrs) ! 434: XDR *xdrs; ! 435: .LE ! 436: This routine can be invoked only on streams created by ! 437: .L xdrrec_create() . ! 438: It tells the XDR implementation that the rest of the current record ! 439: in the stream's input buffer should be discarded. ! 440: This routine returns one if it succeeds, zero otherwise. ! 441: .SH ! 442: xdrstdio_create() ! 443: .LP ! 444: .LS ! 445: void ! 446: xdrstdio_create(xdrs, file, op) ! 447: XDR *xdrs; ! 448: FILE *file; ! 449: enum xdr_op op; ! 450: .LE ! 451: This routine initializes the XDR stream object pointed to by ! 452: .L xdrs . ! 453: The XDR stream data is written to, or read from, the Standard I/O stream ! 454: .L file . ! 455: The parameter ! 456: .L op ! 457: determines the direction of the XDR stream ! 458: (either XDR_ENCODE, XDR_DECODE, or XDR_FREE). ! 459: Warning: the destroy routine associated with such XDR streams calls ! 460: .L fflush() ! 461: on the ! 462: .L file ! 463: stream, but never ! 464: .L fclose() .
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.