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