1 /* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 * 29 * @(#)xdr.c 1.35 87/08/12 30 * @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC 31 * $NetBSD: xdr.c,v 1.22 2000/07/06 03:10:35 christos Exp $ 32 * $FreeBSD: src/lib/libc/xdr/xdr.c,v 1.14 2004/10/16 06:32:43 obrien Exp $ 33 */ 34 35 /* 36 * xdr.c, Generic XDR routines implementation. 37 * 38 * Copyright (C) 1986, Sun Microsystems, Inc. 39 * 40 * These are the "generic" xdr routines used to serialize and de-serialize 41 * most common data items. See xdr.h for more info on the interface to 42 * xdr. 43 */ 44 45 #include "namespace.h" 46 #include <err.h> 47 #include <stdio.h> 48 #include <stdlib.h> 49 #include <string.h> 50 51 #include <rpc/types.h> 52 #include <rpc/xdr.h> 53 #include "un-namespace.h" 54 55 typedef quad_t longlong_t; /* ANSI long long type */ 56 typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ 57 58 /* 59 * constants specific to the xdr "protocol" 60 */ 61 #define XDR_FALSE ((long) 0) 62 #define XDR_TRUE ((long) 1) 63 #define LASTUNSIGNED ((u_int) 0-1) 64 65 /* 66 * for unit alignment 67 */ 68 static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; 69 70 /* 71 * Free a data structure using XDR 72 * Not a filter, but a convenient utility nonetheless 73 */ 74 void 75 xdr_free(xdrproc_t proc, void *objp) 76 { 77 XDR x; 78 79 x.x_op = XDR_FREE; 80 (*proc)(&x, objp); 81 } 82 83 /* 84 * XDR nothing 85 */ 86 bool_t 87 xdr_void(void) 88 { 89 90 return (TRUE); 91 } 92 93 94 /* 95 * XDR integers 96 */ 97 bool_t 98 xdr_int(XDR *xdrs, int *ip) 99 { 100 long l; 101 102 switch (xdrs->x_op) { 103 104 case XDR_ENCODE: 105 l = (long) *ip; 106 return (XDR_PUTLONG(xdrs, &l)); 107 108 case XDR_DECODE: 109 if (!XDR_GETLONG(xdrs, &l)) { 110 return (FALSE); 111 } 112 *ip = (int) l; 113 return (TRUE); 114 115 case XDR_FREE: 116 return (TRUE); 117 } 118 /* NOTREACHED */ 119 return (FALSE); 120 } 121 122 /* 123 * XDR unsigned integers 124 */ 125 bool_t 126 xdr_u_int(XDR *xdrs, u_int *up) 127 { 128 u_long l; 129 130 switch (xdrs->x_op) { 131 132 case XDR_ENCODE: 133 l = (u_long) *up; 134 return (XDR_PUTLONG(xdrs, (long *)&l)); 135 136 case XDR_DECODE: 137 if (!XDR_GETLONG(xdrs, (long *)&l)) { 138 return (FALSE); 139 } 140 *up = (u_int) l; 141 return (TRUE); 142 143 case XDR_FREE: 144 return (TRUE); 145 } 146 /* NOTREACHED */ 147 return (FALSE); 148 } 149 150 151 /* 152 * XDR long integers 153 * same as xdr_u_long - open coded to save a proc call! 154 */ 155 bool_t 156 xdr_long(XDR *xdrs, long *lp) 157 { 158 switch (xdrs->x_op) { 159 case XDR_ENCODE: 160 return (XDR_PUTLONG(xdrs, lp)); 161 case XDR_DECODE: 162 return (XDR_GETLONG(xdrs, lp)); 163 case XDR_FREE: 164 return (TRUE); 165 } 166 /* NOTREACHED */ 167 return (FALSE); 168 } 169 170 /* 171 * XDR unsigned long integers 172 * same as xdr_long - open coded to save a proc call! 173 */ 174 bool_t 175 xdr_u_long(XDR *xdrs, u_long *ulp) 176 { 177 switch (xdrs->x_op) { 178 case XDR_ENCODE: 179 return (XDR_PUTLONG(xdrs, (long *)ulp)); 180 case XDR_DECODE: 181 return (XDR_GETLONG(xdrs, (long *)ulp)); 182 case XDR_FREE: 183 return (TRUE); 184 } 185 /* NOTREACHED */ 186 return (FALSE); 187 } 188 189 190 /* 191 * XDR 32-bit integers 192 * same as xdr_u_int32_t - open coded to save a proc call! 193 */ 194 bool_t 195 xdr_int32_t(XDR *xdrs, int32_t *int32_p) 196 { 197 long l; 198 199 switch (xdrs->x_op) { 200 201 case XDR_ENCODE: 202 l = (long) *int32_p; 203 return (XDR_PUTLONG(xdrs, &l)); 204 205 case XDR_DECODE: 206 if (!XDR_GETLONG(xdrs, &l)) { 207 return (FALSE); 208 } 209 *int32_p = (int32_t) l; 210 return (TRUE); 211 212 case XDR_FREE: 213 return (TRUE); 214 } 215 /* NOTREACHED */ 216 return (FALSE); 217 } 218 219 /* 220 * XDR unsigned 32-bit integers 221 * same as xdr_int32_t - open coded to save a proc call! 222 */ 223 bool_t 224 xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p) 225 { 226 u_long l; 227 228 switch (xdrs->x_op) { 229 230 case XDR_ENCODE: 231 l = (u_long) *u_int32_p; 232 return (XDR_PUTLONG(xdrs, (long *)&l)); 233 234 case XDR_DECODE: 235 if (!XDR_GETLONG(xdrs, (long *)&l)) { 236 return (FALSE); 237 } 238 *u_int32_p = (u_int32_t) l; 239 return (TRUE); 240 241 case XDR_FREE: 242 return (TRUE); 243 } 244 /* NOTREACHED */ 245 return (FALSE); 246 } 247 248 /* 249 * XDR unsigned 32-bit integers 250 * same as xdr_int32_t - open coded to save a proc call! 251 */ 252 bool_t 253 xdr_uint32_t(xdrs, u_int32_p) 254 XDR *xdrs; 255 uint32_t *u_int32_p; 256 { 257 u_long l; 258 259 switch (xdrs->x_op) { 260 261 case XDR_ENCODE: 262 l = (u_long) *u_int32_p; 263 return (XDR_PUTLONG(xdrs, (long *)&l)); 264 265 case XDR_DECODE: 266 if (!XDR_GETLONG(xdrs, (long *)&l)) { 267 return (FALSE); 268 } 269 *u_int32_p = (u_int32_t) l; 270 return (TRUE); 271 272 case XDR_FREE: 273 return (TRUE); 274 } 275 /* NOTREACHED */ 276 return (FALSE); 277 } 278 279 /* 280 * XDR short integers 281 */ 282 bool_t 283 xdr_short(XDR *xdrs, short *sp) 284 { 285 long l; 286 287 switch (xdrs->x_op) { 288 289 case XDR_ENCODE: 290 l = (long) *sp; 291 return (XDR_PUTLONG(xdrs, &l)); 292 293 case XDR_DECODE: 294 if (!XDR_GETLONG(xdrs, &l)) { 295 return (FALSE); 296 } 297 *sp = (short) l; 298 return (TRUE); 299 300 case XDR_FREE: 301 return (TRUE); 302 } 303 /* NOTREACHED */ 304 return (FALSE); 305 } 306 307 /* 308 * XDR unsigned short integers 309 */ 310 bool_t 311 xdr_u_short(XDR *xdrs, u_short *usp) 312 { 313 u_long l; 314 315 switch (xdrs->x_op) { 316 317 case XDR_ENCODE: 318 l = (u_long) *usp; 319 return (XDR_PUTLONG(xdrs, (long *)&l)); 320 321 case XDR_DECODE: 322 if (!XDR_GETLONG(xdrs, (long *)&l)) { 323 return (FALSE); 324 } 325 *usp = (u_short) l; 326 return (TRUE); 327 328 case XDR_FREE: 329 return (TRUE); 330 } 331 /* NOTREACHED */ 332 return (FALSE); 333 } 334 335 336 /* 337 * XDR 16-bit integers 338 */ 339 bool_t 340 xdr_int16_t(XDR *xdrs, int16_t *int16_p) 341 { 342 long l; 343 344 switch (xdrs->x_op) { 345 346 case XDR_ENCODE: 347 l = (long) *int16_p; 348 return (XDR_PUTLONG(xdrs, &l)); 349 350 case XDR_DECODE: 351 if (!XDR_GETLONG(xdrs, &l)) { 352 return (FALSE); 353 } 354 *int16_p = (int16_t) l; 355 return (TRUE); 356 357 case XDR_FREE: 358 return (TRUE); 359 } 360 /* NOTREACHED */ 361 return (FALSE); 362 } 363 364 /* 365 * XDR unsigned 16-bit integers 366 */ 367 bool_t 368 xdr_u_int16_t(XDR *xdrs, u_int16_t *u_int16_p) 369 { 370 u_long l; 371 372 switch (xdrs->x_op) { 373 374 case XDR_ENCODE: 375 l = (u_long) *u_int16_p; 376 return (XDR_PUTLONG(xdrs, (long *)&l)); 377 378 case XDR_DECODE: 379 if (!XDR_GETLONG(xdrs, (long *)&l)) { 380 return (FALSE); 381 } 382 *u_int16_p = (u_int16_t) l; 383 return (TRUE); 384 385 case XDR_FREE: 386 return (TRUE); 387 } 388 /* NOTREACHED */ 389 return (FALSE); 390 } 391 392 393 /* 394 * XDR a char 395 */ 396 bool_t 397 xdr_char(XDR *xdrs, char *cp) 398 { 399 int i; 400 401 i = (*cp); 402 if (!xdr_int(xdrs, &i)) { 403 return (FALSE); 404 } 405 *cp = i; 406 return (TRUE); 407 } 408 409 /* 410 * XDR an unsigned char 411 */ 412 bool_t 413 xdr_u_char(XDR *xdrs, u_char *cp) 414 { 415 u_int u; 416 417 u = (*cp); 418 if (!xdr_u_int(xdrs, &u)) { 419 return (FALSE); 420 } 421 *cp = u; 422 return (TRUE); 423 } 424 425 /* 426 * XDR booleans 427 */ 428 bool_t 429 xdr_bool(XDR *xdrs, bool_t *bp) 430 { 431 long lb; 432 433 switch (xdrs->x_op) { 434 435 case XDR_ENCODE: 436 lb = *bp ? XDR_TRUE : XDR_FALSE; 437 return (XDR_PUTLONG(xdrs, &lb)); 438 439 case XDR_DECODE: 440 if (!XDR_GETLONG(xdrs, &lb)) { 441 return (FALSE); 442 } 443 *bp = (lb == XDR_FALSE) ? FALSE : TRUE; 444 return (TRUE); 445 446 case XDR_FREE: 447 return (TRUE); 448 } 449 /* NOTREACHED */ 450 return (FALSE); 451 } 452 453 /* 454 * XDR enumerations 455 */ 456 bool_t 457 xdr_enum(XDR *xdrs, enum_t *ep) 458 { 459 enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ 460 461 /* 462 * enums are treated as ints 463 */ 464 /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) { 465 return (xdr_long(xdrs, (long *)(void *)ep)); 466 } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) { 467 return (xdr_int(xdrs, (int *)(void *)ep)); 468 } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) { 469 return (xdr_short(xdrs, (short *)(void *)ep)); 470 } else { 471 return (FALSE); 472 } 473 } 474 475 /* 476 * XDR opaque data 477 * Allows the specification of a fixed size sequence of opaque bytes. 478 * cp points to the opaque object and cnt gives the byte length. 479 */ 480 bool_t 481 xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt) 482 { 483 u_int rndup; 484 static int crud[BYTES_PER_XDR_UNIT]; 485 486 /* 487 * if no data we are done 488 */ 489 if (cnt == 0) 490 return (TRUE); 491 492 /* 493 * round byte count to full xdr units 494 */ 495 rndup = cnt % BYTES_PER_XDR_UNIT; 496 if (rndup > 0) 497 rndup = BYTES_PER_XDR_UNIT - rndup; 498 499 if (xdrs->x_op == XDR_DECODE) { 500 if (!XDR_GETBYTES(xdrs, cp, cnt)) { 501 return (FALSE); 502 } 503 if (rndup == 0) 504 return (TRUE); 505 return (XDR_GETBYTES(xdrs, (caddr_t)(void *)crud, rndup)); 506 } 507 508 if (xdrs->x_op == XDR_ENCODE) { 509 if (!XDR_PUTBYTES(xdrs, cp, cnt)) { 510 return (FALSE); 511 } 512 if (rndup == 0) 513 return (TRUE); 514 return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); 515 } 516 517 if (xdrs->x_op == XDR_FREE) { 518 return (TRUE); 519 } 520 521 return (FALSE); 522 } 523 524 /* 525 * XDR counted bytes 526 * *cpp is a pointer to the bytes, *sizep is the count. 527 * If *cpp is NULL maxsize bytes are allocated 528 */ 529 bool_t 530 xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) 531 { 532 char *sp = *cpp; /* sp is the actual string pointer */ 533 u_int nodesize; 534 535 /* 536 * first deal with the length since xdr bytes are counted 537 */ 538 if (! xdr_u_int(xdrs, sizep)) { 539 return (FALSE); 540 } 541 nodesize = *sizep; 542 if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { 543 return (FALSE); 544 } 545 546 /* 547 * now deal with the actual bytes 548 */ 549 switch (xdrs->x_op) { 550 551 case XDR_DECODE: 552 if (nodesize == 0) { 553 return (TRUE); 554 } 555 if (sp == NULL) { 556 *cpp = sp = mem_alloc(nodesize); 557 } 558 if (sp == NULL) { 559 warnx("xdr_bytes: out of memory"); 560 return (FALSE); 561 } 562 /* FALLTHROUGH */ 563 564 case XDR_ENCODE: 565 return (xdr_opaque(xdrs, sp, nodesize)); 566 567 case XDR_FREE: 568 if (sp != NULL) { 569 mem_free(sp, nodesize); 570 *cpp = NULL; 571 } 572 return (TRUE); 573 } 574 /* NOTREACHED */ 575 return (FALSE); 576 } 577 578 /* 579 * Implemented here due to commonality of the object. 580 */ 581 bool_t 582 xdr_netobj(XDR *xdrs, struct netobj *np) 583 { 584 return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); 585 } 586 587 /* 588 * XDR a descriminated union 589 * Support routine for discriminated unions. 590 * You create an array of xdrdiscrim structures, terminated with 591 * an entry with a null procedure pointer. The routine gets 592 * the discriminant value and then searches the array of xdrdiscrims 593 * looking for that value. It calls the procedure given in the xdrdiscrim 594 * to handle the discriminant. If there is no specific routine a default 595 * routine may be called. 596 * If there is no specific or default routine an error is returned. 597 * 598 * Parameters: 599 * dscmp: enum to decide which ar to work on 600 * unp: the union itself 601 * choices: [value, xdr proc] for each arm 602 * dfault: default xdr routine 603 */ 604 bool_t 605 xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, 606 const struct xdr_discrim *choices, xdrproc_t dfault) 607 { 608 enum_t dscm; 609 610 /* 611 * we deal with the discriminator; it's an enum 612 */ 613 if (! xdr_enum(xdrs, dscmp)) { 614 return (FALSE); 615 } 616 dscm = *dscmp; 617 618 /* 619 * search choices for a value that matches the discriminator. 620 * if we find one, execute the xdr routine for that value. 621 */ 622 for (; choices->proc != NULL_xdrproc_t; choices++) { 623 if (choices->value == dscm) 624 return ((*(choices->proc))(xdrs, unp)); 625 } 626 627 /* 628 * no match - execute the default xdr routine if there is one 629 */ 630 return ((dfault == NULL_xdrproc_t) ? FALSE : 631 (*dfault)(xdrs, unp)); 632 } 633 634 635 /* 636 * Non-portable xdr primitives. 637 * Care should be taken when moving these routines to new architectures. 638 */ 639 640 641 /* 642 * XDR null terminated ASCII strings 643 * xdr_string deals with "C strings" - arrays of bytes that are 644 * terminated by a NULL character. The parameter cpp references a 645 * pointer to storage; If the pointer is null, then the necessary 646 * storage is allocated. The last parameter is the max allowed length 647 * of the string as specified by a protocol. 648 */ 649 bool_t 650 xdr_string(XDR *xdrs, char **cpp, u_int maxsize) 651 { 652 char *sp = *cpp; /* sp is the actual string pointer */ 653 u_int size; 654 u_int nodesize; 655 656 /* 657 * first deal with the length since xdr strings are counted-strings 658 */ 659 switch (xdrs->x_op) { 660 case XDR_FREE: 661 if (sp == NULL) { 662 return(TRUE); /* already free */ 663 } 664 /* FALLTHROUGH */ 665 case XDR_ENCODE: 666 size = strlen(sp); 667 break; 668 case XDR_DECODE: 669 break; 670 } 671 if (! xdr_u_int(xdrs, &size)) { 672 return (FALSE); 673 } 674 if (size > maxsize) { 675 return (FALSE); 676 } 677 nodesize = size + 1; 678 679 /* 680 * now deal with the actual bytes 681 */ 682 switch (xdrs->x_op) { 683 684 case XDR_DECODE: 685 if (nodesize == 0) { 686 return (TRUE); 687 } 688 if (sp == NULL) 689 *cpp = sp = mem_alloc(nodesize); 690 if (sp == NULL) { 691 warnx("xdr_string: out of memory"); 692 return (FALSE); 693 } 694 sp[size] = 0; 695 /* FALLTHROUGH */ 696 697 case XDR_ENCODE: 698 return (xdr_opaque(xdrs, sp, size)); 699 700 case XDR_FREE: 701 mem_free(sp, nodesize); 702 *cpp = NULL; 703 return (TRUE); 704 } 705 /* NOTREACHED */ 706 return (FALSE); 707 } 708 709 /* 710 * Wrapper for xdr_string that can be called directly from 711 * routines like clnt_call 712 */ 713 bool_t 714 xdr_wrapstring(XDR *xdrs, char **cpp) 715 { 716 return xdr_string(xdrs, cpp, LASTUNSIGNED); 717 } 718 719 /* 720 * NOTE: xdr_hyper(), xdr_u_hyper(), xdr_longlong_t(), and xdr_u_longlong_t() 721 * are in the "non-portable" section because they require that a `long long' 722 * be a 64-bit type. 723 * 724 * --thorpej@netbsd.org, November 30, 1999 725 */ 726 727 /* 728 * XDR 64-bit integers 729 */ 730 bool_t 731 xdr_int64_t(XDR *xdrs, int64_t *llp) 732 { 733 u_long ul[2]; 734 735 switch (xdrs->x_op) { 736 case XDR_ENCODE: 737 ul[0] = (u_long)((u_int64_t)*llp >> 32) & 0xffffffff; 738 ul[1] = (u_long)((u_int64_t)*llp) & 0xffffffff; 739 if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) 740 return (FALSE); 741 return (XDR_PUTLONG(xdrs, (long *)&ul[1])); 742 case XDR_DECODE: 743 if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) 744 return (FALSE); 745 if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) 746 return (FALSE); 747 *llp = (int64_t) 748 (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1])); 749 return (TRUE); 750 case XDR_FREE: 751 return (TRUE); 752 } 753 /* NOTREACHED */ 754 return (FALSE); 755 } 756 757 758 /* 759 * XDR unsigned 64-bit integers 760 */ 761 bool_t 762 xdr_u_int64_t(XDR *xdrs, u_int64_t *ullp) 763 { 764 u_long ul[2]; 765 766 switch (xdrs->x_op) { 767 case XDR_ENCODE: 768 ul[0] = (u_long)(*ullp >> 32) & 0xffffffff; 769 ul[1] = (u_long)(*ullp) & 0xffffffff; 770 if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) 771 return (FALSE); 772 return (XDR_PUTLONG(xdrs, (long *)&ul[1])); 773 case XDR_DECODE: 774 if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) 775 return (FALSE); 776 if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) 777 return (FALSE); 778 *ullp = (u_int64_t) 779 (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1])); 780 return (TRUE); 781 case XDR_FREE: 782 return (TRUE); 783 } 784 /* NOTREACHED */ 785 return (FALSE); 786 } 787 788 /* 789 * XDR unsigned 64-bit integers 790 */ 791 bool_t 792 xdr_uint64_t(XDR *xdrs, uint64_t *ullp) 793 { 794 u_long ul[2]; 795 796 switch (xdrs->x_op) { 797 case XDR_ENCODE: 798 ul[0] = (u_long)(*ullp >> 32) & 0xffffffff; 799 ul[1] = (u_long)(*ullp) & 0xffffffff; 800 if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) 801 return (FALSE); 802 return (XDR_PUTLONG(xdrs, (long *)&ul[1])); 803 case XDR_DECODE: 804 if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) 805 return (FALSE); 806 if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) 807 return (FALSE); 808 *ullp = (uint64_t) 809 (((uint64_t)ul[0] << 32) | ((uint64_t)ul[1])); 810 return (TRUE); 811 case XDR_FREE: 812 return (TRUE); 813 } 814 /* NOTREACHED */ 815 return (FALSE); 816 } 817 818 819 /* 820 * XDR hypers 821 */ 822 bool_t 823 xdr_hyper(XDR *xdrs, longlong_t *llp) 824 { 825 826 /* 827 * Don't bother open-coding this; it's a fair amount of code. Just 828 * call xdr_int64_t(). 829 */ 830 return (xdr_int64_t(xdrs, (int64_t *)llp)); 831 } 832 833 834 /* 835 * XDR unsigned hypers 836 */ 837 bool_t 838 xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp) 839 { 840 841 /* 842 * Don't bother open-coding this; it's a fair amount of code. Just 843 * call xdr_u_int64_t(). 844 */ 845 return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp)); 846 } 847 848 849 /* 850 * XDR longlong_t's 851 */ 852 bool_t 853 xdr_longlong_t(XDR *xdrs, longlong_t *llp) 854 { 855 856 /* 857 * Don't bother open-coding this; it's a fair amount of code. Just 858 * call xdr_int64_t(). 859 */ 860 return (xdr_int64_t(xdrs, (int64_t *)llp)); 861 } 862 863 864 /* 865 * XDR u_longlong_t's 866 */ 867 bool_t 868 xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp) 869 { 870 871 /* 872 * Don't bother open-coding this; it's a fair amount of code. Just 873 * call xdr_u_int64_t(). 874 */ 875 return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp)); 876 } 877