home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / rpc2 / part01 / rpc / doc / rpc.spec < prev    next >
Encoding:
Text File  |  1986-11-30  |  23.1 KB  |  808 lines

  1. .PL RIGHT
  2. .TL
  3. Remote Procedure Call
  4. .br
  5. Protocol Specification
  6. .bp
  7. .NH
  8. Introduction
  9. .LP
  10. This document specifies a message protocol used in implementing
  11. Sun's Remote Procedure Call (RPC) package.
  12. The message protocol is specified with the
  13. eXternal Data Representation (XDR) language.
  14. .LP
  15. This document assumes that the reader is familiar with both RPC and XDR.
  16. It does not attempt to justify RPC or its uses.
  17. Also, the casual user of RPC does not need to be
  18. familiar with the information in this document.
  19. .NH 2
  20. Terminology
  21. .LP
  22. The document discusses servers, services,
  23. programs, procedures, clients and versions.
  24. A server is a machine where some number
  25. of network services are implemented.
  26. A service is a collection of one or more remote programs.
  27. A remote program implements one or more remote procedures;
  28. the procedures, their parameters and results are documented
  29. in the specific program's protocol specification.
  30. Network clients are pieces of software that initiate
  31. remote procedure calls to services.
  32. A server may support more than one version of a remote program
  33. in order to be forward compatible with changing protocols.
  34. .LP
  35. For example, a network file service may be composed of two programs.
  36. One program may deal with high level applications
  37. such as file system access control and locking.
  38. The other may deal with low-level file I/O,
  39. and have procedures like ``read'' and ``write''.
  40. A client machine of the network file service would call
  41. the procedures associated with the two programs of the service
  42. on behalf of some user on the client machine.
  43. .NH 2
  44. The RPC Model
  45. .LP
  46. The remote procedure call model is similar to
  47. the local procedure call model.
  48. In the local case, the caller places arguments to a procedure
  49. in some well-specified location (such as a result register).
  50. It then transfers control to the procedure,
  51. and eventually gains back control.
  52. At that point, the results of the procedure
  53. are extracted from the well-specified location,
  54. and the caller continues execution.
  55. .LP
  56. The remote procedure call is similar,
  57. except that one thread of control winds through two processes \(em
  58. one is the caller's process,
  59. the other is a server's process.
  60. That is, the caller process sends a call message
  61. to the server process and waits (blocks) for a reply message.
  62. The call message contains the procedure's parameters,
  63. among other things.
  64. The reply message contains the procedure's results,
  65. among other things.
  66. Once the reply message is received,
  67. the results of the procedure are extracted,
  68. and caller's execution is resumed.
  69. .LP
  70. On the server side,
  71. a process is dormant awaiting the arrival of a call message.
  72. When one arrives the server process extracts the procedure's parameters,
  73. computes the results, sends a reply message,
  74. and then awaits the next call message.
  75. Note that in this model,
  76. only one of the two processes is active at any given time.
  77. That is, the RPC protocol does not explicitly support
  78. multi-threading of caller or server processes.
  79. .NH 2
  80. Transports and Semantics
  81. .LP
  82. The RPC protocol is independent of transport protocols.
  83. That is, RPC does not care how a message is passed
  84. from one process to another.
  85. The protocol only deals with
  86. the specification and interpretation of messages.
  87. .LP
  88. Because of transport independence,
  89. the RPC protocol does not attach specific semantics
  90. to the remote procedures or their execution.
  91. Some semantics can be inferred from
  92. (but should be explicitly specified by)
  93. the underlying transport protocol.
  94. For example, RPC message passing using UDP/IP is unreliable.
  95. Thus, if the caller retransmits call messages after short time-outs,
  96. the only thing he can infer from no reply message
  97. is that the remote procedure was executed
  98. zero or more times (and from a reply message, one or more times).
  99. On the other hand, RPC message passing using TCP/IP is reliable.
  100. No reply message means that the remote procedure was executed at most once,
  101. whereas a reply message means that the remote procedure was exactly once.
  102. (Note:
  103. At Sun, RPC is currently implemented
  104. on top of TCP/IP and UDP/IP transports.)
  105. .NH 2
  106. Binding and Rendezvous Independence
  107. .LP
  108. The act of binding a client to a service is
  109. .I not
  110. part of the remote procedure call specification.
  111. This important and necessary function
  112. is left up to some higher level software.
  113. .LP
  114. Implementors should think of the RPC protocol as the
  115. jump-subroutine instruction (``JSR'') of a network;
  116. the loader (binder) makes JSR useful,
  117. and the loader itself uses JSR to accomplish its task.
  118. Likewise, the network makes RPC useful,
  119. using RPC to accomplish this task.
  120. .NH 2
  121. Message Authentication
  122. .LP
  123. The RPC protocol provides the fields necessary for a client to
  124. identify himself to a service and vice versa.
  125. Security and access control mechanisms
  126. can be built on top of the message authentication.
  127. .bp
  128. .NH
  129. RPC Protocol Requirements
  130. .LP
  131. The RPC protocol must provide for the following:
  132. .IP 1.
  133. Unique specification of a procedure to be called.
  134. .IP 2.
  135. Provisions for matching response messages to request messages.
  136. .IP 3.
  137. Provisions for authenticating the caller to service and vice versa.
  138. .LP
  139. Besides these requirements,
  140. features that detect the following are worth supporting
  141. because of protocol roll-over errors, implementation bugs,
  142. user error, and network administration:
  143. .IP 1.
  144. RPC protocol mismatches.
  145. .IP 2.
  146. Remote program protocol version mismatches.
  147. .IP 3.
  148. Protocol errors (such as misspecification of a procedure's parameters).
  149. .IP 4.
  150. Reasons why remote authentication failed.
  151. .IP 5.
  152. Any other reasons why the desired procedure was not called.
  153. .LP
  154. .NH 2
  155. Remote Programs and Procedures
  156. .LP
  157. The RPC call message has three unsigned fields:
  158. remote program number,
  159. remote program version number,
  160. and remote procedure number.
  161. The three fields uniquely identify the procedure to be called.
  162. Program numbers are administered by some central authority (like Sun).
  163. Once an implementor has a program
  164. number, he can implement his remote program;
  165. the first implementation would
  166. most likely have the version number of 1.
  167. Because most new protocols evolve into better,
  168. stable and mature protocols,
  169. a version field of the call message identifies which version
  170. of the protocol the caller is using.
  171. Version numbers make speaking old and new protocols
  172. through the same server process possible.
  173. .LP
  174. The procedure number identifies the procedure to be called.
  175. These numbers are documented in
  176. the specific program's protocol specification.
  177. For example, a file service's protocol specification
  178. may state that its procedure number 5 is
  179. .LW read
  180. and procedure number 12 is
  181. .LW write .
  182. .LP
  183. Just as remote program protocols may change over several versions,
  184. the actual RPC message protocol could also change.
  185. Therefore, the call message also has the RPC version number in it;
  186. this field must be two (2).
  187. .LP
  188. The reply message to a request message has enough information
  189. to distinguish the following error conditions:
  190. .IP 1.
  191. The remote implementation of RPC does speak protocol version 2.  The
  192. lowest and highest supported RPC version numbers are returned.
  193. .IP 2.
  194. The remote program is not available on the remote system.
  195. .IP 3.
  196. The remote program does not support the requested version number.
  197. The lowest and highest supported
  198. remote program version numbers are returned.
  199. .IP 4.
  200. The requested procedure number does not exist
  201. (this is usually a caller side protocol or programming error).
  202. .IP 5.
  203. The parameters to the remote procedure
  204. appear to be garbage from the server's point of view.
  205. (Again, this is caused by a disagreement about the
  206. protocol between client and service.)
  207. .NH 2
  208. Authentication
  209. .LP
  210. Provisions for authentication of caller to service and vice versa are
  211. provided as a wart on the side of the RPC protocol.  The call message
  212. has two authentication fields, the credentials and verifier.
  213. The reply message has one authentication field,
  214. the response verifier.
  215. The RPC protocol specification defines all three fields
  216. to be the following opaque type:
  217. .BS
  218. .LS
  219. enum auth_flavor {
  220.     AUTH_NULL    = 0,
  221.     AUTH_UNIX    = 1,
  222.     AUTH_SHORT    = 2
  223.     /* and more to be defined */
  224. };
  225. .sp.5
  226. struct opaque_auth {
  227.     union switch (enum auth_flavor) {
  228.         default: string auth_body<400>;
  229.     };
  230. };
  231. .Lf
  232. .BE
  233. In simple English, any
  234. .LW opaque_auth
  235. structure is an
  236. .LW auth_flavor
  237. enumeration followed by a counted string,
  238. whose bytes are opaque to the RPC protocol implementation.
  239. .LP
  240. The interpretation and semantics of the data contained
  241. within the authentication fields is specified by individual,
  242. independent authentication protocol specifications.
  243. Appendix A defines three authentication protocols.
  244. .LP
  245. If authentication parameters were rejected,
  246. the response message contains information stating
  247. why they were rejected.
  248. .NH 2
  249. Program Number Assignment
  250. .LP
  251. Program numbers are given out in groups of 0x20000000 (536870912)
  252. according to the following chart:
  253. .BS
  254. .LS
  255.        0 - 1fffffff    defined by Sun
  256. 20000000 - 3fffffff    defined by user
  257. 40000000 - 5fffffff    transient
  258. 60000000 - 7fffffff    reserved
  259. 80000000 - 9fffffff    reserved
  260. a0000000 - bfffffff    reserved
  261. c0000000 - dfffffff    reserved
  262. e0000000 - ffffffff    reserved
  263. .Lf
  264. .BE
  265. The first group is a range of numbers administered by Sun Microsystems,
  266. and should be identical for all Sun customers.  The second range
  267. is for applications peculiar to a particular customer.
  268. This range is intended primarily for debugging new programs.
  269. When a customer develops an application that might be of general
  270. interest, that application should be given an assigned number
  271. in the first range.  The third group is for applications that
  272. generate program numbers dynamically.  The final groups
  273. are reservered for future use, and should not be used.
  274. .NH 2
  275. Other Uses of the RPC Protocol
  276. .LP
  277. The intended use of this protocol is for calling remote procedures.
  278. That is, each call message is matched with a response message.
  279. However, the protocol itself is a message passing protocol
  280. with which other (non-RPC) protocols can be implemented.
  281. Sun currently uses, or perhaps abuses,
  282. the RPC message protocol for the following two (non-RPC) protocols:
  283. batching (or pipelining) and broadcast RPC.
  284. These two protocols are discussed but not defined below.
  285. .NH 3
  286. Batching
  287. .LP
  288. Batching allows a client to send an arbitrarily large sequence
  289. of call messages to a server;
  290. batching uses reliable bytes stream protocols (like TCP/IP)
  291. for their transport.
  292. In the case of batching, the client never waits for a reply
  293. from the server and the server does not send replies to batch requests.
  294. A sequence of batch calls is usually terminated by a legitimate
  295. RPC in order to flush the pipeline (with positive acknowledgement).
  296. .NH 3
  297. Broadcast RPC
  298. .LP
  299. In broadcast RPC based protocols,
  300. the client sends an a broadcast packet to
  301. the network and waits for numerous replies.
  302. Broadcast RPC uses unreliable, packet based protocols (like UDP/IP)
  303. as their transports.
  304. Servers that support broadcast protocols only respond
  305. when the request is successfully processed,
  306. and are silent in the face of errors.
  307. .de NE
  308. .br
  309. .ne 1i
  310. ..
  311. .bp
  312. .NH
  313. The RPC Message Protocol
  314. .LP
  315. This section defines the RPC message protocol in the XDR data description
  316. language.  The message is defined in a top down style.
  317. Note: This is an XDR specification, not C code.
  318. .BS
  319. .LS no
  320. enum msg_type {
  321.     CALL = 0,
  322.     REPLY = 1
  323. };
  324. .sp.5
  325. .NE
  326. /*
  327.  * A reply to a call message can take on two forms:
  328.  * the message was either accepted or rejected.
  329.  */
  330. enum reply_stat {
  331.     MSG_ACCEPTED = 0,
  332.     MSG_DENIED = 1
  333. };
  334. .sp.5
  335. .NE
  336. /*
  337.  * Given that a call message was accepted, the following is
  338.  * the status of an attempt to call a remote procedure.
  339.  */
  340. enum accept_stat {
  341.     SUCCESS = 0,      /* RPC executed successfully */
  342.     PROG_UNAVAIL = 1, /* remote hasn't exported program */
  343.     PROG_MISMATCH= 2, /* remote can't support version # */
  344.     PROC_UNAVAIL = 3, /* program can't support procedure */
  345.     GARBAGE_ARGS = 4  /* procedure can't decode params */
  346. };
  347. .sp.5
  348. .NE
  349. /*
  350.  * Reasons why a call message was rejected:
  351.  */
  352. enum reject_stat {
  353.     RPC_MISMATCH = 0, /* RPC version number != 2 */
  354.     AUTH_ERROR = 1    /* remote can't authenticate caller */
  355. };
  356. .sp.5
  357. .NE
  358. /*
  359.  * Why authentication failed:
  360.  */
  361. enum auth_stat {
  362.     AUTH_BADCRED = 1,    /* bad credentials (seal broken) */
  363.     AUTH_REJECTEDCRED=2, /* client must begin new session */
  364.     AUTH_BADVERF = 3,    /* bad verifier (seal broken) */
  365.     AUTH_REJECTEDVERF=4, /* verifier expired or replayed */
  366.     AUTH_TOOWEAK = 5,    /* rejected for security reasons */
  367. };
  368. .sp.5
  369. .NE
  370. /*
  371.  * The RPC message:
  372.  * All messages start with a transaction identifier, xid,
  373.  * followed by a two-armed discriminated union.  The union's
  374.  * discriminant is a msg_type which switches to one of the
  375.  * two types of the message.  The xid of a REPLY message
  376.  * always matches that of the initiating CALL message.  NB:
  377.  * The xid field is only used for clients matching reply
  378.  * messages with call messages; the service side cannot
  379.  * treat this id as any type of sequence number.
  380.  */
  381. struct rpc_msg {
  382.     unsigned    xid;
  383.     union switch (enum msg_type) {
  384.         CALL:    struct call_body;
  385.         REPLY:    struct reply_body;
  386.     };
  387. };
  388. .sp.5
  389. .NE
  390. /*
  391.  * Body of an RPC request call:
  392.  * In version 2 of the RPC protocol specification, rpcvers
  393.  * must be equal to 2.  The fields prog, vers, and proc
  394.  * specify the remote program, its version number, and the
  395.  * procedure within the remote program to be called.  After
  396.  * these fields are two  authentication parameters: cred
  397.  * (authentication credentials) and verf (authentication
  398.  * verifier).  The two  authentication parameters are
  399.  * followed by the parameters to the remote procedure,
  400.  * which are specified by the specific program protocol.
  401.  */
  402. struct call_body {
  403.     unsigned rpcvers;    /* must be equal to two (2) */
  404.     unsigned prog;
  405.     unsigned vers;
  406.     unsigned proc;
  407.     struct opaque_auth cred;
  408.     struct opaque_auth verf;
  409.     /* procedure specific parameters start here */
  410. };
  411. .sp.5
  412. .NE
  413. /*
  414.  * Body of a reply to an RPC request.
  415.  * The call message was either accepted or rejected.
  416.  */
  417. struct reply_body {
  418.     union switch (enum reply_stat) {
  419.         MSG_ACCEPTED:    struct accepted_reply;
  420.         MSG_DENIED:    struct rejected_reply;
  421.     };
  422. };
  423. .sp.5
  424. .NE
  425. /*
  426.  * Reply to an RPC request that was accepted by the server.
  427.  * Note: there could be an error even though the reques
  428.  * was accepted.  The first field is an authentication
  429.  * verifier that the server generates in order to validate
  430.  * itself to the caller.  It is followed by a union whose
  431.  * discriminant is an enum accept_stat.  The SUCCESS arm
  432.  * of the union is protocol specific.  The PROG_UNAVAIL,
  433.  * PROC_UNAVAIL, and GARBAGE_ARGS arms of the union are
  434.  * void.  The PROG_MISMATCH arm specifies the lowest and
  435.  * highest version numbers of the remote program that are
  436.  * supported by the server.
  437.  */
  438. struct accepted_reply {
  439.     struct opaque_auth    verf;
  440.     union switch (enum accept_stat) {
  441.         SUCCESS: struct {
  442.             /*
  443.              * procedure-specific results start here
  444.              */
  445.         };
  446.         PROG_MISMATCH: struct {
  447.             unsigned low;
  448.             unsigned  high;
  449.         };
  450.         default: struct {
  451.             /*
  452.              * void. Cases include PROG_UNAVAIL,
  453.              * PROC_UNAVAIL, and GARBAGE_ARGS.
  454.              */
  455.         };
  456.     };
  457. };
  458. .sp.5
  459. .NE
  460. /*
  461.  * Reply to an RPC request that was rejected by the server.
  462.  * The request can be rejected because of two reasons:
  463.  * either the server is not running a compatible version of
  464.  * the RPC protocol (RPC_MISMATCH), or the server refuses
  465.  * to authenticate the caller (AUTH_ERROR).  In the case of
  466.  * an RPC version mismatch, the server returns the lowest
  467.  * and highest supported RPC version numbers.  In the case
  468.  * of refused authentication, failure status is returned.
  469.  */
  470. struct rejected_reply {
  471.     union switch (enum reject_stat) {
  472.         RPC_MISMATCH: struct {
  473.             unsigned low;
  474.             unsigned high;
  475.         };
  476.         AUTH_ERROR: enum auth_stat;
  477.     };
  478. };
  479. .Lf
  480. .BE
  481. .NH 2
  482. Authentication Parameter Specification
  483. .LP
  484. As previously stated, authentication parameters are opaque,
  485. but open-ended to the rest of the
  486. RPC protocol.  This section defines some ``flavors'' of authentication
  487. which have been implemented at (and supported by) Sun.
  488. .NH 3
  489. Null Authentication
  490. .LP
  491. Often calls must be made where the caller does not know who he is and
  492. the server does not care who the caller is.  In this case, the auth_flavor value
  493. (the discriminant of the opaque_auth's union) of the
  494. RPC message's credentials, verifier, and response verifier is
  495. .LW AUTH_NULL
  496. (0).
  497. The bytes of the auth_body string are undefined.
  498. It is recommended that the string length be zero.
  499. .NH 3
  500. UNIX Authentication
  501. .LP
  502. The caller of a remote procedure may wish to identify himself as he is
  503. identified on a
  504. .UX
  505. system.
  506. The value of the
  507. .LW credential 's
  508. discriminant of
  509. an RPC call message is
  510. .LW AUTH_UNIX
  511. (1).  The bytes of the
  512. .LW credential 's
  513. string encode the the following (XDR) structure:
  514. .BS
  515. .LS
  516. struct auth_unix {
  517.     unsigned    stamp;
  518.     string        machinename<255>;
  519.     unsigned    uid;
  520.     unsigned    gid;
  521.     unsigned    gids<10>;
  522. };
  523. .Lf
  524. .BE
  525. The
  526. .LW stamp
  527. is an arbitrary id which the caller machine may generate.
  528. The
  529. .LW machinename
  530. is the name of the caller's machine (like ``krypton'').
  531. The
  532. .LW uid
  533. is the caller's effective user id.
  534. The
  535. .LW gid
  536. is the callers effective group id.
  537. The
  538. .LW gids
  539. is a counted array of groups
  540. which contain the caller as a member.
  541. The
  542. .LW verifier
  543. accompanying the credentials should be of
  544. .LW AUTH_NULL
  545. (defined above).
  546. .LP
  547. The value of the discriminate of the
  548. .LW "response verifier"
  549. received in the reply message from the server may be
  550. .LW AUTH_NULL
  551. or
  552. .LW AUTH_SHORT .
  553. In the case of
  554. .LW AUTH_SHORT ,
  555. the bytes of the
  556. .LW "response verifier" 's
  557. string encode an
  558. .LW auth_opaque
  559. structure.
  560. This new
  561. .LW auth_opaque
  562. structure may now be passed to the server
  563. instead of the original
  564. .LW AUTH_UNIX
  565. flavor credentials.
  566. The server keeps a cache which maps short hand
  567. .LW auth_opaque
  568. structures (passed back by way of a
  569. .LW AUTH_SHORT
  570. style
  571. .LW "response verifier" )
  572. to the original credentials of the caller.
  573. The caller can save network bandwidth and server cpu cycles
  574. by using the new credentials.
  575. .LP
  576. The server may flush the short hand
  577. .LW auth_opaque
  578. structure at any time.
  579. If this happens, the remote procedure call message
  580. will be rejected due to an authentication error.
  581. The reason for the failure will be
  582. .LW AUTH_REJECTEDCRED .
  583. At this point, the caller may wish to try the original
  584. .LW AUTH_UNIX
  585. style of credentials.
  586. .NH 2
  587. Record Marking Standard
  588. .LP
  589. When RPC messages are passed on top of a byte stream protocol
  590. (like TCP/IP), it is necessary, or at least desirable,
  591. to delimit one message from another in order to detect
  592. and possibly recover from user protocol errors.
  593. This is called record marking (RM).
  594. Sun uses this RM/TCP/IP transport for passing
  595. RPC messages on TCP streams.
  596. One RPC message fits into one RM record.
  597. .LP
  598. A record is composed of one or more record fragments.
  599. A record fragment is a four-byte header followed by
  600. .I 0
  601. to
  602. .I "2\s-2\u31\d\s+2\-1"
  603. bytes of fragment data.
  604. The bytes encode an unsigned binary number;
  605. as with XDR integers, the byte order is from highest to lowest.
  606. The number encodes two values \(em
  607. a boolean which indicates whether the fragment is the last fragment
  608. of the record (bit value 1 implies the fragment is the last fragment)
  609. and a 31-bit unsigned binary value which is the length in bytes of the
  610. fragment's data.
  611. The boolean value is the highest-order bit of the header;
  612. the length is the 31 low-order bits.
  613. (Note that this record specification is
  614. .I not
  615. in XDR standard form!)
  616. .bp
  617. .SH
  618. .NH 0
  619. Appendix A: Port Mapper Program Protocol
  620. .LP
  621. The port mapper program maps RPC program and version numbers
  622. to UDP/IP or TCP/IP port numbers.
  623. This program makes dynamic binding of remote programs possible.
  624. .LP
  625. This is desirable because the range of reserved port numbers is very small
  626. and the number of potential remote programs is very large.  By running only
  627. the port mapper on a reserved port, the port numbers of other remote programs
  628. can be ascertained by querying the port mapper.
  629. .NH 2
  630. The RPC Protocol
  631. .LP
  632. The protocol is specified by the XDR description language.
  633. .LP
  634. .BS
  635. .LS
  636. Port Mapper RPC Program Number: 100000
  637.     Version Number: 1
  638.     Supported Transports:
  639.         UDP/IP on port 111
  640.         RM/TCP/IP on port 111
  641. .Lf
  642. .BE
  643. .NH 3
  644. Transport Protocol Numbers
  645. .BS
  646. .LS
  647. #define IPPROTO_TCP    6    /* protocol number for TCP/IP */
  648. #define IPPROTO_UDP    17    /* protocol number for UDP/IP */
  649. .Lf
  650. .BE
  651. .NH 3
  652. RPC Procedures
  653. .LP
  654. Here is a list of RPC procedures:
  655. .NE
  656. .NH 4
  657. Do Nothing
  658. .LP
  659. Procedure 0, Version 2.
  660. .BS
  661. .LS
  662. 0. PMAPPROC_NULL () returns ()
  663. .Lf
  664. .BE
  665. This procedure does no work.
  666. By convention, procedure zero of any protocol
  667. takes no parameters and returns no results.
  668. .NE
  669. .NH 4
  670. Set a Mapping
  671. .LP
  672. Procedure 1, Version 2.
  673. .BS
  674. .LS
  675. 1. PMAPPROC_SET (prog,vers,prot,port) returns (resp)
  676.     unsigned prog;
  677.     unsigned vers;
  678.     unsigned prot;
  679.     unsigned port;
  680.     boolean resp;
  681. .Lf
  682. .BE
  683. When a program first becomes available on a machine,
  684. it registers itself with the port mapper program on the same machine.
  685. The program passes its program number
  686. .LW prog ,
  687. version number
  688. .LW vers ,
  689. transport protocol number
  690. .LW prot ,
  691. and the port
  692. .LW port
  693. on which it awaits service request.
  694. The procedure returns
  695. .LW resp ,
  696. whose value is
  697. .LW TRUE
  698. if the procedure successfully established the mapping and
  699. .LW FALSE
  700. otherwise.  The procedure refuses to establish a mapping
  701. if one already exists for the tuple
  702. .LW [prog,vers,prot] .
  703. .NE
  704. .NH 4
  705. Unset a Mapping
  706. .LP
  707. Procedure 2, Version 2.
  708. .BS
  709. .LS
  710. 2. PMAPPROC_UNSET (prog,vers,dummy1,dummy2) returns (resp)
  711.     unsigned prog;
  712.     unsigned vers;
  713.     unsigned dummy1;  /* value always ignored */
  714.     unsigned dummy2;  /* value always ignored */
  715.     boolean resp;
  716. .Lf
  717. .BE
  718. When a program becomes unavailable, it should
  719. unregister itself with the port mapper program on the same machine.
  720. The parameters and results have meanings identical to those of
  721. .LW PMAPPROC_SET .
  722. .NE
  723. .NH 4
  724. Look Up a Mapping
  725. .LP
  726. Procedure 3, Version 2.
  727. .BS
  728. .LS
  729. 3. PMAPPROC_GETPORT (prog,vers,prot,dummy) returns (port)
  730.     unsigned prog;
  731.     unsigned vers;
  732.     unsigned prot;
  733.     unsigned dummy;    /* this value always ignored */
  734.     unsigned port;    /* zero means program not registered */
  735. .Lf
  736. .BE
  737. Given a program number
  738. .LW prog ,
  739. version number
  740. .LW vers ,
  741. and transport protocol number
  742. .LW prot ,
  743. this procedure returns the port number on which
  744. the program is awaiting call requests.
  745. A port value of zeros means the program has not been registered.
  746. .NE
  747. .NH 4
  748. Dumping the Mappings
  749. .LP
  750. Procedure 4, Version 2.
  751. .BS
  752. .LS
  753. 4. PMAPPROC_DUMP () returns (maplist)
  754.     struct maplist {
  755.         union switch (boolean) {
  756.             FALSE: struct { /* void, end of list */ };
  757.             TRUE: struct {
  758.                 unsigned prog;
  759.                 unsigned vers;
  760.                 unsigned prot;
  761.                 unsigned port;
  762.                 struct maplist the_rest;
  763.             };
  764.         };
  765.     } maplist;
  766. .Lf
  767. .BE
  768. This procedure enumerates all entries in the port mapper's database.
  769. The procedure takes no parameters and returns a list of
  770. program, version, protocol, and port values.
  771. .NE
  772. .NH 4
  773. Indirect Call Routine
  774. .LP
  775. Procedure 5, Version 2.
  776. .BS
  777. .LS
  778. 5. PMAPPROC_CALLIT (prog,vers,proc,args) returns (port,res)
  779.     unsigned prog;
  780.     unsigned vers;
  781.     unsigned proc;
  782.     string args<>;
  783.     unsigned port;
  784.     string res<>;
  785. .Lf
  786. .BE
  787. This procedure allows a caller to call another remote procedure
  788. on the same machine without knowing the remote procedure's port number.
  789. Its intended use is for supporting broadcasts
  790. to arbitrary remote programs via the well-known port mapper's port.
  791. The parameters
  792. .LW prog ,
  793. .LW vers ,
  794. .LW proc ,
  795. and the bytes of
  796. .LW args
  797. are the program number, version number, procedure number,
  798. and parameters of the remote procedure.
  799. Note:
  800. .IP 1.
  801. This procedure only sends a response if the procedure was
  802. successfully executed and is silent (no response) otherwise.
  803. .IP 2.
  804. The port mapper communicates with the remote program using UDP/IP only.
  805. .LP
  806. The procedure returns the remote program's port number,
  807. and the bytes of results are the results of the remote procedure.
  808.