home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume1 / rpc / part05 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  37.8 KB

  1. Date: Tue, 2 Apr 85 23:55:21 pst
  2. From: decvax!sun!pumpkinseed!blyon (Bob Lyon)
  3. Subject: Sun RPC part 5 of 10
  4.  
  5. echo x - rpc.prog2
  6. sed 's/^X//' >rpc.prog2 <<'!Funky!Stuff!'
  7. X.H A "Synopsis of RPC Routines"
  8. X.SH
  9. auth_destroy()
  10. X.LP
  11. X.LS
  12. void
  13. auth_destroy(auth)
  14.     AUTH *auth;
  15. X.LE
  16. A macro that destroys the authentication information associated with
  17. X.L auth .
  18. Destruction usually involves deallocation
  19. of private data structures.  The use of 
  20. X.L auth
  21. is undefined after calling
  22. X.L auth_destroy() .
  23. X.SH
  24. authnone_create()
  25. X.LP
  26. X.LS
  27. AUTH *
  28. authnone_create()
  29. X.LE
  30. Creates and returns an RPC authentication handle that passes no
  31. usable authentication information with each remote procedure call.
  32. X.SH
  33. authunix_create()
  34. X.LP
  35. X.LS
  36. AUTH *
  37. authunix_create(host, uid, gid, len, aup_gids)
  38.     char *host;
  39.     int uid, gid, len, *aup_gids;
  40. X.LE
  41. Creates and returns an RPC authentication handle that contains
  42. X.UX
  43. authentication information.
  44. The parameter
  45. X.L host
  46. is the name of the machine on which the information was created;
  47. X.L uid
  48. is the user's user ID;
  49. X.L gid
  50. is the user's current group ID;
  51. X.L len
  52. and
  53. X.L aup_gids
  54. refer to a counted array of groups to which the user belongs.
  55. It is easy to impersonate a user.
  56. X.SH
  57. authunix_create_default()
  58. X.LP
  59. X.LS
  60. AUTH *
  61. authunix_create_default()
  62. X.LE
  63. Calls
  64. X.L authunix_create()
  65. with the appropriate parameters.
  66. X.SH
  67. callrpc()
  68. X.LP
  69. X.LS
  70. callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
  71.     char *host;
  72.     u_long prognum, versnum, procnum;
  73.     char *in, *out;
  74.     xdrproc_t inproc, outproc;
  75. X.LE
  76. Calls the remote procedure associated with
  77. X.L prognum ,
  78. X.L versnum ,
  79. and
  80. X.L procnum
  81. on the machine,
  82. X.L host .
  83. The parameter
  84. X.L in
  85. is the address of the procedure's argument(s), and
  86. X.L out
  87. is the address of where to place the result(s);
  88. X.L inproc
  89. is used to encode the procedure's parameters, and
  90. X.L outproc
  91. is used to decode the procedure's results.
  92. This routine returns zero if it succeeds, or the value of
  93. X.L "enum clnt_stat"
  94. cast to an integer if it fails.
  95. The routine
  96. X.L clnt_perrno()
  97. is handy for translating failure statuses into messages.
  98. Warning: calling remote procedures with this routine
  99. uses UDP/IP as a transport; see
  100. X.L clntudp_create()
  101. for restrictions.
  102. X.SH
  103. clnt_broadcast()
  104. X.LP
  105. X.LS
  106. enum clnt_stat
  107. clnt_broadcast(prognum, versnum, procnum, inproc, in, outproc, out, eachresult)
  108.     u_long prognum, versnum, procnum;
  109.     char *in, *out;
  110.     xdrproc_t inproc, outproc;
  111.     resultproc_t eachresult;
  112. X.LE
  113. Like
  114. X.L callrpc() ,
  115. except the call message is broadcast to all locally connected broadcast nets.
  116. Each time it receives a response, this routine calls
  117. X.L eachresult ,
  118. whose form is
  119. X.LS
  120.     eachresult(out, addr)
  121.         char *out;
  122.         struct sockaddr_in *addr;
  123. X.LE
  124. where
  125. X.L out
  126. is the same as
  127. X.L out
  128. passed to
  129. X.L clnt_broadcast() ,
  130. except that the remote procedure's output is decoded there;
  131. X.L addr
  132. points to the address of the machine that sent the results.  If
  133. X.L eachresult()
  134. returns zero,
  135. X.L clnt_broadcast()
  136. waits for more replies;
  137. otherwise it returns with appropriate status.
  138. X.SH
  139. clnt_call()
  140. X.LP
  141. X.LS
  142. enum clnt_stat
  143. clnt_call(clnt, procnum, inproc, in, outproc, out, tout)
  144.     CLIENT *clnt; long procnum;
  145.     xdrproc_t inproc, outproc;
  146.     char *in, *out;
  147.     struct timeval tout;
  148. X.LE
  149. A macro that calls the remote procedure
  150. X.L procnum
  151. associated with the client handle,
  152. X.L clnt ,
  153. which is obtained with an RPC client creation routine such as
  154. X.L clntudp_create .
  155. The parameter
  156. X.L in
  157. is the address of the procedure's argument(s), and
  158. X.L out
  159. is the address of where to place the result(s);
  160. X.L inproc
  161. is used to encode the procedure's parameters, and
  162. X.L outproc
  163. is used to decode the procedure's results;
  164. X.L tout
  165. is the time allowed for results to come back.
  166. X.SH
  167. clnt_destroy()
  168. X.LP
  169. X.LS
  170. clnt_destroy(clnt)
  171.     CLIENT *clnt;
  172. X.LE
  173. A macro that destroys the client's RPC handle.
  174. Destruction usually involves deallocation
  175. of private data structures, including
  176. X.L clnt
  177. itself.  Use of
  178. X.L clnt
  179. is undefined after calling
  180. X.L clnt_destroy() .
  181. Warning: client destruction routines do not close sockets associated with
  182. X.L clnt ;
  183. this is the responsibility of the user.
  184. X.SH
  185. clnt_freeres()
  186. X.LP
  187. X.LS
  188. clnt_freeres(clnt, outproc, out)
  189.     CLIENT *clnt;
  190.     xdrproc_t outproc;
  191.     char *out;
  192. X.LE
  193. A macro that frees any data allocated by the RPC/XDR system
  194. when it decoded the results of an RPC call.
  195. The parameter
  196. X.L out
  197. is the address of the results, and
  198. X.L outproc
  199. is the XDR routine describing the results in simple primitives.
  200. This routine returns one if the results were successfully freed,
  201. and zero otherwise.
  202. X.SH
  203. clnt_geterr()
  204. X.LP
  205. X.LS
  206. void
  207. clnt_geterr(clnt, errp)
  208.     CLIENT *clnt;
  209.     struct rpc_err *errp;
  210. X.LE
  211. A macro that copies the error structure out of the client handle
  212. to the structure at address
  213. X.L errp .
  214. X.SH
  215. clnt_pcreateerror()
  216. X.LP
  217. X.LS
  218. void
  219. clnt_pcreateerror(s)
  220.     char *s;
  221. X.LE
  222. Prints a message to standard error indicating
  223. why a client RPC handle could not be created.
  224. The message is prepended with string
  225. X.L s
  226. and a colon.
  227. X.SH
  228. clnt_perrno()
  229. X.LP
  230. X.LS
  231. void
  232. clnt_perrno(stat)
  233.     enum clnt_stat;
  234. X.LE
  235. Prints a message to standard error corresponding
  236. to the condition indicated by
  237. X.L stat .
  238. X.SH
  239. clnt_perror()
  240. X.LP
  241. X.LS
  242. clnt_perror(clnt, s)
  243.     CLIENT *clnt;
  244.     char *s;
  245. X.LE
  246. Prints a message to standard error indicating why an RPC call failed;
  247. X.L clnt
  248. is the handle used to do the call.
  249. The message is prepended with string
  250. X.L s
  251. and a colon.
  252. X.SH
  253. clntraw_create()
  254. X.LP
  255. X.LS
  256. CLIENT *
  257. clntraw_create(prognum, versnum)
  258.     u_long prognum, versnum;
  259. X.LE
  260. This routine creates a toy RPC client for the remote program
  261. X.L prognum ,
  262. version
  263. X.L versnum .
  264. The transport used to pass messages to the service
  265. is actually a buffer within the process's address space,
  266. so the corresponding RPC server should live in the same address space; see
  267. X.L svcraw_create() .
  268. This allows simulation of RPC and acquisition of RPC overheads,
  269. such as round trip times, without any kernel interference.
  270. This routine returns NULL if it fails.
  271. X.SH
  272. clnttcp_create()
  273. X.LP
  274. X.LS
  275. CLIENT *
  276. clnttcp_create(addr, prognum, versnum, sockp, sendsz, recvsz)
  277.     struct sockaddr_in *addr;
  278.     u_long prognum, versnum;
  279.     int *sockp;
  280.     u_int sendsz, recvsz;
  281. X.LE
  282. This routine creates an RPC client for the remote program
  283. X.L prognum ,
  284. version
  285. X.L versnum ;
  286. the client uses TCP/IP as a transport.
  287. The remote program is located at Internet address
  288. X.L *addr .
  289. If
  290. X.L addr->sin_port
  291. is zero, then it is set to the actual port that the remote
  292. program is listening on (the remote
  293. X.I portmap
  294. service is consulted for this information).
  295. The parameter
  296. X.L *sockp
  297. is a socket; if it is RPC_ANYSOCK, then
  298. this routine opens a new one and sets
  299. X.L *sockp .
  300. Since TCP-based RPC uses buffered I/O, the user may specify
  301. the size of the send and receive buffers with the parameters
  302. X.L sendsz
  303. and
  304. X.L recvsz ;
  305. values of zero choose suitable defaults.
  306. This routine returns NULL if it fails.
  307. X.SH
  308. clntudp_create()
  309. X.LP
  310. X.LS
  311. CLIENT *
  312. clntudp_create(addr, prognum, versnum, wait, sockp)
  313.     struct sockaddr_in *addr;
  314.     u_long prognum, versnum;
  315.     struct timeval wait;
  316.     int *sockp;
  317. X.LE
  318. This routine creates an RPC client for the remote program
  319. X.L prognum ,
  320. version
  321. X.L versnum ;
  322. the client uses use UDP/IP as a transport.
  323. The remote program is located at Internet address
  324. X.L *addr .
  325. If
  326. X.L addr->sin_port
  327. is zero, then it is set to actual port that the remote
  328. program is listening on (the remote
  329. X.I portmap
  330. service is consulted for this information).
  331. The parameter
  332. X.L *sockp
  333. is a socket; if it is RPC_ANYSOCK,
  334. then this routine opens a new one and sets
  335. X.L *sockp .
  336. The UDP transport resends the call message in intervals of
  337. X.L wait
  338. time until a response is received or until the call times out.
  339. Warning: since UDP-based RPC messages can only hold up to 8 Kbytes
  340. of encoded data, this transport cannot be used for procedures
  341. that take large arguments or return huge results.
  342. X.SH
  343. get_myaddress()
  344. X.LP
  345. X.LS
  346. void
  347. get_myaddress(addr)
  348.     struct sockaddr_in *addr;
  349. X.LE
  350. Stuffs the machine's IP address into
  351. X.L *addr ,
  352. without consulting the library routines that deal with
  353. X.I /etc/hosts .
  354. The port number is always set to
  355. X.L htons(PMAPPORT) .
  356. X.SH
  357. pmap_getmaps()
  358. X.LP
  359. X.LS
  360. struct pmaplist *
  361. pmap_getmaps(addr)
  362.     struct sockaddr_in *addr;
  363. X.LE
  364. A user interface to the
  365. X.I portmap
  366. service, which returns a list of the current RPC program-to-port mappings
  367. on the host located at IP address
  368. X.L *addr .
  369. This routine can return NULL.  The command
  370. X.L "rpcinfo -p"
  371. uses this routine.
  372. X.SH
  373. pmap_getport()
  374. X.LP
  375. X.LS
  376. u_short
  377. pmap_getport(addr, prognum, versnum, protocol)
  378.     struct sockaddr_in *addr;
  379.     u_long prognum, versnum, protocol;
  380. X.LE
  381. A user interface to the
  382. X.I portmap
  383. service, which returns the port number
  384. on which waits a service that supports program number
  385. X.L prognum ,
  386. version
  387. X.L versnum ,
  388. and speaks the transport protocol associated with protocol.
  389. A return value of zero means that the mapping does not exist or that
  390. the RPC system failured to contact the remote
  391. X.I portmap
  392. service.  In the latter case, the global variable
  393. X.L rpc_createerr
  394. contains the RPC status.
  395. X.SH
  396. pmap_rmtcall()
  397. X.LP
  398. X.LS
  399. enum clnt_stat
  400. pmap_rmtcall(addr, prognum, versnum, procnum,
  401.          inproc, in, outproc, out, tout, portp)
  402.     struct sockaddr_in *addr;
  403.     u_long prognum, versnum, procnum;
  404.     char *in, *out;
  405.     xdrproc_t inproc, outproc;
  406.     struct timeval tout;
  407.     u_long *portp;
  408. X.LE
  409. A user interface to the
  410. X.I portmap
  411. service, which instructs
  412. X.I portmap
  413. on the host at IP address
  414. X.L *addr
  415. to make an RPC call on your behalf to a procedure on that host.
  416. The parameter
  417. X.L *portp
  418. will be modified to the program's port number if the procedure succeeds.
  419. The definitions of other parameters are discussed in
  420. X.L callrpc()
  421. and
  422. X.L clnt_call() ;
  423. see also
  424. X.L clnt_broadcast() .
  425. X.SH
  426. pmap_set()
  427. X.LP
  428. X.LS
  429. pmap_set(prognum, versnum, protocol, port)
  430.     u_long prognum, versnum, protocol;
  431.     u_short port;
  432. X.LE
  433. A user interface to the
  434. X.I portmap
  435. service, which establishes a mapping between the triple
  436. X.L [prognum,versnum,protocol]
  437. and
  438. X.L port
  439. on the machine's
  440. X.I portmap
  441. service.  The value of protocol is most likely IPPROTO_UDP or IPPROTO_TCP.
  442. This routine returns one if it succeeds, zero otherwise.
  443. X.SH
  444. pmap_unset()
  445. X.LP
  446. X.LS
  447. pmap_unset(prognum, versnum)
  448.     u_long prognum, versnum;
  449. X.LE
  450. A user interface to the
  451. X.I portmap
  452. service, which destroys all mappings between the triple
  453. X.L [prognum,versnum,*]
  454. and
  455. X.L ports 
  456. on the machine's
  457. X.I portmap
  458. service.
  459. This routine returns one if it succeeds, zero otherwise.
  460. X.SH
  461. registerrpc()
  462. X.LP
  463. X.LS
  464. registerrpc(prognum, versnum, procnum, procname, inproc, outproc)
  465.     u_long prognum, versnum, procnum;
  466.     char *(*procname)();
  467.     xdrproc_t inproc, outproc;
  468. X.LE
  469. Registers procedure
  470. X.L procname
  471. with the RPC service package.  If a request arrives for program
  472. X.L prognum ,
  473. version
  474. X.L versnum ,
  475. and procedure
  476. X.L procnum ,
  477. X.L procname
  478. is called with a pointer to its parameter(s);
  479. X.L progname
  480. should return a pointer to its static result(s);
  481. X.L inproc
  482. is used to decode the parameters while
  483. X.L outproc
  484. is used to encode the results.
  485. This routine returns zero if the registration succeeded, \-1 otherwise.
  486. Warning: remote procedures registered in this form
  487. are accessed using the UDP/IP transport; see
  488. X.L svcudp_create()
  489. for restrictions.
  490. X.SH
  491. rpc_createerr
  492. X.LP
  493. X.LS
  494. struct rpc_createerr    rpc_createerr;
  495. X.LE
  496. A global variable whose value is set by any RPC client creation routine
  497. that does not succeed.  Use the routine
  498. X.L clnt_pcreateerror()
  499. to print the reason why.
  500. X.SH
  501. svc_destroy()
  502. X.LP
  503. X.LS
  504. svc_destroy(xprt)
  505.     SVCXPRT *xprt;
  506. X.LE
  507. A macro that destroys the RPC service transport handle,
  508. X.L xprt .
  509. Destruction usually involves deallocation
  510. of private data structures, including
  511. X.L xprt
  512. itself.  Use of
  513. X.L xprt
  514. is undefined after calling this routine.
  515. X.SH
  516. svc_fds
  517. X.LP
  518. X.LS
  519. int    svc_fds;
  520. X.LE
  521. A global variable reflecting the RPC service side's
  522. read file descriptor bit mask; it is suitable as a parameter to the
  523. X.L select
  524. system call.  This is only of interest
  525. if a service implementor does not call
  526. X.L svc_run() ,
  527. but rather does his own asynchronous event processing.
  528. This variable is read-only (do not pass its address to
  529. X.L select !),
  530. yet it may change after calls to
  531. X.L svc_getreq()
  532. or any creation routines.
  533. X.SH
  534. svc_freeargs()
  535. X.LP
  536. X.LS
  537. svc_freeargs(xprt, inproc, in)
  538.     SVCXPRT *xprt;
  539.     xdrproc_t inproc;
  540.     char *in;
  541. X.LE
  542. A macro that frees any data allocated by the RPC/XDR system
  543. when it decoded the arguments to a service procedure using
  544. X.L svc_getargs().
  545. This routine returns one if the results were successfully freed,
  546. and zero otherwise.
  547. X.SH
  548. svc_getargs()
  549. X.LP
  550. X.LS
  551. svc_getargs(xprt, inproc, in)
  552.     SVCXPRT *xprt;
  553.     xdrproc_t inproc;
  554.     char *in;
  555. X.LE
  556. A macro that decodes the arguments of an RPC request
  557. associated with the RPC service transport handle,
  558. X.L xprt .
  559. The parameter
  560. X.L in
  561. is the address where the arguments will be placed;
  562. X.L inproc
  563. is the XDR routine used to decode the arguments.
  564. This routine returns one if decoding succeeds, and zero otherwise.
  565. X.SH
  566. svc_getcaller()
  567. X.LP
  568. X.LS
  569. struct sockaddr_in
  570. svc_getcaller(xprt)
  571.     SVCXPRT *xprt;
  572. X.LE
  573. The approved way of getting the network address of the caller
  574. of a procedure associated with the RPC service transport handle,
  575. X.L xprt .
  576. X.SH
  577. svc_getreq()
  578. X.LP
  579. X.LS
  580. svc_getreq(rdfds)
  581.     int rdfds;
  582. X.LE
  583. This routine is only of interest if a service implementor does not call
  584. X.L svc_run() ,
  585. but instead implements custom asynchronous event processing.
  586. It is called when the
  587. X.L select
  588. system call has determined that an RPC request
  589. has arrived on some RPC socket(s);
  590. X.L rdfds
  591. is the resultant read file descriptor bit mask.
  592. The routine returns when all sockets associated with the value of
  593. X.L rdfds
  594. have been serviced. 
  595. X.SH
  596. svc_register()
  597. X.LP
  598. X.LS
  599. svc_register(xprt, prognum, versnum, dispatch, protocol)
  600.     SVCXPRT *xprt;
  601.     u_long prognum, versnum;
  602.     void (*dispatch)();
  603.     u_long protocol;
  604. X.LE
  605. Associates
  606. X.L prognum
  607. and
  608. X.L versnum
  609. with the service dispatch procedure,
  610. X.L dispatch .
  611. If
  612. X.L protocol
  613. is non-zero, then a mapping of the triple
  614. X.L [prognum,versnum,protocol]
  615. to
  616. X.L xprt->xp_port
  617. is also established with the local
  618. X.I portmap
  619. service (generally
  620. X.L protocol
  621. is zero, IPPROTO_UDP or IPPROTO_TCP).
  622. The procedure
  623. X.L dispatch()
  624. has the following form:
  625. X.LS
  626.     dispatch(request, xprt)
  627.         struct svc_req *request;
  628.         SVCXPRT *xprt;
  629. X.LE
  630. The
  631. X.L svc_register
  632. routine returns one if it succeeds, and zero otherwise.
  633. X.SH
  634. svc_run()
  635. X.LP
  636. X.LS
  637. svc_run()
  638. X.LE
  639. This routine never returns.  It waits for RPC requests to arrive
  640. and calls the appropriate service procedure (using
  641. X.L svc_getreq )
  642. when one arrives.  This procedure is usually waiting for a
  643. X.L select
  644. system call to return.
  645. X.SH
  646. svc_sendreply()
  647. X.LP
  648. X.LS
  649. svc_sendreply(xprt, outproc, out)
  650.     SVCXPRT *xprt;
  651.     xdrproc_t outproc;
  652.     char *out;
  653. X.LE
  654. Called by an RPC service's dispatch routine
  655. to send the results of a remote procedure call.
  656. The parameter
  657. X.L xprt
  658. is the caller's associated transport handle;
  659. X.L outproc
  660. is the XDR routine which is used to encode the results; and
  661. X.L out
  662. is the address of the results.
  663. This routine returns one if it succeeds, zero otherwise.
  664. X.SH
  665. svc_unregister()
  666. X.LP
  667. X.LS
  668. void
  669. svc_unregister(prognum, versnum)
  670.     u_long prognum, versnum;
  671. X.LE
  672. Removes all mapping of the double
  673. X.L [prognum,versnum]
  674. to dispatch routines, and of the triple
  675. X.L [prognum,versnum,*]
  676. to port number.
  677. X.SH
  678. svcerr_auth()
  679. X.LP
  680. X.LS
  681. void
  682. svcerr_auth(xprt, why)
  683.     SVCXPRT *xprt;
  684.     enum auth_stat why;
  685. X.LE
  686. Called by a service dispatch routine that refuses to perform
  687. a remote procedure call due to an authentication error.
  688. X.SH
  689. svcerr_decode()
  690. X.LP
  691. X.LS
  692. void
  693. svcerr_decode(xprt)
  694.     SVCXPRT *xprt;
  695. X.LE
  696. Called by a service dispatch routine that can't successfully
  697. decode its parameters.  See also
  698. X.L svc_getargs() .
  699. X.SH
  700. svcerr_noproc()
  701. X.LP
  702. X.LS
  703. void
  704. svcerr_noproc(xprt)
  705.     SVCXPRT *xprt;
  706. X.LE
  707. Called by a service dispatch routine that doesn't implement
  708. the desired procedure number the caller request.
  709. X.SH
  710. svcerr_noprog()
  711. X.LP
  712. X.LS
  713. void
  714. svcerr_noprog(xprt)
  715.     SVCXPRT *xprt;
  716. X.LE
  717. Called when the desired program is not registered with the RPC package.
  718. Service implementors usually don't need this routine.
  719. X.SH
  720. svcerr_progvers()
  721. X.LP
  722. X.LS
  723. void
  724. svcerr_progvers(xprt)
  725.     SVCXPRT *xprt;
  726. X.LE
  727. Called when the desired version of a program is not registered
  728. with the RPC package.
  729. Service implementors usually don't need this routine.
  730. X.SH
  731. svcerr_systemerr()
  732. X.LP
  733. X.LS
  734. void
  735. svcerr_systemerr(xprt)
  736.     SVCXPRT *xprt;
  737. X.LE
  738. Called by a service dispatch routine when it detects a system error
  739. not covered by any particular protocol.
  740. For example, if a service can no longer allocate storage,
  741. it may call this routine.
  742. X.SH
  743. svcerr_weakauth()
  744. X.LP
  745. X.LS
  746. void
  747. svcerr_weakauth(xprt)
  748.     SVCXPRT *xprt;
  749. X.LE
  750. Called by a service dispatch routine that refuses to perform
  751. a remote procedure call due to insufficient (but correct)
  752. authentication parameters.  The routine calls
  753. X.L svcerr_auth(xprt,AUTH_TOOWEAK) .
  754. X.SH
  755. svcraw_create()
  756. X.LP
  757. X.LS
  758. SVCXPRT *
  759. svcraw_create()
  760. X.LE
  761. This routine creates a toy RPC service transport,
  762. to which it returns a pointer.  The transport
  763. is really a buffer within the process's address space,
  764. so the corresponding RPC client should live in the same address space; see
  765. X.L clntraw_create() .
  766. This routine allows simulation of RPC and acquisition of RPC overheads
  767. (such as round trip times), without any kernel interference.
  768. This routine returns NULL if it fails.
  769. X.SH
  770. svctcp_create()
  771. X.LP
  772. X.LS
  773. SVCXPRT *
  774. svctcp_create(sock, send_buf_size, recv_buf_size)
  775.     int sock;
  776.     u_int send_buf_size, recv_buf_size;
  777. X.LE
  778. This routine creates a TCP/IP-based RPC service transport,
  779. to which it returns a pointer.
  780. The transport is associated with the socket
  781. X.L sock ,
  782. which may be RPC_ANYSOCK, in which case a new socket is created.
  783. If the socket is not bound to a local TCP port, then this routine
  784. binds it to an arbitrary port.  Upon completion,
  785. X.L xprt->xp_sock
  786. is the transport's socket number, and
  787. X.L xprt->xp_port
  788. is the transport's port number.
  789. This routine returns NULL if it fails.
  790. Since TCP-based RPC uses buffered I/O, users may specify the size of the
  791. X.L send
  792. and
  793. X.L receive
  794. buffers; values of zero choose suitable defaults.
  795. X.SH
  796. svcudp_create()
  797. X.LP
  798. X.LS
  799. SVCXPRT *
  800. svcudp_create(sock)
  801.     int sock;
  802. X.LE
  803. This routine creates a UDP/IP-based RPC service transport,
  804. to which it returns a pointer.
  805. The transport is associated with the socket
  806. X.L sock ,
  807. which may be RPC_ANYSOCK, in which case a new socket is created.
  808. If the socket is not bound to a local UDP port, then this routine
  809. binds it to an arbitrary port.  Upon completion,
  810. X.L xprt->xp_sock
  811. is the transport's socket number, and
  812. X.L xprt->xp_port
  813. is the transport's port number.
  814. This routine returns NULL if it fails.
  815. Warning: since UDP-based RPC messages can only hold up to 8 Kbytes
  816. of encoded data, this transport cannot be used for procedures
  817. that take large arguments or return huge results.
  818. X.SH
  819. xdr_accepted_reply()
  820. X.LP
  821. X.LS
  822. xdr_accepted_reply(xdrs, ar)
  823.     XDR *xdrs;
  824.     struct accepted_reply *ar;
  825. X.LE
  826. Used for describing RPC messages, externally.
  827. This routine is useful for users who wish to generate
  828. RPC-style messages without using the RPC package.
  829. X.SH
  830. xdr_array()
  831. X.LP
  832. X.LS
  833. xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
  834.     XDR *xdrs;
  835.     char **arrp;
  836.     u_int *sizep, maxsize, elsize;
  837.     xdrproc_t elproc;
  838. X.LE
  839. A filter primitive that translates between arrays
  840. and their corresponding external representations.
  841. The parameter
  842. X.L arrp
  843. is the address of the pointer to the array, while
  844. X.L sizep
  845. is the address of the element count of the array;
  846. this element count cannot exceed
  847. X.L maxsize .
  848. The parameter
  849. X.L elsize
  850. is the
  851. X.L sizeof()
  852. each of the array's elements, and
  853. X.L elproc
  854. is an XDR filter that translates between
  855. the array elements' C form, and their external representation.
  856. This routine returns one if it succeeds, zero otherwise.
  857. X.SH
  858. xdr_authunix_parms()
  859. X.LP
  860. X.LS
  861. xdr_authunix_parms(xdrs, aupp)
  862.     XDR *xdrs;
  863.     struct authunix_parms *aupp;
  864. X.LE
  865. Used for describing UNIX credentials, externally.
  866. This routine is useful for users who wish to generate
  867. these credentials without using the RPC authentication package.
  868. X.SH
  869. xdr_bool()
  870. X.LP
  871. X.LS
  872. xdr_bool(xdrs, bp)
  873.     XDR *xdrs;
  874.     bool_t *bp;
  875. X.LE
  876. A filter primitive that translates between booleans (C integers)
  877. and their external representations.
  878. When encoding data, this filter produces values of either one or zero.
  879. This routine returns one if it succeeds, zero otherwise.
  880. X.SH
  881. xdr_bytes()
  882. X.LP
  883. X.LS
  884. xdr_bytes(xdrs, sp, sizep, maxsize)
  885.     XDR *xdrs;
  886.     char **sp;
  887.     u_int *sizep, maxsize;
  888. X.LE
  889. A filter primitive that translates between counted byte strings
  890. and their external representations.
  891. The parameter
  892. X.L sp
  893. is the address of the string pointer.
  894. The length of the string is located at address
  895. X.L sizep ;
  896. strings cannot be longer than
  897. X.L maxsize .
  898. This routine returns one if it succeeds, zero otherwise.
  899. X.SH
  900. xdr_callhdr()
  901. X.LP
  902. X.LS
  903. void
  904. xdr_callhdr(xdrs, chdr)
  905.     XDR *xdrs;
  906.     struct rpc_msg *chdr;
  907. X.LE
  908. Used for describing RPC messages, externally.
  909. This routine is useful for users who wish to generate
  910. RPC-style messages without using the RPC package.
  911. X.SH
  912. xdr_callmsg()
  913. X.LP
  914. X.LS
  915. xdr_callmsg(xdrs, cmsg)
  916.     XDR *xdrs;
  917.     struct rpc_msg *cmsg;
  918. X.LE
  919. Used for describing RPC messages, externally.
  920. This routine is useful for users who wish to generate
  921. RPC-style messages without using the RPC package.
  922. X.SH
  923. xdr_double()
  924. X.LP
  925. X.LS
  926. xdr_double(xdrs, dp)
  927.     XDR *xdrs;
  928.     double *dp;
  929. X.LE
  930. A filter primitive that translates between C
  931. X.L double
  932. precision numbers and their external representations.
  933. This routine returns one if it succeeds, zero otherwise.
  934. X.SH
  935. xdr_enum()
  936. X.LP
  937. X.LS
  938. xdr_enum(xdrs, ep)
  939.     XDR *xdrs;
  940.     enum_t *ep;
  941. X.LE
  942. A filter primitive that translates between C
  943. X.L enum s
  944. (actually integers) and their external representations.
  945. This routine returns one if it succeeds, zero otherwise.
  946. X.SH
  947. xdr_float()
  948. X.LP
  949. X.LS
  950. xdr_float(xdrs, fp)
  951.     XDR *xdrs;
  952.     float *fp;
  953. X.LE
  954. A filter primitive that translates between C
  955. X.L float s
  956. and their external representations.
  957. This routine returns one if it succeeds, zero otherwise.
  958. X.SH
  959. xdr_inline()
  960. X.LP
  961. X.LS
  962. long *
  963. xdr_inline(xdrs, len)
  964.     XDR *xdrs;
  965.     int len;
  966. X.LE
  967. A macro that invokes the in-line routine associated with the XDR stream,
  968. X.L xdrs .
  969. The routine returns a pointer
  970. to a contiguous piece of the stream's buffer;
  971. X.L len
  972. is the byte length of the desired buffer.
  973. Note that pointer is cast to
  974. X.L "long *" .
  975. Warning:
  976. X.L xdr_inline()
  977. may return 0 (NULL) if it cannot allocate
  978. a contiguous piece of a buffer.
  979. Therefore the behavior may vary among stream instances;
  980. it exists for the sake of efficiency.
  981. X.SH
  982. xdr_int()
  983. X.LP
  984. X.LS
  985. xdr_int(xdrs, ip)
  986.     XDR *xdrs;
  987.     int *ip;
  988. X.LE
  989. A filter primitive that translates between C integers
  990. and their external representations.
  991. This routine returns one if it succeeds, zero otherwise.
  992. X.SH
  993. xdr_long()
  994. X.LP
  995. X.LS
  996. xdr_long(xdrs, lp)
  997.     XDR *xdrs;
  998.     long *lp;
  999. X.LE
  1000. A filter primitive that translates between C
  1001. X.L long
  1002. integers and their external representations.
  1003. This routine returns one if it succeeds, zero otherwise.
  1004. X.SH
  1005. xdr_opaque()
  1006. X.LP
  1007. X.LS
  1008. xdr_opaque(xdrs, cp, cnt)
  1009.     XDR *xdrs;
  1010.     char *cp;
  1011.     u_int cnt;
  1012. X.LE
  1013. A filter primitive that translates between fixed size opaque data
  1014. and its external representation.
  1015. The parameter
  1016. X.L cp
  1017. is the address of the opaque object, and
  1018. X.L cnt
  1019. is its size in bytes.
  1020. This routine returns one if it succeeds, zero otherwise.
  1021. X.SH
  1022. xdr_opaque_auth()
  1023. X.LP
  1024. X.LS
  1025. xdr_opaque_auth(xdrs, ap)
  1026.     XDR *xdrs;
  1027.     struct opaque_auth *ap;
  1028. X.LE
  1029. Used for describing RPC messages, externally.
  1030. This routine is useful for users who wish to generate
  1031. RPC-style messages without using the RPC package.
  1032. X.SH
  1033. xdr_pmap()
  1034. X.LP
  1035. X.LS
  1036. xdr_pmap(xdrs, regs)
  1037.     XDR *xdrs;
  1038.     struct pmap *regs;
  1039. X.LE
  1040. Used for describing parameters to various
  1041. X.I portmap
  1042. procedures, externally.
  1043. This routine is useful for users who wish to generate
  1044. these parameters without using the
  1045. X.L pmap
  1046. interface.
  1047. X.SH
  1048. xdr_pmaplist()
  1049. X.LP
  1050. X.LS
  1051. xdr_pmaplist(xdrs, rp)
  1052.     XDR *xdrs;
  1053.     struct pmaplist **rp;
  1054. X.LE
  1055. Used for describing a list of port mappings, externally.
  1056. This routine is useful for users who wish to generate
  1057. these parameters without using the
  1058. X.L pmap
  1059. interface.
  1060. X.SH
  1061. xdr_reference()
  1062. X.LP
  1063. X.LS
  1064. xdr_reference(xdrs, pp, size, proc)
  1065.     XDR *xdrs;
  1066.     char **pp;
  1067.     u_int size;
  1068.     xdrproc_t proc;
  1069. X.LE
  1070. A primitive that provides pointer chasing within structures.
  1071. The parameter
  1072. X.L pp
  1073. is the address of the pointer;
  1074. X.L size
  1075. is the
  1076. X.L sizeof()
  1077. the structure that
  1078. X.L *pp
  1079. points to; and
  1080. X.L proc
  1081. is an XDR procedure that filters the structure
  1082. between its C form and its external representation.
  1083. This routine returns one if it succeeds, zero otherwise.
  1084. X.SH
  1085. xdr_rejected_reply()
  1086. X.LP
  1087. X.LS
  1088. xdr_rejected_reply(xdrs, rr)
  1089.     XDR *xdrs;
  1090.     struct rejected_reply *rr;
  1091. X.LE
  1092. Used for describing RPC messages, externally.
  1093. This routine is useful for users who wish to generate
  1094. RPC-style messages without using the RPC package.
  1095. X.SH
  1096. xdr_replymsg()
  1097. X.LP
  1098. X.LS
  1099. xdr_replymsg(xdrs, rmsg)
  1100.     XDR *xdrs;
  1101.     struct rpc_msg *rmsg;
  1102. X.LE
  1103. Used for describing RPC messages, externally.
  1104. This routine is useful for users who wish to generate
  1105. RPC style messages without using the RPC package.
  1106. X.SH
  1107. xdr_short()
  1108. X.LP
  1109. X.LS
  1110. xdr_short(xdrs, sp)
  1111.     XDR *xdrs;
  1112.     short *sp;
  1113. X.LE
  1114. A filter primitive that translates between C
  1115. X.L short
  1116. integers and their external representations.
  1117. This routine returns one if it succeeds, zero otherwise.
  1118. X.SH
  1119. xdr_string()
  1120. X.LP
  1121. X.LS
  1122. xdr_string(xdrs, sp, maxsize)
  1123.     XDR *xdrs;
  1124.     char **sp;
  1125.     u_int maxsize;
  1126. X.LE
  1127. A filter primitive that translates between C strings and their
  1128. corresponding external representations.
  1129. Strings cannot cannot be longer than
  1130. X.L maxsize .
  1131. Note that
  1132. X.L sp
  1133. is the address of the string's pointer.
  1134. This routine returns one if it succeeds, zero otherwise.
  1135. X.SH
  1136. xdr_u_int()
  1137. X.LP
  1138. X.LS
  1139. xdr_u_int(xdrs, up)
  1140.     XDR *xdrs;
  1141.     unsigned *up;
  1142. X.LE
  1143. A filter primitive that translates between C
  1144. X.L unsigned
  1145. integers and their external representations.
  1146. This routine returns one if it succeeds, zero otherwise.
  1147. X.SH
  1148. xdr_u_long()
  1149. X.LP
  1150. X.LS
  1151. xdr_u_long(xdrs, ulp)
  1152.     XDR *xdrs;
  1153.     unsigned long *ulp;
  1154. X.LE
  1155. A filter primitive that translates between C
  1156. X.L "unsigned long"
  1157. integers and their external representations.
  1158. This routine returns one if it succeeds, zero otherwise.
  1159. X.SH
  1160. xdr_u_short()
  1161. X.LP
  1162. X.LS
  1163. xdr_u_short(xdrs, usp)
  1164.     XDR *xdrs;
  1165.     unsigned short *usp;
  1166. X.LE
  1167. A filter primitive that translates between C
  1168. X.L "unsigned short"
  1169. integers and their external representations.
  1170. This routine returns one if it succeeds, zero otherwise.
  1171. X.SH
  1172. xdr_union()
  1173. X.LP
  1174. X.LS
  1175. xdr_union(xdrs, dscmp, unp, choices, dfault)
  1176.     XDR *xdrs;
  1177.     int *dscmp;
  1178.     char *unp;
  1179.     struct xdr_discrim *choices;
  1180.     xdrproc_t dfault;
  1181. X.LE
  1182. A filter primitive that translates between a discriminated C
  1183. X.L union
  1184. and its corresponding external representation.  The parameter
  1185. X.L dscmp
  1186. is the address of the union's discriminant, while
  1187. X.L unp
  1188. in the address of the union.
  1189. This routine returns one if it succeeds, zero otherwise.
  1190. X.SH
  1191. xdr_void()
  1192. X.LP
  1193. X.LS
  1194. xdr_void()
  1195. X.LE
  1196. This routine always returns one.
  1197. X.SH
  1198. xdr_wrapstring()
  1199. X.LP
  1200. X.LS
  1201. xdr_wrapstring(xdrs, sp)
  1202.     XDR *xdrs;
  1203.     char **sp;
  1204. X.LE
  1205. A primitive that calls
  1206. X.L xdr_string(xdrs,sp,MAXUNSIGNED);
  1207. where MAXUNSIGNED is the maximum value of an unsigned integer.
  1208. This is handy because the RPC package passes
  1209. only two parameters XDR routines, whereas
  1210. X.L xdr_string() ,
  1211. one of the most frequently used primitives, requires three parameters.
  1212. This routine returns one if it succeeds, zero otherwise.
  1213. X.SH
  1214. xprt_register()
  1215. X.LP
  1216. X.LS
  1217. void
  1218. xprt_register(xprt)
  1219.     SVCXPRT *xprt;
  1220. X.LE
  1221. After RPC service transport handles are created,
  1222. they should register themselves with the RPC service package.
  1223. This routine modifies the global variable
  1224. X.L svc_fds .
  1225. Service implementors usually don't need this routine.
  1226. X.SH
  1227. xprt_unregister()
  1228. X.LP
  1229. X.LS
  1230. void
  1231. xprt_unregister(xprt)
  1232.     SVCXPRT *xprt;
  1233. X.LE
  1234. Before an RPC service transport handle is destroyed,
  1235. it should unregister itself with the RPC service package.
  1236. This routine modifies the global variable
  1237. X.L svc_fds .
  1238. Service implementors usually don't need this routine.
  1239. !Funky!Stuff!
  1240. echo x - xdr.spec2
  1241. sed 's/^X//' >xdr.spec2 <<'!Funky!Stuff!'
  1242. X.H A "Synopsis of XDR Routines"
  1243. X.SH
  1244. xdr_array()
  1245. X.LP
  1246. X.LS
  1247. xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
  1248.     XDR *xdrs;
  1249.     char **arrp;
  1250.     u_int *sizep, maxsize, elsize;
  1251.     xdrproc_t elproc;
  1252. X.LE
  1253. A filter primitive that translates between arrays
  1254. and their corresponding external representations.
  1255. The parameter
  1256. X.L arrp
  1257. is the address of the pointer to the array, while
  1258. X.L sizep
  1259. is the address of the element count of the array;
  1260. this element count cannot exceed
  1261. X.L maxsize .
  1262. The parameter
  1263. X.L elsize
  1264. is the
  1265. X.L sizeof()
  1266. each of the array's elements, and
  1267. X.L elproc
  1268. is an XDR filter that translates between
  1269. the array elements' C form, and their external representation.  
  1270. This routine returns one if it succeeds, zero otherwise.
  1271. X.SH
  1272. xdr_bool()
  1273. X.LP
  1274. X.LS
  1275. xdr_bool(xdrs, bp)
  1276.     XDR *xdrs;
  1277.     bool_t *bp;
  1278. X.LE
  1279. A filter primitive that translates between booleans (C integers)
  1280. and their external representations.
  1281. When encoding data, this filter produces values of either one or zero.
  1282. This routine returns one if it succeeds, zero otherwise.
  1283. X.SH
  1284. xdr_bytes()
  1285. X.LP
  1286. X.LS
  1287. xdr_bytes(xdrs, sp, sizep, maxsize)
  1288.     XDR *xdrs;
  1289.     char **sp;
  1290.     u_int *sizep, maxsize;
  1291. X.LE
  1292. A filter primitive that translates between counted byte strings
  1293. and their external representations.
  1294. The parameter
  1295. X.L sp
  1296. is the address of the string pointer.
  1297. The length of the string is located at address
  1298. X.L sizep ;
  1299. strings cannot be longer than
  1300. X.L maxsize .
  1301. This routine returns one if it succeeds, zero otherwise.
  1302. X.SH
  1303. xdr_destroy()
  1304. X.LP
  1305. X.LS
  1306. void
  1307. xdr_destroy(xdrs)
  1308.     XDR *xdrs;
  1309. X.LE
  1310. A macro that invokes the destroy routine
  1311. associated with the XDR stream,
  1312. X.L xdrs .
  1313. Destruction usually involves freeing private data structures
  1314. associated with the stream.  Using
  1315. X.L xdrs
  1316. after invoking
  1317. X.L xdr_destroy()
  1318. is undefined.
  1319. X.SH
  1320. xdr_double()
  1321. X.LP
  1322. X.LS
  1323. xdr_double(xdrs, dp)
  1324.     XDR *xdrs;
  1325.     double *dp;
  1326. X.LE
  1327. A filter primitive that translates between C
  1328. X.L double
  1329. precision numbers and their external representations.
  1330. This routine returns one if it succeeds, zero otherwise.
  1331. X.SH
  1332. xdr_enum()
  1333. X.LP
  1334. X.LS
  1335. xdr_enum(xdrs, ep)
  1336.     XDR *xdrs;
  1337.     enum_t *ep;
  1338. X.LE
  1339. A filter primitive that translates between C
  1340. X.L enum s
  1341. (actually integers) and their external representations.
  1342. This routine returns one if it succeeds, zero otherwise.
  1343. X.SH
  1344. xdr_float()
  1345. X.LP
  1346. X.LS
  1347. xdr_float(xdrs, fp)
  1348.     XDR *xdrs;
  1349.     float *fp;
  1350. X.LE
  1351. A filter primitive that translates between C
  1352. X.L float s
  1353. and their external representations.
  1354. This routine returns one if it succeeds, zero otherwise.
  1355. X.SH
  1356. xdr_getpos()
  1357. X.LP
  1358. X.LS
  1359. u_int
  1360. xdr_getpos(xdrs)
  1361.     XDR *xdrs;
  1362. X.LE
  1363. A macro that invokes the get-position routine
  1364. associated with the XDR stream,
  1365. X.L xdrs .
  1366. The routine returns an unsigned integer,
  1367. which indicates the position of the XDR byte stream.
  1368. A desirable feature of XDR streams
  1369. is that simple arithmetic works with this number,
  1370. although the XDR stream instances need not guarantee this.
  1371. X.SH
  1372. xdr_inline()
  1373. X.LP
  1374. X.LS
  1375. long *
  1376. xdr_inline(xdrs, len)
  1377.     XDR *xdrs;
  1378.     int len;
  1379. X.LE
  1380. A macro that invokes the in-line routine associated with the XDR stream,
  1381. X.L xdrs .
  1382. The routine returns a pointer
  1383. to a contiguous piece of the stream's buffer;
  1384. X.L len
  1385. is the byte length of the desired buffer.
  1386. Note that the pointer is cast to
  1387. X.L "long *" .
  1388. Warning:
  1389. X.L xdr_inline()
  1390. may return 0 (NULL) if it cannot allocate
  1391. a contiguous piece of a buffer.
  1392. Therefore the behavior may vary among stream instances;
  1393. it exists for the sake of efficiency.
  1394. X.SH
  1395. xdr_int()
  1396. X.LP
  1397. X.LS
  1398. xdr_int(xdrs, ip)
  1399.     XDR *xdrs;
  1400.     int *ip;
  1401. X.LE
  1402. A filter primitive that translates between C integers
  1403. and their external representations.
  1404. This routine returns one if it succeeds, zero otherwise.
  1405. X.SH
  1406. xdr_long()
  1407. X.LP
  1408. X.LS
  1409. xdr_long(xdrs, lp)
  1410.     XDR *xdrs;
  1411.     long *lp;
  1412. X.LE
  1413. A filter primitive that translates between C
  1414. X.L long
  1415. integers and their external representations.
  1416. This routine returns one if it succeeds, zero otherwise.
  1417. X.SH
  1418. xdr_opaque()
  1419. X.LP
  1420. X.LS
  1421. xdr_opaque(xdrs, cp, cnt)
  1422.     XDR *xdrs;
  1423.     char *cp;
  1424.     u_int cnt;
  1425. X.LE
  1426. A filter primitive that translates between fixed size opaque data
  1427. and its external representation.
  1428. The parameter
  1429. X.L cp
  1430. is the address of the opaque object, and
  1431. X.L cnt
  1432. is its size in bytes.
  1433. This routine returns one if it succeeds, zero otherwise.
  1434. X.SH
  1435. xdr_reference()
  1436. X.LP
  1437. X.LS
  1438. xdr_reference(xdrs, pp, size, proc)
  1439.     XDR *xdrs;
  1440.     char **pp;
  1441.     u_int size;
  1442.     xdrproc_t proc;
  1443. X.LE
  1444. A primitive that provides pointer chasing within structures.
  1445. The parameter
  1446. X.L pp
  1447. is the address of the pointer;
  1448. X.L size
  1449. is the
  1450. X.L sizeof()
  1451. the structure that
  1452. X.L *pp
  1453. points to; and
  1454. X.L proc
  1455. is an XDR procedure that filters the structure
  1456. between its C form and its external representation.
  1457. This routine returns one if it succeeds, zero otherwise.
  1458. X.SH
  1459. xdr_setpos()
  1460. X.LP
  1461. X.LS
  1462. xdr_setpos(xdrs, pos)
  1463.     XDR *xdrs;
  1464.     u_int pos;
  1465. X.LE
  1466. A macro that invokes the set position routine associated with the XDR stream
  1467. X.L xdrs .
  1468. The parameter
  1469. X.L pos
  1470. is a position value obtained from
  1471. X.L xdr_getpos() .
  1472. This routine returns one if the XDR stream could be repositioned,
  1473. and zero otherwise.
  1474. Warning: it is difficult to reposition some types of XDR streams,
  1475. so this routine may fail with one type of stream and succeed with another. 
  1476. X.SH
  1477. xdr_short()
  1478. X.LP
  1479. X.LS
  1480. xdr_short(xdrs, sp)
  1481.     XDR *xdrs;
  1482.     short *sp;
  1483. X.LE
  1484. A filter primitive that translates between C
  1485. X.L short
  1486. integers and their external representations.
  1487. This routine returns one if it succeeds, zero otherwise.
  1488. X.SH
  1489. xdr_string()
  1490. X.LP
  1491. X.LS
  1492. xdr_string(xdrs, sp, maxsize)
  1493.     XDR *xdrs;
  1494.     char **sp;
  1495.     u_int maxsize;
  1496. X.LE
  1497. A filter primitive that translates between C strings and their
  1498. corresponding external representations.
  1499. Strings cannot cannot be longer than
  1500. X.L maxsize .
  1501. Note that
  1502. X.L sp
  1503. is the address of the string's pointer.
  1504. This routine returns one if it succeeds, zero otherwise.
  1505. X.SH
  1506. xdr_u_int()
  1507. X.LP
  1508. X.LS
  1509. xdr_u_int(xdrs, up)
  1510.     XDR *xdrs;
  1511.     unsigned *up;
  1512. X.LE
  1513. A filter primitive that translates between C
  1514. X.L unsigned
  1515. integers and their external representations.
  1516. This routine returns one if it succeeds, zero otherwise.
  1517. X.SH
  1518. xdr_u_long()
  1519. X.LP
  1520. X.LS
  1521. xdr_u_long(xdrs, ulp)
  1522.     XDR *xdrs;
  1523.     unsigned long *ulp;
  1524. X.LE
  1525. A filter primitive that translates between C
  1526. X.L "unsigned long"
  1527. integers and their external representations.
  1528. This routine returns one if it succeeds, zero otherwise.
  1529. X.SH
  1530. xdr_u_short()
  1531. X.LP
  1532. X.LS
  1533. xdr_u_short(xdrs, usp)
  1534.     XDR *xdrs;
  1535.     unsigned short *usp;
  1536. X.LE
  1537. A filter primitive that translates between C
  1538. X.L "unsigned short"
  1539. integers and their external representations.
  1540. This routine returns one if it succeeds, zero otherwise.
  1541. X.SH
  1542. xdr_union()
  1543. X.LP
  1544. X.LS
  1545. xdr_union(xdrs, dscmp, unp, choices, dfault)
  1546.     XDR *xdrs;
  1547.     int *dscmp;
  1548.     char *unp;
  1549.     struct xdr_discrim *choices;
  1550.     xdrproc_t dfault;
  1551. X.LE
  1552. A filter primitive that translates between a discriminated C
  1553. X.L union
  1554. and its corresponding external representation.  The parameter 
  1555. X.L dscmp
  1556. is the address of the union's discriminant, while
  1557. X.L unp
  1558. in the address of the union.
  1559. This routine returns one if it succeeds, zero otherwise.
  1560. X.SH
  1561. xdr_void()
  1562. X.LP
  1563. X.LS
  1564. xdr_void()
  1565. X.LE
  1566. This routine always returns one.
  1567. It may be passed to RPC routines that require a function parameter,
  1568. where nothing is to be done.
  1569. X.SH
  1570. xdr_wrapstring()
  1571. X.LP
  1572. X.LS
  1573. xdr_wrapstring(xdrs, sp)
  1574.     XDR *xdrs;
  1575.     char **sp;
  1576. X.LE
  1577. A primitive that calls
  1578. X.L xdr_string(xdrs,sp,MAXUNSIGNED);
  1579. where MAXUNSIGNED is the maximum value of an unsigned integer.
  1580. This is handy because the RPC package passes
  1581. only two parameters XDR routines, whereas
  1582. X.L xdr_string() ,
  1583. one of the most frequently used primitives, requires three parameters.
  1584. This routine returns one if it succeeds, zero otherwise.
  1585. X.SH
  1586. xdrmem_create()
  1587. X.LP
  1588. X.LS
  1589. void
  1590. xdrmem_create(xdrs, addr, size, op)
  1591.     XDR *xdrs;
  1592.     char *addr;
  1593.     u_int size;
  1594.     enum xdr_op op;
  1595. X.LE
  1596. This routine initializes the XDR stream object pointed to by
  1597. X.L xdrs .
  1598. The stream's data is written to, or read from,
  1599. a chunk of memory at location
  1600. X.L addr
  1601. whose length is no more than
  1602. X.L size
  1603. bytes long.  The
  1604. X.L op
  1605. determines the direction of the XDR stream
  1606. (either XDR_ENCODE, XDR_DECODE, or XDR_FREE).
  1607. X.SH
  1608. xdrrec_create()
  1609. X.LP
  1610. X.LS
  1611. void
  1612. xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit)
  1613.     XDR *xdrs;
  1614.     u_int sendsize, recvsize;
  1615.     char *handle;
  1616.     int (*readit)(), (*writeit)();
  1617. X.LE
  1618. This routine initializes the XDR stream object pointed to by
  1619. X.L xdrs .
  1620. The stream's data is written to a buffer of size
  1621. X.L sendsize ;
  1622. a value of zero indicates the system should use a suitable default.
  1623. The stream's data is read from a buffer of size
  1624. X.L recvsize ;
  1625. it too can be set to a suitable default by passing a zero value.
  1626. When a stream's output buffer is full,
  1627. X.L writeit()
  1628. is called.  Similarly, when a stream's input buffer is empty,
  1629. X.L readit()
  1630. is called.  The behavior of these two routines
  1631. is similar to the UNIX system calls
  1632. X.L read
  1633. and
  1634. X.L write ,
  1635. except that
  1636. X.L handle
  1637. is passed to the former routines as the first parameter.
  1638. Note that the XDR stream's
  1639. X.L op
  1640. field must be set by the caller.
  1641. Warning: this XDR stream implements an intermediate record stream.
  1642. Therefore there are additional bytes in the stream
  1643. to provide record boundary information.
  1644. X.SH
  1645. xdrrec_endofrecord()
  1646. X.LP
  1647. X.LS
  1648. xdrrec_endofrecord(xdrs, sendnow)
  1649.     XDR *xdrs;
  1650.     int sendnow;
  1651. X.LE
  1652. This routine can be invoked only on streams created by
  1653. X.L xdrrec_create() .
  1654. The data in the output buffer is marked as a completed record,
  1655. and the output buffer is optionally written out if
  1656. X.L sendnow
  1657. is non-zero.  This routine returns one if it succeeds, zero otherwise.
  1658. X.SH
  1659. xdrrec_eof()
  1660. X.LP
  1661. X.LS
  1662. xdrrec_eof(xdrs)
  1663.     XDR *xdrs;
  1664.     int empty;
  1665. X.LE
  1666. This routine can be invoked only on streams created by
  1667. X.L xdrrec_create() .
  1668. After consuming the rest of the current record in the stream,
  1669. this routine returns one if the stream has no more input, zero otherwise.
  1670. X.SH
  1671. xdrrec_skiprecord()
  1672. X.LP
  1673. X.LS
  1674. xdrrec_skiprecord(xdrs)
  1675.     XDR *xdrs;
  1676. X.LE
  1677. This routine can be invoked only on streams created by
  1678. X.L xdrrec_create() .
  1679. It tells the XDR implementation that the rest of the current record
  1680. in the stream's input buffer should be discarded.
  1681. This routine returns one if it succeeds, zero otherwise.
  1682. X.SH
  1683. xdrstdio_create()
  1684. X.LP
  1685. X.LS
  1686. void
  1687. xdrstdio_create(xdrs, file, op)
  1688.     XDR *xdrs;
  1689.     FILE *file;
  1690.     enum xdr_op op;
  1691. X.LE
  1692. This routine initializes the XDR stream object pointed to by
  1693. X.L xdrs .
  1694. The XDR stream data is written to, or read from, the Standard I/O stream
  1695. X.L file .
  1696. The parameter
  1697. X.L op
  1698. determines the direction of the XDR stream
  1699. (either XDR_ENCODE, XDR_DECODE, or XDR_FREE).
  1700. Warning: the destroy routine associated with such XDR streams calls
  1701. X.L fflush()
  1702. on the
  1703. X.L file
  1704. stream, but never
  1705. X.L fclose() . 
  1706. !Funky!Stuff!
  1707.  
  1708. exit
  1709.