xdr.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. /* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */
  2. /*
  3. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  4. * unrestricted use provided that this legend is included on all tape
  5. * media and as a part of the software program in whole or part. Users
  6. * may copy or modify Sun RPC without charge, but are not authorized
  7. * to license or distribute it to anyone else except as part of a product or
  8. * program developed by the user.
  9. *
  10. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  11. * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  12. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  13. *
  14. * Sun RPC is provided with no support and without any obligation on the
  15. * part of Sun Microsystems, Inc. to assist in its use, correction,
  16. * modification or enhancement.
  17. *
  18. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  19. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  20. * OR ANY PART THEREOF.
  21. *
  22. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  23. * or profits or other special, indirect and consequential damages, even if
  24. * Sun has been advised of the possibility of such damages.
  25. *
  26. * Sun Microsystems, Inc.
  27. * 2550 Garcia Avenue
  28. * Mountain View, California 94043
  29. */
  30. #if 0
  31. static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
  32. #endif
  33. /*
  34. * xdr.c, Generic XDR routines implementation.
  35. *
  36. * Copyright (C) 1986, Sun Microsystems, Inc.
  37. *
  38. * These are the "generic" xdr routines used to serialize and de-serialize
  39. * most common data items. See xdr.h for more info on the interface to
  40. * xdr.
  41. */
  42. #define __FORCE_GLIBC
  43. #include <features.h>
  44. #include <stdio.h>
  45. #include <limits.h>
  46. #include <string.h>
  47. #include <rpc/types.h>
  48. #include <rpc/xdr.h>
  49. #ifdef USE_IN_LIBIO
  50. # include <wchar.h>
  51. /* libc_hidden_proto(fwprintf) */
  52. #endif
  53. /* Experimentally off - libc_hidden_proto(strlen) */
  54. /* libc_hidden_proto(fputs) */
  55. /*
  56. * constants specific to the xdr "protocol"
  57. */
  58. #define XDR_FALSE ((long) 0)
  59. #define XDR_TRUE ((long) 1)
  60. #define LASTUNSIGNED ((u_int) 0-1)
  61. /*
  62. * for unit alignment
  63. */
  64. static const char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0};
  65. /*
  66. * Free a data structure using XDR
  67. * Not a filter, but a convenient utility nonetheless
  68. */
  69. void
  70. xdr_free (xdrproc_t proc, char *objp)
  71. {
  72. XDR x;
  73. x.x_op = XDR_FREE;
  74. (*proc) (&x, objp);
  75. }
  76. /*
  77. * XDR nothing
  78. */
  79. /* libc_hidden_proto(xdr_void) */
  80. bool_t
  81. xdr_void (void)
  82. {
  83. return TRUE;
  84. }
  85. libc_hidden_def(xdr_void)
  86. /*
  87. * XDR long integers
  88. * The definition of xdr_long() is kept for backward
  89. * compatibility. Instead xdr_int() should be used.
  90. */
  91. /* libc_hidden_proto(xdr_long) */
  92. bool_t
  93. xdr_long (XDR *xdrs, long *lp)
  94. {
  95. if (xdrs->x_op == XDR_ENCODE
  96. && (sizeof (int32_t) == sizeof (long)
  97. || (int32_t) *lp == *lp))
  98. return XDR_PUTLONG (xdrs, lp);
  99. if (xdrs->x_op == XDR_DECODE)
  100. return XDR_GETLONG (xdrs, lp);
  101. if (xdrs->x_op == XDR_FREE)
  102. return TRUE;
  103. return FALSE;
  104. }
  105. libc_hidden_def(xdr_long)
  106. /*
  107. * XDR short integers
  108. */
  109. /* libc_hidden_proto(xdr_short) */
  110. bool_t
  111. xdr_short (XDR *xdrs, short *sp)
  112. {
  113. long l;
  114. switch (xdrs->x_op)
  115. {
  116. case XDR_ENCODE:
  117. l = (long) *sp;
  118. return XDR_PUTLONG (xdrs, &l);
  119. case XDR_DECODE:
  120. if (!XDR_GETLONG (xdrs, &l))
  121. {
  122. return FALSE;
  123. }
  124. *sp = (short) l;
  125. return TRUE;
  126. case XDR_FREE:
  127. return TRUE;
  128. }
  129. return FALSE;
  130. }
  131. libc_hidden_def(xdr_short)
  132. /*
  133. * XDR integers
  134. */
  135. /* libc_hidden_proto(xdr_int) */
  136. bool_t
  137. xdr_int (XDR *xdrs, int *ip)
  138. {
  139. #if INT_MAX < LONG_MAX
  140. long l;
  141. switch (xdrs->x_op)
  142. {
  143. case XDR_ENCODE:
  144. l = (long) *ip;
  145. return XDR_PUTLONG (xdrs, &l);
  146. case XDR_DECODE:
  147. if (!XDR_GETLONG (xdrs, &l))
  148. {
  149. return FALSE;
  150. }
  151. *ip = (int) l;
  152. case XDR_FREE:
  153. return TRUE;
  154. }
  155. return FALSE;
  156. #elif INT_MAX == LONG_MAX
  157. return xdr_long (xdrs, (long *) ip);
  158. #elif INT_MAX == SHRT_MAX
  159. return xdr_short (xdrs, (short *) ip);
  160. #else
  161. #error unexpected integer sizes in xdr_int()
  162. #endif
  163. }
  164. libc_hidden_def(xdr_int)
  165. /*
  166. * XDR unsigned long integers
  167. * The definition of xdr_u_long() is kept for backward
  168. * compatibility. Instead xdr_u_int() should be used.
  169. */
  170. /* libc_hidden_proto(xdr_u_long) */
  171. bool_t
  172. xdr_u_long (XDR *xdrs, u_long *ulp)
  173. {
  174. switch (xdrs->x_op)
  175. {
  176. case XDR_DECODE:
  177. {
  178. long int tmp;
  179. if (XDR_GETLONG (xdrs, &tmp) == FALSE)
  180. return FALSE;
  181. *ulp = (uint32_t) tmp;
  182. return TRUE;
  183. }
  184. case XDR_ENCODE:
  185. if (sizeof (uint32_t) != sizeof (u_long)
  186. && (uint32_t) *ulp != *ulp)
  187. return FALSE;
  188. return XDR_PUTLONG (xdrs, (long *) ulp);
  189. case XDR_FREE:
  190. return TRUE;
  191. }
  192. return FALSE;
  193. }
  194. libc_hidden_def(xdr_u_long)
  195. /*
  196. * XDR unsigned integers
  197. */
  198. /* libc_hidden_proto(xdr_u_int) */
  199. bool_t
  200. xdr_u_int (XDR *xdrs, u_int *up)
  201. {
  202. #if UINT_MAX < ULONG_MAX
  203. u_long l;
  204. switch (xdrs->x_op)
  205. {
  206. case XDR_ENCODE:
  207. l = (u_long) * up;
  208. return XDR_PUTLONG (xdrs, (long *) &l);
  209. case XDR_DECODE:
  210. if (!XDR_GETLONG (xdrs, (long *) &l))
  211. {
  212. return FALSE;
  213. }
  214. *up = (u_int) l;
  215. case XDR_FREE:
  216. return TRUE;
  217. }
  218. return FALSE;
  219. #elif UINT_MAX == ULONG_MAX
  220. return xdr_u_long (xdrs, (u_long *) up);
  221. #elif UINT_MAX == USHRT_MAX
  222. return xdr_short (xdrs, (short *) up);
  223. #else
  224. #error unexpected integer sizes in xdr_u_int()
  225. #endif
  226. }
  227. libc_hidden_def(xdr_u_int)
  228. /*
  229. * XDR hyper integers
  230. * same as xdr_u_hyper - open coded to save a proc call!
  231. */
  232. /* libc_hidden_proto(xdr_hyper) */
  233. bool_t
  234. xdr_hyper (XDR *xdrs, quad_t *llp)
  235. {
  236. long t1;
  237. unsigned long t2;
  238. if (xdrs->x_op == XDR_ENCODE)
  239. {
  240. t1 = (long) ((*llp) >> 32);
  241. t2 = (long) (*llp);
  242. return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
  243. }
  244. if (xdrs->x_op == XDR_DECODE)
  245. {
  246. if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
  247. return FALSE;
  248. /* t2 must be unsigned for this to work */
  249. *llp = ((quad_t) t1) << 32;
  250. *llp |= t2;
  251. return TRUE;
  252. }
  253. if (xdrs->x_op == XDR_FREE)
  254. return TRUE;
  255. return FALSE;
  256. }
  257. libc_hidden_def(xdr_hyper)
  258. /*
  259. * XDR hyper integers
  260. * same as xdr_hyper - open coded to save a proc call!
  261. */
  262. /* libc_hidden_proto(xdr_u_hyper) */
  263. bool_t
  264. xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
  265. {
  266. unsigned long t1;
  267. unsigned long t2;
  268. if (xdrs->x_op == XDR_ENCODE)
  269. {
  270. t1 = (unsigned long) ((*ullp) >> 32);
  271. t2 = (unsigned long) (*ullp);
  272. return (XDR_PUTLONG(xdrs, (long *) &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
  273. }
  274. if (xdrs->x_op == XDR_DECODE)
  275. {
  276. if (!XDR_GETLONG(xdrs, (long *) &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
  277. return FALSE;
  278. *ullp = ((u_quad_t) t1) << 32;
  279. *ullp |= t2;
  280. return TRUE;
  281. }
  282. if (xdrs->x_op == XDR_FREE)
  283. return TRUE;
  284. return FALSE;
  285. }
  286. libc_hidden_def(xdr_u_hyper)
  287. bool_t
  288. xdr_longlong_t (XDR *xdrs, quad_t *llp)
  289. {
  290. return xdr_hyper (xdrs, llp);
  291. }
  292. bool_t
  293. xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp)
  294. {
  295. return xdr_u_hyper (xdrs, ullp);
  296. }
  297. /*
  298. * XDR unsigned short integers
  299. */
  300. /* libc_hidden_proto(xdr_u_short) */
  301. bool_t
  302. xdr_u_short (XDR *xdrs, u_short *usp)
  303. {
  304. u_long l;
  305. switch (xdrs->x_op)
  306. {
  307. case XDR_ENCODE:
  308. l = (u_long) * usp;
  309. return XDR_PUTLONG (xdrs, (long *) &l);
  310. case XDR_DECODE:
  311. if (!XDR_GETLONG (xdrs, (long *) &l))
  312. {
  313. return FALSE;
  314. }
  315. *usp = (u_short) l;
  316. return TRUE;
  317. case XDR_FREE:
  318. return TRUE;
  319. }
  320. return FALSE;
  321. }
  322. libc_hidden_def(xdr_u_short)
  323. /*
  324. * XDR a char
  325. */
  326. bool_t
  327. xdr_char (XDR *xdrs, char *cp)
  328. {
  329. int i;
  330. i = (*cp);
  331. if (!xdr_int (xdrs, &i))
  332. {
  333. return FALSE;
  334. }
  335. *cp = i;
  336. return TRUE;
  337. }
  338. /*
  339. * XDR an unsigned char
  340. */
  341. bool_t
  342. xdr_u_char (XDR *xdrs, u_char *cp)
  343. {
  344. u_int u;
  345. u = (*cp);
  346. if (!xdr_u_int (xdrs, &u))
  347. {
  348. return FALSE;
  349. }
  350. *cp = u;
  351. return TRUE;
  352. }
  353. /*
  354. * XDR booleans
  355. */
  356. /* libc_hidden_proto(xdr_bool) */
  357. bool_t
  358. xdr_bool (XDR *xdrs, bool_t *bp)
  359. {
  360. long lb;
  361. switch (xdrs->x_op)
  362. {
  363. case XDR_ENCODE:
  364. lb = *bp ? XDR_TRUE : XDR_FALSE;
  365. return XDR_PUTLONG (xdrs, &lb);
  366. case XDR_DECODE:
  367. if (!XDR_GETLONG (xdrs, &lb))
  368. {
  369. return FALSE;
  370. }
  371. *bp = (lb == XDR_FALSE) ? FALSE : TRUE;
  372. return TRUE;
  373. case XDR_FREE:
  374. return TRUE;
  375. }
  376. return FALSE;
  377. }
  378. libc_hidden_def(xdr_bool)
  379. /*
  380. * XDR enumerations
  381. */
  382. /* libc_hidden_proto(xdr_enum) */
  383. bool_t
  384. xdr_enum (XDR *xdrs, enum_t *ep)
  385. {
  386. enum sizecheck
  387. {
  388. SIZEVAL
  389. }; /* used to find the size of an enum */
  390. /*
  391. * enums are treated as ints
  392. */
  393. if (sizeof (enum sizecheck) == 4)
  394. {
  395. #if INT_MAX < LONG_MAX
  396. long l;
  397. switch (xdrs->x_op)
  398. {
  399. case XDR_ENCODE:
  400. l = *ep;
  401. return XDR_PUTLONG (xdrs, &l);
  402. case XDR_DECODE:
  403. if (!XDR_GETLONG (xdrs, &l))
  404. {
  405. return FALSE;
  406. }
  407. *ep = l;
  408. case XDR_FREE:
  409. return TRUE;
  410. }
  411. return FALSE;
  412. #else
  413. return xdr_long (xdrs, (long *) ep);
  414. #endif
  415. }
  416. else if (sizeof (enum sizecheck) == sizeof (short))
  417. {
  418. return xdr_short (xdrs, (short *) ep);
  419. }
  420. else
  421. {
  422. return FALSE;
  423. }
  424. }
  425. libc_hidden_def(xdr_enum)
  426. /*
  427. * XDR opaque data
  428. * Allows the specification of a fixed size sequence of opaque bytes.
  429. * cp points to the opaque object and cnt gives the byte length.
  430. */
  431. /* libc_hidden_proto(xdr_opaque) */
  432. bool_t
  433. xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
  434. {
  435. u_int rndup;
  436. static char crud[BYTES_PER_XDR_UNIT];
  437. /*
  438. * if no data we are done
  439. */
  440. if (cnt == 0)
  441. return TRUE;
  442. /*
  443. * round byte count to full xdr units
  444. */
  445. rndup = cnt % BYTES_PER_XDR_UNIT;
  446. if (rndup > 0)
  447. rndup = BYTES_PER_XDR_UNIT - rndup;
  448. switch (xdrs->x_op)
  449. {
  450. case XDR_DECODE:
  451. if (!XDR_GETBYTES (xdrs, cp, cnt))
  452. {
  453. return FALSE;
  454. }
  455. if (rndup == 0)
  456. return TRUE;
  457. return XDR_GETBYTES (xdrs, (caddr_t)crud, rndup);
  458. case XDR_ENCODE:
  459. if (!XDR_PUTBYTES (xdrs, cp, cnt))
  460. {
  461. return FALSE;
  462. }
  463. if (rndup == 0)
  464. return TRUE;
  465. return XDR_PUTBYTES (xdrs, xdr_zero, rndup);
  466. case XDR_FREE:
  467. return TRUE;
  468. }
  469. return FALSE;
  470. }
  471. libc_hidden_def(xdr_opaque)
  472. /*
  473. * XDR counted bytes
  474. * *cpp is a pointer to the bytes, *sizep is the count.
  475. * If *cpp is NULL maxsize bytes are allocated
  476. */
  477. /* libc_hidden_proto(xdr_bytes) */
  478. bool_t
  479. xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
  480. {
  481. char *sp = *cpp; /* sp is the actual string pointer */
  482. u_int nodesize;
  483. /*
  484. * first deal with the length since xdr bytes are counted
  485. */
  486. if (!xdr_u_int (xdrs, sizep))
  487. {
  488. return FALSE;
  489. }
  490. nodesize = *sizep;
  491. if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE))
  492. {
  493. return FALSE;
  494. }
  495. /*
  496. * now deal with the actual bytes
  497. */
  498. switch (xdrs->x_op)
  499. {
  500. case XDR_DECODE:
  501. if (nodesize == 0)
  502. {
  503. return TRUE;
  504. }
  505. if (sp == NULL)
  506. {
  507. *cpp = sp = (char *) mem_alloc (nodesize);
  508. }
  509. if (sp == NULL)
  510. {
  511. #ifdef USE_IN_LIBIO
  512. if (_IO_fwide (stderr, 0) > 0)
  513. (void) fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n"));
  514. else
  515. #endif
  516. (void) fputs (_("xdr_bytes: out of memory\n"), stderr);
  517. return FALSE;
  518. }
  519. /* fall into ... */
  520. case XDR_ENCODE:
  521. return xdr_opaque (xdrs, sp, nodesize);
  522. case XDR_FREE:
  523. if (sp != NULL)
  524. {
  525. mem_free (sp, nodesize);
  526. *cpp = NULL;
  527. }
  528. return TRUE;
  529. }
  530. return FALSE;
  531. }
  532. libc_hidden_def(xdr_bytes)
  533. /*
  534. * Implemented here due to commonality of the object.
  535. */
  536. bool_t
  537. xdr_netobj (xdrs, np)
  538. XDR *xdrs;
  539. struct netobj *np;
  540. {
  541. return xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ);
  542. }
  543. /*
  544. * XDR a discriminated union
  545. * Support routine for discriminated unions.
  546. * You create an array of xdrdiscrim structures, terminated with
  547. * an entry with a null procedure pointer. The routine gets
  548. * the discriminant value and then searches the array of xdrdiscrims
  549. * looking for that value. It calls the procedure given in the xdrdiscrim
  550. * to handle the discriminant. If there is no specific routine a default
  551. * routine may be called.
  552. * If there is no specific or default routine an error is returned.
  553. */
  554. /* libc_hidden_proto(xdr_union) */
  555. bool_t
  556. xdr_union (XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault)
  557. {
  558. enum_t dscm;
  559. /*
  560. * we deal with the discriminator; it's an enum
  561. */
  562. if (!xdr_enum (xdrs, dscmp))
  563. {
  564. return FALSE;
  565. }
  566. dscm = *dscmp;
  567. /*
  568. * search choices for a value that matches the discriminator.
  569. * if we find one, execute the xdr routine for that value.
  570. */
  571. for (; choices->proc != NULL_xdrproc_t; choices++)
  572. {
  573. if (choices->value == dscm)
  574. return (*(choices->proc)) (xdrs, unp, LASTUNSIGNED);
  575. }
  576. /*
  577. * no match - execute the default xdr routine if there is one
  578. */
  579. return ((dfault == NULL_xdrproc_t) ? FALSE :
  580. (*dfault) (xdrs, unp, LASTUNSIGNED));
  581. }
  582. libc_hidden_def(xdr_union)
  583. /*
  584. * Non-portable xdr primitives.
  585. * Care should be taken when moving these routines to new architectures.
  586. */
  587. /*
  588. * XDR null terminated ASCII strings
  589. * xdr_string deals with "C strings" - arrays of bytes that are
  590. * terminated by a NULL character. The parameter cpp references a
  591. * pointer to storage; If the pointer is null, then the necessary
  592. * storage is allocated. The last parameter is the max allowed length
  593. * of the string as specified by a protocol.
  594. */
  595. /* libc_hidden_proto(xdr_string) */
  596. bool_t
  597. xdr_string (XDR *xdrs, char **cpp, u_int maxsize)
  598. {
  599. char *sp = *cpp; /* sp is the actual string pointer */
  600. u_int size;
  601. u_int nodesize;
  602. /*
  603. * first deal with the length since xdr strings are counted-strings
  604. */
  605. switch (xdrs->x_op)
  606. {
  607. case XDR_FREE:
  608. if (sp == NULL)
  609. {
  610. return TRUE; /* already free */
  611. }
  612. /* fall through... */
  613. case XDR_ENCODE:
  614. if (sp == NULL)
  615. return FALSE;
  616. size = strlen (sp);
  617. break;
  618. case XDR_DECODE:
  619. break;
  620. }
  621. if (!xdr_u_int (xdrs, &size))
  622. {
  623. return FALSE;
  624. }
  625. if (size > maxsize)
  626. {
  627. return FALSE;
  628. }
  629. nodesize = size + 1;
  630. /*
  631. * now deal with the actual bytes
  632. */
  633. switch (xdrs->x_op)
  634. {
  635. case XDR_DECODE:
  636. if (nodesize == 0)
  637. {
  638. return TRUE;
  639. }
  640. if (sp == NULL)
  641. *cpp = sp = (char *) mem_alloc (nodesize);
  642. if (sp == NULL)
  643. {
  644. #ifdef USE_IN_LIBIO
  645. if (_IO_fwide (stderr, 0) > 0)
  646. (void) fwprintf (stderr, L"%s",
  647. _("xdr_string: out of memory\n"));
  648. else
  649. #endif
  650. (void) fputs (_("xdr_string: out of memory\n"), stderr);
  651. return FALSE;
  652. }
  653. sp[size] = 0;
  654. /* fall into ... */
  655. case XDR_ENCODE:
  656. return xdr_opaque (xdrs, sp, size);
  657. case XDR_FREE:
  658. mem_free (sp, nodesize);
  659. *cpp = NULL;
  660. return TRUE;
  661. }
  662. return FALSE;
  663. }
  664. libc_hidden_def(xdr_string)
  665. /*
  666. * Wrapper for xdr_string that can be called directly from
  667. * routines like clnt_call
  668. */
  669. bool_t
  670. xdr_wrapstring (xdrs, cpp)
  671. XDR *xdrs;
  672. char **cpp;
  673. {
  674. if (xdr_string (xdrs, cpp, LASTUNSIGNED))
  675. {
  676. return TRUE;
  677. }
  678. return FALSE;
  679. }