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