ReactOS  0.4.14-dev-114-gc8cbd56
xdr.c
Go to the documentation of this file.
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 <wintirpc.h>
42 //#include <err.h>
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 
47 #ifdef __REACTOS__ // CVE-2017-8779
48 #include <rpc/rpc.h>
49 #endif
50 #include <rpc/types.h>
51 #include <rpc/xdr.h>
52 #ifdef __REACTOS__ // CVE-2017-8779
53 #include <rpc/rpc_com.h>
54 #endif
55 
56 typedef quad_t longlong_t; /* ANSI long long type */
57 typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
58 
59 /*
60  * constants specific to the xdr "protocol"
61  */
62 #define XDR_FALSE ((long) 0)
63 #define XDR_TRUE ((long) 1)
64 #ifndef __REACTOS__ // CVE-2017-8779
65 #define LASTUNSIGNED ((u_int) 0-1)
66 #endif
67 
68 /*
69  * for unit alignment
70  */
71 static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
72 
73 /*
74  * Free a data structure using XDR
75  * Not a filter, but a convenient utility nonetheless
76  */
77 void
78 xdr_free(proc, objp)
80  void *objp;
81 {
82  XDR x;
83 
84  x.x_op = XDR_FREE;
85  (*proc)(&x, objp);
86 }
87 
88 /*
89  * XDR nothing
90  */
91 bool_t
92 xdr_void(void)
93 {
94 
95  return (TRUE);
96 }
97 
98 
99 /*
100  * XDR integers
101  */
102 bool_t
104  XDR *xdrs;
105  int *ip;
106 {
107  long l;
108 
109  switch (xdrs->x_op) {
110 
111  case XDR_ENCODE:
112  l = (long) *ip;
113  return (XDR_PUTLONG(xdrs, &l));
114 
115  case XDR_DECODE:
116  if (!XDR_GETLONG(xdrs, &l)) {
117  return (FALSE);
118  }
119  *ip = (int) l;
120  return (TRUE);
121 
122  case XDR_FREE:
123  return (TRUE);
124  }
125  /* NOTREACHED */
126  return (FALSE);
127 }
128 
129 /*
130  * XDR unsigned integers
131  */
132 bool_t
134  XDR *xdrs;
135  u_int *up;
136 {
137  u_long l;
138 
139  switch (xdrs->x_op) {
140 
141  case XDR_ENCODE:
142  l = (u_long) *up;
143  return (XDR_PUTLONG(xdrs, (long *)&l));
144 
145  case XDR_DECODE:
146  if (!XDR_GETLONG(xdrs, (long *)&l)) {
147  return (FALSE);
148  }
149  *up = (u_int) l;
150  return (TRUE);
151 
152  case XDR_FREE:
153  return (TRUE);
154  }
155  /* NOTREACHED */
156  return (FALSE);
157 }
158 
159 
160 /*
161  * XDR long integers
162  * same as xdr_u_long - open coded to save a proc call!
163  */
164 bool_t
166  XDR *xdrs;
167  long *lp;
168 {
169  switch (xdrs->x_op) {
170  case XDR_ENCODE:
171  return (XDR_PUTLONG(xdrs, lp));
172  case XDR_DECODE:
173  return (XDR_GETLONG(xdrs, lp));
174  case XDR_FREE:
175  return (TRUE);
176  }
177  /* NOTREACHED */
178  return (FALSE);
179 }
180 
181 /*
182  * XDR unsigned long integers
183  * same as xdr_long - open coded to save a proc call!
184  */
185 bool_t
187  XDR *xdrs;
188  u_long *ulp;
189 {
190  switch (xdrs->x_op) {
191  case XDR_ENCODE:
192  return (XDR_PUTLONG(xdrs, (long *)ulp));
193  case XDR_DECODE:
194  return (XDR_GETLONG(xdrs, (long *)ulp));
195  case XDR_FREE:
196  return (TRUE);
197  }
198  /* NOTREACHED */
199  return (FALSE);
200 }
201 
202 
203 /*
204  * XDR 32-bit integers
205  * same as xdr_u_int32_t - open coded to save a proc call!
206  */
207 bool_t
208 xdr_int32_t(xdrs, int32_p)
209  XDR *xdrs;
210  int32_t *int32_p;
211 {
212  long l;
213 
214  switch (xdrs->x_op) {
215 
216  case XDR_ENCODE:
217  l = (long) *int32_p;
218  return (XDR_PUTLONG(xdrs, &l));
219 
220  case XDR_DECODE:
221  if (!XDR_GETLONG(xdrs, &l)) {
222  return (FALSE);
223  }
224  *int32_p = (int32_t) l;
225  return (TRUE);
226 
227  case XDR_FREE:
228  return (TRUE);
229  }
230  /* NOTREACHED */
231  return (FALSE);
232 }
233 
234 /*
235  * XDR unsigned 32-bit integers
236  * same as xdr_int32_t - open coded to save a proc call!
237  */
238 bool_t
239 xdr_u_int32_t(xdrs, u_int32_p)
240  XDR *xdrs;
241  u_int32_t *u_int32_p;
242 {
243  u_long l;
244 
245  switch (xdrs->x_op) {
246 
247  case XDR_ENCODE:
248  l = (u_long) *u_int32_p;
249  return (XDR_PUTLONG(xdrs, (long *)&l));
250 
251  case XDR_DECODE:
252  if (!XDR_GETLONG(xdrs, (long *)&l)) {
253  return (FALSE);
254  }
255  *u_int32_p = (u_int32_t) l;
256  return (TRUE);
257 
258  case XDR_FREE:
259  return (TRUE);
260  }
261  /* NOTREACHED */
262  return (FALSE);
263 }
264 
265 
266 /*
267  * XDR short integers
268  */
269 bool_t
271  XDR *xdrs;
272  short *sp;
273 {
274  long l;
275 
276  switch (xdrs->x_op) {
277 
278  case XDR_ENCODE:
279  l = (long) *sp;
280  return (XDR_PUTLONG(xdrs, &l));
281 
282  case XDR_DECODE:
283  if (!XDR_GETLONG(xdrs, &l)) {
284  return (FALSE);
285  }
286  *sp = (short) l;
287  return (TRUE);
288 
289  case XDR_FREE:
290  return (TRUE);
291  }
292  /* NOTREACHED */
293  return (FALSE);
294 }
295 
296 /*
297  * XDR unsigned short integers
298  */
299 bool_t
301  XDR *xdrs;
302  u_short *usp;
303 {
304  u_long l;
305 
306  switch (xdrs->x_op) {
307 
308  case XDR_ENCODE:
309  l = (u_long) *usp;
310  return (XDR_PUTLONG(xdrs, (long *)&l));
311 
312  case XDR_DECODE:
313  if (!XDR_GETLONG(xdrs, (long *)&l)) {
314  return (FALSE);
315  }
316  *usp = (u_short) l;
317  return (TRUE);
318 
319  case XDR_FREE:
320  return (TRUE);
321  }
322  /* NOTREACHED */
323  return (FALSE);
324 }
325 
326 
327 /*
328  * XDR 16-bit integers
329  */
330 bool_t
331 xdr_int16_t(xdrs, int16_p)
332  XDR *xdrs;
333  int16_t *int16_p;
334 {
335  long l;
336 
337  switch (xdrs->x_op) {
338 
339  case XDR_ENCODE:
340  l = (long) *int16_p;
341  return (XDR_PUTLONG(xdrs, &l));
342 
343  case XDR_DECODE:
344  if (!XDR_GETLONG(xdrs, &l)) {
345  return (FALSE);
346  }
347  *int16_p = (int16_t) l;
348  return (TRUE);
349 
350  case XDR_FREE:
351  return (TRUE);
352  }
353  /* NOTREACHED */
354  return (FALSE);
355 }
356 
357 /*
358  * XDR unsigned 16-bit integers
359  */
360 bool_t
361 xdr_u_int16_t(xdrs, u_int16_p)
362  XDR *xdrs;
363  u_int16_t *u_int16_p;
364 {
365  u_long l;
366 
367  switch (xdrs->x_op) {
368 
369  case XDR_ENCODE:
370  l = (u_long) *u_int16_p;
371  return (XDR_PUTLONG(xdrs, (long *)&l));
372 
373  case XDR_DECODE:
374  if (!XDR_GETLONG(xdrs, (long *)&l)) {
375  return (FALSE);
376  }
377  *u_int16_p = (u_int16_t) l;
378  return (TRUE);
379 
380  case XDR_FREE:
381  return (TRUE);
382  }
383  /* NOTREACHED */
384  return (FALSE);
385 }
386 
387 
388 /*
389  * XDR a char
390  */
391 bool_t
393  XDR *xdrs;
394  char *cp;
395 {
396  int i;
397 
398  i = (*cp);
399  if (!xdr_int(xdrs, &i)) {
400  return (FALSE);
401  }
402  *cp = (char)i;
403  return (TRUE);
404 }
405 
406 /*
407  * XDR an unsigned char
408  */
409 bool_t
411  XDR *xdrs;
412  u_char *cp;
413 {
414  u_int u;
415 
416  u = (*cp);
417  if (!xdr_u_int(xdrs, &u)) {
418  return (FALSE);
419  }
420  *cp = (u_char)u;
421  return (TRUE);
422 }
423 
424 /*
425  * XDR booleans
426  */
427 bool_t
429  XDR *xdrs;
430  bool_t *bp;
431 {
432  long lb;
433 
434  switch (xdrs->x_op) {
435 
436  case XDR_ENCODE:
437  lb = *bp ? XDR_TRUE : XDR_FALSE;
438  return (XDR_PUTLONG(xdrs, &lb));
439 
440  case XDR_DECODE:
441  if (!XDR_GETLONG(xdrs, &lb)) {
442  return (FALSE);
443  }
444  *bp = (lb == XDR_FALSE) ? FALSE : TRUE;
445  return (TRUE);
446 
447  case XDR_FREE:
448  return (TRUE);
449  }
450  /* NOTREACHED */
451  return (FALSE);
452 }
453 
454 /*
455  * XDR enumerations
456  */
457 bool_t
459  XDR *xdrs;
460  enum_t *ep;
461 {
462  enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
463 
464  /*
465  * enums are treated as ints
466  */
467  /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) {
468  return (xdr_long(xdrs, (long *)(void *)ep));
469  } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) {
470  return (xdr_int(xdrs, (int *)(void *)ep));
471  } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) {
472  return (xdr_short(xdrs, (short *)(void *)ep));
473  } else {
474  return (FALSE);
475  }
476 }
477 
478 /*
479  * XDR opaque data
480  * Allows the specification of a fixed size sequence of opaque bytes.
481  * cp points to the opaque object and cnt gives the byte length.
482  */
483 bool_t
485  XDR *xdrs;
486  caddr_t cp;
487  u_int cnt;
488 {
489  u_int rndup;
490  static int crud[BYTES_PER_XDR_UNIT];
491 
492  /*
493  * if no data we are done
494  */
495  if (cnt == 0)
496  return (TRUE);
497 
498  /*
499  * round byte count to full xdr units
500  */
501  rndup = cnt % BYTES_PER_XDR_UNIT;
502  if (rndup > 0)
503  rndup = BYTES_PER_XDR_UNIT - rndup;
504 
505  if (xdrs->x_op == XDR_DECODE) {
506  if (!XDR_GETBYTES(xdrs, cp, cnt)) {
507  return (FALSE);
508  }
509  if (rndup == 0)
510  return (TRUE);
511  return (XDR_GETBYTES(xdrs, (caddr_t)(void *)crud, rndup));
512  }
513 
514  if (xdrs->x_op == XDR_ENCODE) {
515  if (!XDR_PUTBYTES(xdrs, cp, cnt)) {
516  return (FALSE);
517  }
518  if (rndup == 0)
519  return (TRUE);
520  return (XDR_PUTBYTES(xdrs, xdr_zero, rndup));
521  }
522 
523  if (xdrs->x_op == XDR_FREE) {
524  return (TRUE);
525  }
526 
527  return (FALSE);
528 }
529 
530 /*
531  * XDR counted bytes
532  * *cpp is a pointer to the bytes, *sizep is the count.
533  * If *cpp is NULL maxsize bytes are allocated
534  */
535 bool_t
536 xdr_bytes(xdrs, cpp, sizep, maxsize)
537  XDR *xdrs;
538  char **cpp;
539  u_int *sizep;
540  u_int maxsize;
541 {
542  char *sp = *cpp; /* sp is the actual string pointer */
543  u_int nodesize;
544 #ifdef __REACTOS__ // CVE-2017-8779
545  bool_t ret, allocated = FALSE;
546 #endif
547 
548  /*
549  * first deal with the length since xdr bytes are counted
550  */
551  if (! xdr_u_int(xdrs, sizep)) {
552  return (FALSE);
553  }
554  nodesize = *sizep;
555  if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
556  return (FALSE);
557  }
558 
559  /*
560  * now deal with the actual bytes
561  */
562  switch (xdrs->x_op) {
563 
564  case XDR_DECODE:
565  if (nodesize == 0) {
566  return (TRUE);
567  }
568  if (sp == NULL) {
569  *cpp = sp = mem_alloc(nodesize);
570 #ifdef __REACTOS__ // CVE-2017-8779
571  allocated = TRUE;
572 #endif
573  }
574  if (sp == NULL) {
575  //warnx("xdr_bytes: out of memory");
576  return (FALSE);
577  }
578  /* FALLTHROUGH */
579 
580  case XDR_ENCODE:
581 #ifndef __REACTOS__ // CVE-2017-8779
582  return (xdr_opaque(xdrs, sp, nodesize));
583 #else
584  ret = xdr_opaque(xdrs, sp, nodesize);
585  if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
586  if (allocated == TRUE) {
587  free(sp);
588  *cpp = NULL;
589  }
590  }
591  return (ret);
592 #endif
593 
594  case XDR_FREE:
595  if (sp != NULL) {
596  mem_free(sp, nodesize);
597  *cpp = NULL;
598  }
599  return (TRUE);
600  }
601  /* NOTREACHED */
602  return (FALSE);
603 }
604 
605 /*
606  * Implemented here due to commonality of the object.
607  */
608 bool_t
610  XDR *xdrs;
611  struct netobj *np;
612 {
613 
614  return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
615 }
616 
617 /*
618  * XDR a descriminated union
619  * Support routine for discriminated unions.
620  * You create an array of xdrdiscrim structures, terminated with
621  * an entry with a null procedure pointer. The routine gets
622  * the discriminant value and then searches the array of xdrdiscrims
623  * looking for that value. It calls the procedure given in the xdrdiscrim
624  * to handle the discriminant. If there is no specific routine a default
625  * routine may be called.
626  * If there is no specific or default routine an error is returned.
627  */
628 bool_t
629 xdr_union(xdrs, dscmp, unp, choices, dfault)
630  XDR *xdrs;
631  enum_t *dscmp; /* enum to decide which arm to work on */
632  char *unp; /* the union itself */
633  const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
634  xdrproc_t dfault; /* default xdr routine */
635 {
636  enum_t dscm;
637 
638  /*
639  * we deal with the discriminator; it's an enum
640  */
641  if (! xdr_enum(xdrs, dscmp)) {
642  return (FALSE);
643  }
644  dscm = *dscmp;
645 
646  /*
647  * search choices for a value that matches the discriminator.
648  * if we find one, execute the xdr routine for that value.
649  */
650  for (; choices->proc != NULL_xdrproc_t; choices++) {
651  if (choices->value == dscm)
652  return ((*(choices->proc))(xdrs, unp));
653  }
654 
655  /*
656  * no match - execute the default xdr routine if there is one
657  */
658  return ((dfault == NULL_xdrproc_t) ? FALSE :
659  (*dfault)(xdrs, unp));
660 }
661 
662 
663 /*
664  * Non-portable xdr primitives.
665  * Care should be taken when moving these routines to new architectures.
666  */
667 
668 
669 /*
670  * XDR null terminated ASCII strings
671  * xdr_string deals with "C strings" - arrays of bytes that are
672  * terminated by a NULL character. The parameter cpp references a
673  * pointer to storage; If the pointer is null, then the necessary
674  * storage is allocated. The last parameter is the max allowed length
675  * of the string as specified by a protocol.
676  */
677 bool_t
678 xdr_string(xdrs, cpp, maxsize)
679  XDR *xdrs;
680  char **cpp;
681  u_int maxsize;
682 {
683  char *sp = *cpp; /* sp is the actual string pointer */
684  u_int size;
685  u_int nodesize;
686 #ifdef __REACTOS__ // CVE-2017-8779
687  bool_t ret, allocated = FALSE;
688 #endif
689 
690  /*
691  * first deal with the length since xdr strings are counted-strings
692  */
693  switch (xdrs->x_op) {
694  case XDR_FREE:
695  if (sp == NULL) {
696  return(TRUE); /* already free */
697  }
698  /* FALLTHROUGH */
699  case XDR_ENCODE:
700  if (sp == NULL)
701  return FALSE;
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  if (nodesize == 0) {
715  /* This means an overflow. It a bug in the caller which
716  * provided a too large maxsize but nevertheless catch it
717  * here.
718  */
719  return FALSE;
720  }
721 
722  /*
723  * now deal with the actual bytes
724  */
725  switch (xdrs->x_op) {
726 
727  case XDR_DECODE:
728 #ifndef __REACTOS__ // CVE-2017-8779
729  if (sp == NULL)
730  *cpp = sp = mem_alloc(nodesize);
731 #else
732  if (sp == NULL) {
733  *cpp = sp = mem_alloc(nodesize);
734  allocated = TRUE;
735  }
736 #endif
737  if (sp == NULL) {
738  //warnx("xdr_string: out of memory");
739  return (FALSE);
740  }
741  sp[size] = 0;
742  /* FALLTHROUGH */
743 
744  case XDR_ENCODE:
745 #ifndef __REACTOS__ // CVE-2017-8779
746  return (xdr_opaque(xdrs, sp, size));
747 #else
748  ret = xdr_opaque(xdrs, sp, size);
749  if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
750  if (allocated == TRUE) {
751  free(sp);
752  *cpp = NULL;
753  }
754  }
755  return (ret);
756 #endif
757 
758  case XDR_FREE:
759  mem_free(sp, nodesize);
760  *cpp = NULL;
761  return (TRUE);
762  }
763  /* NOTREACHED */
764  return (FALSE);
765 }
766 
767 /*
768  * Wrapper for xdr_string that can be called directly from
769  * routines like clnt_call
770  */
771 bool_t
772 xdr_wrapstring(xdrs, cpp)
773  XDR *xdrs;
774  char **cpp;
775 {
776 #ifdef __REACTOS__ // CVE-2017-8779
777  return xdr_string(xdrs, cpp, RPC_MAXDATASIZE);
778 #else
779  return xdr_string(xdrs, cpp, LASTUNSIGNED);
780 #endif
781 }
782 
783 /*
784  * NOTE: xdr_hyper(), xdr_u_hyper(), xdr_longlong_t(), and xdr_u_longlong_t()
785  * are in the "non-portable" section because they require that a `long long'
786  * be a 64-bit type.
787  *
788  * --thorpej@netbsd.org, November 30, 1999
789  */
790 
791 /*
792  * XDR 64-bit integers
793  */
794 bool_t
795 xdr_int64_t(xdrs, llp)
796  XDR *xdrs;
797  int64_t *llp;
798 {
799  u_long ul[2];
800 
801  switch (xdrs->x_op) {
802  case XDR_ENCODE:
803  ul[0] = (u_long)((u_int64_t)*llp >> 32) & 0xffffffff;
804  ul[1] = (u_long)((u_int64_t)*llp) & 0xffffffff;
805  if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
806  return (FALSE);
807  return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
808  case XDR_DECODE:
809  if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE)
810  return (FALSE);
811  if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
812  return (FALSE);
813  *llp = (int64_t)
814  (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
815  return (TRUE);
816  case XDR_FREE:
817  return (TRUE);
818  }
819  /* NOTREACHED */
820  return (FALSE);
821 }
822 
823 
824 /*
825  * XDR unsigned 64-bit integers
826  */
827 bool_t
828 xdr_u_int64_t(xdrs, ullp)
829  XDR *xdrs;
830  u_int64_t *ullp;
831 {
832  u_long ul[2];
833 
834  switch (xdrs->x_op) {
835  case XDR_ENCODE:
836  ul[0] = (u_long)(*ullp >> 32) & 0xffffffff;
837  ul[1] = (u_long)(*ullp) & 0xffffffff;
838  if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
839  return (FALSE);
840  return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
841  case XDR_DECODE:
842  if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE)
843  return (FALSE);
844  if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
845  return (FALSE);
846  *ullp = (u_int64_t)
847  (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
848  return (TRUE);
849  case XDR_FREE:
850  return (TRUE);
851  }
852  /* NOTREACHED */
853  return (FALSE);
854 }
855 
856 
857 /*
858  * XDR hypers
859  */
860 bool_t
861 xdr_hyper(xdrs, llp)
862  XDR *xdrs;
863  longlong_t *llp;
864 {
865 
866  /*
867  * Don't bother open-coding this; it's a fair amount of code. Just
868  * call xdr_int64_t().
869  */
870  return (xdr_int64_t(xdrs, (int64_t *)llp));
871 }
872 
873 
874 /*
875  * XDR unsigned hypers
876  */
877 bool_t
878 xdr_u_hyper(xdrs, ullp)
879  XDR *xdrs;
880  u_longlong_t *ullp;
881 {
882 
883  /*
884  * Don't bother open-coding this; it's a fair amount of code. Just
885  * call xdr_u_int64_t().
886  */
887  return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
888 }
889 
890 
891 /*
892  * XDR longlong_t's
893  */
894 bool_t
895 xdr_longlong_t(xdrs, llp)
896  XDR *xdrs;
897  longlong_t *llp;
898 {
899 
900  /*
901  * Don't bother open-coding this; it's a fair amount of code. Just
902  * call xdr_int64_t().
903  */
904  return (xdr_int64_t(xdrs, (int64_t *)llp));
905 }
906 
907 
908 /*
909  * XDR u_longlong_t's
910  */
911 bool_t
912 xdr_u_longlong_t(xdrs, ullp)
913  XDR *xdrs;
914  u_longlong_t *ullp;
915 {
916 
917  /*
918  * Don't bother open-coding this; it's a fair amount of code. Just
919  * call xdr_u_int64_t().
920  */
921  return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
922 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define XDR_GETLONG(xdrs, longp)
Definition: xdr.h:156
#define TRUE
Definition: types.h:120
bool_t xdr_short(XDR *xdrs, short *sp)
Definition: xdr.c:270
bool_t xdr_int64_t(XDR *xdrs, int64_t *llp)
Definition: xdr.c:795
bool_t xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp)
Definition: xdr.c:878
#define int32_t
Definition: nsiface.idl:56
unsigned long u_long
Definition: linux.h:269
bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp)
Definition: xdr.c:912
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int32_t bool_t
Definition: types.h:101
#define u_int16_t
Definition: icmp.c:102
XDR xdrs
Definition: svc_vc.c:97
bool_t xdr_wrapstring(XDR *xdrs, char **cpp)
Definition: xdr.c:772
bool_t xdr_char(XDR *xdrs, char *cp)
Definition: xdr.c:392
bool_t xdr_u_char(XDR *xdrs, u_char *cp)
Definition: xdr.c:410
#define free
Definition: debug_ros.c:5
void xdr_free(xdrproc_t proc, void *objp)
Definition: xdr.c:78
bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault)
Definition: xdr.c:629
bool_t xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
Definition: xdr.c:678
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static HANDLE proc()
Definition: pdb.c:32
char * caddr_t
Definition: rosdhcp.h:36
Definition: xdr.h:103
#define up(mutex)
Definition: glue.h:30
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
#define LASTUNSIGNED
Definition: xdr.c:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define mem_alloc(bsize)
Definition: types.h:123
UINT64 u_quad_t
Definition: types.h:86
int ip[4]
Definition: rtl.c:1176
Definition: xdr.h:332
#define XDR_GETBYTES(xdrs, addr, len)
Definition: xdr.h:189
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
UINT64 u_int64_t
Definition: types.h:76
bool_t xdr_u_int(XDR *xdrs, u_int *up)
Definition: xdr.c:133
bool_t xdr_netobj(XDR *xdrs, struct netobj *np)
Definition: xdr.c:609
r l[0]
Definition: byte_order.h:167
bool_t xdr_long(XDR *xdrs, long *lp)
Definition: xdr.c:165
GLsizeiptr size
Definition: glext.h:5919
bool_t xdr_enum(XDR *xdrs, enum_t *ep)
Definition: xdr.c:458
Definition: dhcpd.h:61
bool_t xdr_int(XDR *xdrs, int *ip)
Definition: xdr.c:103
#define NULL_xdrproc_t
Definition: xdr.h:246
bool_t xdr_int32_t(XDR *xdrs, int32_t *int32_p)
Definition: xdr.c:208
enum xdr_op x_op
Definition: xdr.h:104
bool_t xdr_int16_t(XDR *xdrs, int16_t *int16_p)
Definition: xdr.c:331
xdrproc_t proc
Definition: xdr.h:249
u_int n_len
Definition: xdr.h:333
unsigned short u_short
Definition: types.h:81
bool_t xdr_u_int16_t(XDR *xdrs, u_int16_t *u_int16_p)
Definition: xdr.c:361
unsigned short u_int16_t
Definition: rosdhcp.h:34
static const char xdr_zero[BYTES_PER_XDR_UNIT]
Definition: xdr.c:71
int ret
int32_t enum_t
Definition: types.h:102
#define MAX_NETOBJ_SZ
Definition: xdr.h:331
INT64 quad_t
Definition: types.h:85
bool_t xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt)
Definition: xdr.c:484
Definition: xdr.h:85
unsigned int u_int32_t
Definition: rosdhcp.h:35
bool_t xdr_u_long(XDR *xdrs, u_long *ulp)
Definition: xdr.c:186
bool_t xdr_void(void)
Definition: xdr.c:92
int value
Definition: xdr.h:248
INT32 int32_t
Definition: types.h:71
bool_t xdr_u_short(XDR *xdrs, u_short *usp)
Definition: xdr.c:300
quad_t longlong_t
Definition: xdr.c:56
#define XDR_TRUE
Definition: xdr.c:63
#define XDR_PUTLONG(xdrs, longp)
Definition: xdr.h:161
char * n_bytes
Definition: xdr.h:334
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
UINT32 u_int
Definition: types.h:82
#define long
Definition: qsort.c:33
bool_t xdr_bool(XDR *xdrs, bool_t *bp)
Definition: xdr.c:428
#define XDR_PUTBYTES(xdrs, addr, len)
Definition: xdr.h:194
bool_t xdr_u_int64_t(XDR *xdrs, u_int64_t *ullp)
Definition: xdr.c:828
bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp)
Definition: xdr.c:895
bool_t xdr_hyper(XDR *xdrs, longlong_t *llp)
Definition: xdr.c:861
Definition: xdr.h:87
POINT cp
Definition: magnifier.c:59
#define int16_t
Definition: nsiface.idl:55
#define RPC_MAXDATASIZE
Definition: rpc_com.h:51
Definition: xdr.h:86
#define mem_free(ptr, bsize)
Definition: types.h:124
static const WCHAR sp[]
Definition: suminfo.c:288
INT16 int16_t
Definition: types.h:70
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
Definition: xdr.c:536
#define int64_t
Definition: nsiface.idl:57
#define u_int32_t
Definition: icmp.c:103
UCHAR u_char
Definition: types.h:80
INT64 int64_t
Definition: types.h:72
#define XDR_FALSE
Definition: xdr.c:62
u_quad_t u_longlong_t
Definition: xdr.c:57
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define BYTES_PER_XDR_UNIT
Definition: xdr.h:93