home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1000s / rfc1057.txt < prev    next >
Text File  |  1988-06-23  |  51KB  |  1,398 lines

  1. Network Working Group                             Sun Microsystems, Inc.
  2. Request For Comments: 1057                                     June 1988
  3. Obsoletes: RFC 1050
  4.  
  5.  
  6.                        RPC: Remote Procedure Call
  7.                          Protocol Specification
  8.                                Version 2
  9.  
  10. STATUS OF THIS MEMO
  11.  
  12.    This RFC describes a standard that Sun Microsystems and others are
  13.    using, and is one we wish to propose for the Internet's
  14.    consideration.  This memo is not an Internet standard at this time.
  15.    Distribution of this memo is unlimited.
  16.  
  17. 1. INTRODUCTION
  18.  
  19.    This document specifies version two of the message protocol used in
  20.    Sun's Remote Procedure Call (RPC) package.  The message protocol is
  21.    specified with the eXternal Data Representation (XDR) language [9].
  22.    This document assumes that the reader is familiar with XDR.  It does
  23.    not attempt to justify remote procedure calls systems or describe
  24.    their use.  The paper by Birrell and Nelson [1] is recommended as an
  25.    excellent background for the remote procedure call concept.
  26.  
  27. 2. TERMINOLOGY
  28.  
  29.    This document discusses clients, calls, servers, replies, services,
  30.    programs, procedures, and versions.  Each remote procedure call has
  31.    two sides: an active client side that sends the call to a server,
  32.    which sends back a reply.  A network service is a collection of one
  33.    or more remote programs.  A remote program implements one or more
  34.    remote procedures; the procedures, their parameters, and results are
  35.    documented in the specific program's protocol specification (see
  36.    Appendix A for an example).  A server may support more than one
  37.    version of a remote program in order to be compatible with changing
  38.    protocols.
  39.  
  40.    For example, a network file service may be composed of two programs.
  41.    One program may deal with high-level applications such as file system
  42.    access control and locking.  The other may deal with low-level file
  43.    input and output and have procedures like "read" and "write".  A
  44.    client of the network file service would call the procedures
  45.    associated with the two programs of the service on behalf of the
  46.    client.
  47.  
  48.    The terms client and server only apply to a particular transaction; a
  49.  
  50.  
  51.  
  52. Sun Microsystems                                                [Page 1]
  53.  
  54. RFC 1057            Remote Procedure Call, Version 2           June 1988
  55.  
  56.  
  57.    particular hardware entity (host) or software entity (process or
  58.    program) could operate in both roles at different times.  For
  59.    example, a program that supplies remote execution service could also
  60.    be a client of a network file service.  On the other hand, it may
  61.    simplify software to separate client and server functionality into
  62.    separate libraries or programs.
  63.  
  64. 3. THE RPC MODEL
  65.  
  66.    The Sun RPC protocol is based on the remote procedure call model,
  67.    which is similar to the local procedure call model.  In the local
  68.    case, the caller places arguments to a procedure in some well-
  69.    specified location (such as a register window).  It then transfers
  70.    control to the procedure, and eventually regains control.  At that
  71.    point, the results of the procedure are extracted from the well-
  72.    specified location, and the caller continues execution.
  73.  
  74.    The remote procedure call model is similar.  One thread of control
  75.    logically winds through two processes: the caller's process, and a
  76.    server's process.  The caller process first sends a call message to
  77.    the server process and waits (blocks) for a reply message.  The call
  78.    message includes the procedure's parameters, and the reply message
  79.    includes the procedure's results.  Once the reply message is
  80.    received, the results of the procedure are extracted, and caller's
  81.    execution is resumed.
  82.  
  83.    On the server side, a process is dormant awaiting the arrival of a
  84.    call message.  When one arrives, the server process extracts the
  85.    procedure's parameters, computes the results, sends a reply message,
  86.    and then awaits the next call message.
  87.  
  88.    In this model, only one of the two processes is active at any given
  89.    time.  However, this model is only given as an example.  The Sun RPC
  90.    protocol makes no restrictions on the concurrency model implemented,
  91.    and others are possible.  For example, an implementation may choose
  92.    to have RPC calls be asynchronous, so that the client may do useful
  93.    work while waiting for the reply from the server.  Another
  94.    possibility is to have the server create a separate task to process
  95.    an incoming call, so that the original server can be free to receive
  96.    other requests.
  97.  
  98.    There are a few important ways in which remote procedure calls differ
  99.    from local procedure calls:
  100.  
  101.    1. Error handling: failures of the remote server or network must be
  102.    handled when using remote procedure calls.
  103.  
  104.    2. Global variables and side-effects: since the server does not have
  105.  
  106.  
  107.  
  108. Sun Microsystems                                                [Page 2]
  109.  
  110. RFC 1057            Remote Procedure Call, Version 2           June 1988
  111.  
  112.  
  113.    access to the client's address space, hidden arguments cannot be
  114.    passed as global variables or returned as side effects.
  115.  
  116.    3. Performance:  remote procedures usually operate one or more orders
  117.    of magnitude slower than local procedure calls.
  118.  
  119.    4. Authentication: since remote procedure calls can be transported
  120.    over insecure networks, authentication may be necessary.
  121.  
  122.    The conclusion is that even though there are tools to automatically
  123.    generate client and server libraries for a given service, protocols
  124.    must still be designed carefully.
  125.  
  126. 4. TRANSPORTS AND SEMANTICS
  127.  
  128.    The RPC protocol can be implemented on several different transport
  129.    protocols.  The RPC protocol does not care how a message is passed
  130.    from one process to another, but only with specification and
  131.    interpretation of messages.  On the other hand, the application may
  132.    wish to obtain information about (and perhaps control over) the
  133.    transport layer through an interface not specified in this document.
  134.    For example, the transport protocol may impose a restriction on the
  135.    maximum size of RPC messages, or it may be stream-oriented like TCP
  136.    with no size limit.  The client and server must agree on their
  137.    transport protocol choices, through a mechanism such as the one
  138.    described in Appendix A.
  139.  
  140.    It is important to point out that RPC does not try to implement any
  141.    kind of reliability and that the application may need to be aware of
  142.    the type of transport protocol underneath RPC.  If it knows it is
  143.    running on top of a reliable transport such as TCP [6], then most of
  144.    the work is already done for it.  On the other hand, if it is running
  145.    on top of an unreliable transport such as UDP [7], it must implement
  146.    its own time-out, retransmission, and duplicate detection policies as
  147.    the RPC layer does not provide these services.
  148.  
  149.    Because of transport independence, the RPC protocol does not attach
  150.    specific semantics to the remote procedures or their execution
  151.    requirements.  Semantics can be inferred from (but should be
  152.    explicitly specified by) the underlying transport protocol.  For
  153.    example, consider RPC running on top of an unreliable transport such
  154.    as UDP.  If an application retransmits RPC call messages after time-
  155.    outs, and does not receive a reply, it cannot infer anything about
  156.    the number of times the procedure was executed.  If it does receive a
  157.    reply, then it can infer that the procedure was executed at least
  158.    once.
  159.  
  160.    A server may wish to remember previously granted requests from a
  161.  
  162.  
  163.  
  164. Sun Microsystems                                                [Page 3]
  165.  
  166. RFC 1057            Remote Procedure Call, Version 2           June 1988
  167.  
  168.  
  169.    client and not regrant them in order to insure some degree of
  170.    execute-at-most-once semantics.  A server can do this by taking
  171.    advantage of the transaction ID that is packaged with every RPC
  172.    message.  The main use of this transaction is by the client RPC layer
  173.    in matching replies to calls.  However, a client application may
  174.    choose to reuse its previous transaction ID when retransmitting a
  175.    call.  The server may choose to remember this ID after executing a
  176.    call and not execute calls with the same ID in order to achieve some
  177.    degree of execute-at-most-once semantics.  The server is not allowed
  178.    to examine this ID in any other way except as a test for equality.
  179.  
  180.    On the other hand, if using a "reliable" transport such as TCP, the
  181.    application can infer from a reply message that the procedure was
  182.    executed exactly once, but if it receives no reply message, it cannot
  183.    assume the remote procedure was not executed.  Note that even if a
  184.    connection-oriented protocol like TCP is used, an application still
  185.    needs time-outs and reconnection to handle server crashes.
  186.  
  187.    There are other possibilities for transports besides datagram- or
  188.    connection-oriented protocols.  For example, a request-reply protocol
  189.    such as VMTP [2] is perhaps a natural transport for RPC.  The Sun RPC
  190.    package currently uses both TCP and UDP transport protocols, with
  191.    experimentation underway on others such as ISO TP4 and TP0.
  192.  
  193. 5. BINDING AND RENDEZVOUS INDEPENDENCE
  194.  
  195.    The act of binding a particular client to a particular service and
  196.    transport parameters is NOT part of this RPC protocol specification.
  197.    This important and necessary function is left up to some higher-level
  198.    software.  (The software may use RPC itself; see Appendix A.)
  199.  
  200.    Implementors could think of the RPC protocol as the jump-subroutine
  201.    instruction ("JSR") of a network; the loader (binder) makes JSR
  202.    useful, and the loader itself uses JSR to accomplish its task.
  203.    Likewise, the binding software makes RPC useful, possibly using RPC
  204.    to accomplish this task.
  205.  
  206. 6. AUTHENTICATION
  207.  
  208.    The RPC protocol provides the fields necessary for a client to
  209.    identify itself to a service, and vice-versa, in each call and reply
  210.    message.  Security and access control mechanisms can be built on top
  211.    of this message authentication.  Several different authentication
  212.    protocols can be supported.  A field in the RPC header indicates
  213.    which protocol is being used. More information on specific
  214.    authentication protocols is in section 9: "Authentication Protocols".
  215.  
  216.  
  217.  
  218.  
  219.  
  220. Sun Microsystems                                                [Page 4]
  221.  
  222. RFC 1057            Remote Procedure Call, Version 2           June 1988
  223.  
  224.  
  225. 7. RPC PROTOCOL REQUIREMENTS
  226.  
  227.    The RPC protocol must provide for the following:
  228.  
  229.    (1) Unique specification of a procedure to be called.
  230.    (2) Provisions for matching response messages to request messages.
  231.    (3) Provisions for authenticating the caller to service and vice-
  232.        versa.
  233.  
  234.    Besides these requirements, features that detect the following are
  235.    worth supporting because of protocol roll-over errors, implementation
  236.    bugs, user error, and network administration:
  237.  
  238.    (1) RPC protocol mismatches.
  239.    (2) Remote program protocol version mismatches.
  240.    (3) Protocol errors (such as misspecification of a procedure's
  241.        parameters).
  242.    (4) Reasons why remote authentication failed.
  243.    (5) Any other reasons why the desired procedure was not called.
  244.  
  245. 7.1 RPC Programs and Procedures
  246.  
  247.    The RPC call message has three unsigned integer fields -- remote
  248.    program number, remote program version number, and remote procedure
  249.    number -- which uniquely identify the procedure to be called.
  250.    Program numbers are administered by some central authority (like
  251.    Sun).  Once implementors have a program number, they can implement
  252.    their remote program; the first implementation would most likely have
  253.    the version number 1.  Because most new protocols evolve, a version
  254.    field of the call message identifies which version of the protocol
  255.    the caller is using.  Version numbers make speaking old and new
  256.    protocols through the same server process possible.
  257.  
  258.    The procedure number identifies the procedure to be called.  These
  259.    numbers are documented in the specific program's protocol
  260.    specification.  For example, a file service's protocol specification
  261.    may state that its procedure number 5 is "read" and procedure number
  262.    12 is "write".
  263.  
  264.    Just as remote program protocols may change over several versions,
  265.    the actual RPC message protocol could also change.  Therefore, the
  266.    call message also has in it the RPC version number, which is always
  267.    equal to two for the version of RPC described here.
  268.  
  269.    The reply message to a request message has enough information to
  270.    distinguish the following error conditions:
  271.  
  272.    (1) The remote implementation of RPC does not speak protocol version
  273.  
  274.  
  275.  
  276. Sun Microsystems                                                [Page 5]
  277.  
  278. RFC 1057            Remote Procedure Call, Version 2           June 1988
  279.  
  280.  
  281.    2. The lowest and highest supported RPC version numbers are returned.
  282.  
  283.    (2) The remote program is not available on the remote system.
  284.  
  285.    (3) The remote program does not support the requested version number.
  286.    The lowest and highest supported remote program version numbers are
  287.    returned.
  288.  
  289.    (4) The requested procedure number does not exist.  (This is usually
  290.    a client side protocol or programming error.)
  291.  
  292.    (5) The parameters to the remote procedure appear to be garbage from
  293.    the server's point of view.  (Again, this is usually caused by a
  294.    disagreement about the protocol between client and service.)
  295.  
  296. 7.2 Authentication
  297.  
  298.    Provisions for authentication of caller to service and vice-versa are
  299.    provided as a part of the RPC protocol.  The call message has two
  300.    authentication fields, the credentials and verifier.  The reply
  301.    message has one authentication field, the response verifier.  The RPC
  302.    protocol specification defines all three fields to be the following
  303.    opaque type (in the eXternal Data Representation (XDR) language [9]):
  304.  
  305.          enum auth_flavor {
  306.             AUTH_NULL       = 0,
  307.             AUTH_UNIX       = 1,
  308.             AUTH_SHORT      = 2,
  309.             AUTH_DES        = 3
  310.             /* and more to be defined */
  311.          };
  312.  
  313.          struct opaque_auth {
  314.             auth_flavor flavor;
  315.             opaque body<400>;
  316.          };
  317.  
  318.    In other words, any "opaque_auth" structure is an "auth_flavor"
  319.    enumeration followed by bytes which are opaque to (uninterpreted by)
  320.    the RPC protocol implementation.
  321.  
  322.    The interpretation and semantics of the data contained within the
  323.    authentication fields is specified by individual, independent
  324.    authentication protocol specifications.  (Section 9 defines the
  325.    various authentication protocols.)
  326.  
  327.    If authentication parameters were rejected, the reply message
  328.    contains information stating why they were rejected.
  329.  
  330.  
  331.  
  332. Sun Microsystems                                                [Page 6]
  333.  
  334. RFC 1057            Remote Procedure Call, Version 2           June 1988
  335.  
  336.  
  337. 7.3 Program Number Assignment
  338.  
  339.    Program numbers are given out in groups of hexadecimal 20000000
  340.    (decimal 536870912) according to the following chart:
  341.  
  342.                  0 - 1fffffff   defined by Sun
  343.           20000000 - 3fffffff   defined by user
  344.           40000000 - 5fffffff   transient
  345.           60000000 - 7fffffff   reserved
  346.           80000000 - 9fffffff   reserved
  347.           a0000000 - bfffffff   reserved
  348.           c0000000 - dfffffff   reserved
  349.           e0000000 - ffffffff   reserved
  350.  
  351.    The first group is a range of numbers administered by Sun
  352.    Microsystems and should be identical for all sites.  The second range
  353.    is for applications peculiar to a particular site.  This range is
  354.    intended primarily for debugging new programs.  When a site develops
  355.    an application that might be of general interest, that application
  356.    should be given an assigned number in the first range.  The third
  357.    group is for applications that generate program numbers dynamically.
  358.    The final groups are reserved for future use, and should not be used.
  359.  
  360. 7.4 Other Uses of the RPC Protocol
  361.  
  362.    The intended use of this protocol is for calling remote procedures.
  363.    Normally, each call message is matched with a reply message.
  364.    However, the protocol itself is a message-passing protocol with which
  365.    other (non-procedure call) protocols can be implemented.  Sun
  366.    currently uses, or perhaps abuses, the RPC message protocol for the
  367.    batching (or pipelining) and broadcast remote procedure calls.
  368.  
  369. 7.4.1 Batching
  370.  
  371.    Batching is useful when a client wishes to send an arbitrarily large
  372.    sequence of call messages to a server.  Batching typically uses
  373.    reliable byte stream protocols (like TCP) for its transport.  In the
  374.    case of batching, the client never waits for a reply from the server,
  375.    and the server does not send replies to batch calls.  A sequence of
  376.    batch calls is usually terminated by a legitimate remote procedure
  377.    call operation in order to flush the pipeline and get positive
  378.    acknowledgement.
  379.  
  380. 7.4.2 Broadcast Remote Procedure Calls
  381.  
  382.    In broadcast protocols, the client sends a broadcast call to the
  383.    network and waits for numerous replies.  This requires the use of
  384.    packet-based protocols (like UDP) as its transport protocol.  Servers
  385.  
  386.  
  387.  
  388. Sun Microsystems                                                [Page 7]
  389.  
  390. RFC 1057            Remote Procedure Call, Version 2           June 1988
  391.  
  392.  
  393.    that support broadcast protocols only respond when the call is
  394.    successfully processed, and are silent in the face of errors.
  395.    Broadcast calls use the Port Mapper RPC service to achieve their
  396.    semantics.  See Appendix A for more information.
  397.  
  398. 8. THE RPC MESSAGE PROTOCOL
  399.  
  400.    This section defines the RPC message protocol in the XDR data
  401.    description language [9].
  402.  
  403.          enum msg_type {
  404.             CALL  = 0,
  405.             REPLY = 1
  406.          };
  407.    A reply to a call message can take on two forms: The message was
  408.    either accepted or rejected.
  409.  
  410.          enum reply_stat {
  411.             MSG_ACCEPTED = 0,
  412.             MSG_DENIED   = 1
  413.          };
  414.  
  415.    Given that a call message was accepted, the following is the status
  416.    of an attempt to call a remote procedure.
  417.  
  418.          enum accept_stat {
  419.             SUCCESS       = 0, /* RPC executed successfully       */
  420.             PROG_UNAVAIL  = 1, /* remote hasn't exported program  */
  421.             PROG_MISMATCH = 2, /* remote can't support version #  */
  422.             PROC_UNAVAIL  = 3, /* program can't support procedure */
  423.             GARBAGE_ARGS  = 4  /* procedure can't decode params   */
  424.          };
  425.  
  426.    Reasons why a call message was rejected:
  427.  
  428.          enum reject_stat {
  429.             RPC_MISMATCH = 0, /* RPC version number != 2          */
  430.             AUTH_ERROR = 1    /* remote can't authenticate caller */
  431.          };
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444. Sun Microsystems                                                [Page 8]
  445.  
  446. RFC 1057            Remote Procedure Call, Version 2           June 1988
  447.  
  448.  
  449.    Why authentication failed:
  450.  
  451.          enum auth_stat {
  452.             AUTH_BADCRED      = 1,  /* bad credentials (seal broken) */
  453.             AUTH_REJECTEDCRED = 2,  /* client must begin new session */
  454.             AUTH_BADVERF      = 3,  /* bad verifier (seal broken)    */
  455.             AUTH_REJECTEDVERF = 4,  /* verifier expired or replayed  */
  456.             AUTH_TOOWEAK      = 5   /* rejected for security reasons */
  457.          };
  458.  
  459.    The RPC message:
  460.  
  461.    All messages start with a transaction identifier, xid, followed by a
  462.    two-armed discriminated union.  The union's discriminant is a
  463.    msg_type which switches to one of the two types of the message.  The
  464.    xid of a REPLY message always matches that of the initiating CALL
  465.    message.  NB: The xid field is only used for clients matching reply
  466.    messages with call messages or for servers detecting retransmissions;
  467.    the service side cannot treat this id as any type of sequence number.
  468.  
  469.          struct rpc_msg {
  470.             unsigned int xid;
  471.             union switch (msg_type mtype) {
  472.             case CALL:
  473.                call_body cbody;
  474.             case REPLY:
  475.                reply_body rbody;
  476.             } body;
  477.          };
  478.  
  479.    Body of an RPC call:
  480.  
  481.    In version 2 of the RPC protocol specification, rpcvers must be equal
  482.    to 2.  The fields prog, vers, and proc specify the remote program,
  483.    its version number, and the procedure within the remote program to be
  484.    called.  After these fields are two authentication parameters:  cred
  485.    (authentication credentials) and verf (authentication verifier).  The
  486.    two authentication parameters are followed by the parameters to the
  487.    remote procedure, which are specified by the specific program
  488.    protocol.
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500. Sun Microsystems                                                [Page 9]
  501.  
  502. RFC 1057            Remote Procedure Call, Version 2           June 1988
  503.  
  504.  
  505.          struct call_body {
  506.             unsigned int rpcvers;       /* must be equal to two (2) */
  507.             unsigned int prog;
  508.             unsigned int vers;
  509.             unsigned int proc;
  510.             opaque_auth cred;
  511.             opaque_auth verf;
  512.             /* procedure specific parameters start here */
  513.          };
  514.  
  515.    Body of a reply to an RPC call:
  516.  
  517.          union reply_body switch (reply_stat stat) {
  518.          case MSG_ACCEPTED:
  519.             accepted_reply areply;
  520.          case MSG_DENIED:
  521.             rejected_reply rreply;
  522.          } reply;
  523.  
  524.    Reply to an RPC call that was accepted by the server:
  525.  
  526.    There could be an error even though the call was accepted.  The first
  527.    field is an authentication verifier that the server generates in
  528.    order to validate itself to the client.  It is followed by a union
  529.    whose discriminant is an enum accept_stat.  The SUCCESS arm of the
  530.    union is protocol specific.  The PROG_UNAVAIL, PROC_UNAVAIL, and
  531.    GARBAGE_ARGS arms of the union are void.  The PROG_MISMATCH arm
  532.    specifies the lowest and highest version numbers of the remote
  533.    program supported by the server.
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556. Sun Microsystems                                               [Page 10]
  557.  
  558. RFC 1057            Remote Procedure Call, Version 2           June 1988
  559.  
  560.  
  561.          struct accepted_reply {
  562.             opaque_auth verf;
  563.             union switch (accept_stat stat) {
  564.             case SUCCESS:
  565.                opaque results[0];
  566.                /*
  567.                 * procedure-specific results start here
  568.                 */
  569.              case PROG_MISMATCH:
  570.                 struct {
  571.                    unsigned int low;
  572.                    unsigned int high;
  573.                 } mismatch_info;
  574.              default:
  575.                 /*
  576.                  * Void.  Cases include PROG_UNAVAIL, PROC_UNAVAIL,
  577.                  * and GARBAGE_ARGS.
  578.                  */
  579.                 void;
  580.              } reply_data;
  581.          };
  582.  
  583.    Reply to an RPC call that was rejected by the server:
  584.  
  585.    The call can be rejected for two reasons: either the server is not
  586.    running a compatible version of the RPC protocol (RPC_MISMATCH), or
  587.    the server refuses to authenticate the caller (AUTH_ERROR). In case
  588.    of an RPC version mismatch, the server returns the lowest and highest
  589.    supported RPC version numbers.  In case of refused authentication,
  590.    failure status is returned.
  591.  
  592.          union rejected_reply switch (reject_stat stat) {
  593.          case RPC_MISMATCH:
  594.             struct {
  595.                unsigned int low;
  596.                unsigned int high;
  597.             } mismatch_info;
  598.          case AUTH_ERROR:
  599.             auth_stat stat;
  600.          };
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612. Sun Microsystems                                               [Page 11]
  613.  
  614. RFC 1057            Remote Procedure Call, Version 2           June 1988
  615.  
  616.  
  617. 9. AUTHENTICATION PROTOCOLS
  618.  
  619.    As previously stated, authentication parameters are opaque, but
  620.    open-ended to the rest of the RPC protocol.  This section defines
  621.    some "flavors" of authentication implemented at (and supported by)
  622.    Sun.  Other sites are free to invent new authentication types, with
  623.    the same rules of flavor number assignment as there is for program
  624.    number assignment.
  625.  
  626. 9.1 Null Authentication
  627.  
  628.    Often calls must be made where the client does not know its identity
  629.    or the server does not care who the client is.  In this case, the
  630.    flavor value (the discriminant of the opaque_auth's union) of the RPC
  631.    message's credentials, verifier, and reply verifier is "AUTH_NULL".
  632.    The bytes of the opaque_auth's body are undefined.  It is recommended
  633.    that the opaque length be zero.
  634.  
  635. 9.2 UNIX Authentication
  636.  
  637.    The client may wish to identify itself as it is identified on a
  638.    UNIX(tm) system.  The value of the credential's discriminant of an
  639.    RPC call message is "AUTH_UNIX".  The bytes of the credential's
  640.    opaque body encode the the following structure:
  641.  
  642.          struct auth_unix {
  643.             unsigned int stamp;
  644.             string machinename<255>;
  645.             unsigned int uid;
  646.             unsigned int gid;
  647.             unsigned int gids<16>;
  648.          };
  649.  
  650.    The "stamp" is an arbitrary ID which the caller machine may generate.
  651.    The "machinename" is the name of the caller's machine (like
  652.    "krypton").  The "uid" is the caller's effective user ID.  The "gid"
  653.    is the caller's effective group ID.  The "gids" is a counted array of
  654.    groups which contain the caller as a member.  The verifier
  655.    accompanying the credentials should be of "AUTH_NULL" (defined
  656.    above).  Note these credentials are only unique within a particular
  657.    domain of machine names, uids, and gids.  Inter-domain naming is
  658.    beyond the scope of this document.
  659.  
  660.    The value of the discriminant of the reply verifier received in the
  661.    reply message from the server may be "AUTH_NULL" or "AUTH_SHORT".  In
  662.    the case of "AUTH_SHORT", the bytes of the reply verifier's string
  663.    encode an opaque structure.  This new opaque structure may now be
  664.    passed to the server instead of the original "AUTH_UNIX" flavor
  665.  
  666.  
  667.  
  668. Sun Microsystems                                               [Page 12]
  669.  
  670. RFC 1057            Remote Procedure Call, Version 2           June 1988
  671.  
  672.  
  673.    credentials.  The server may keep a cache which maps shorthand opaque
  674.    structures (passed back by way of an "AUTH_SHORT" style reply
  675.    verifier) to the original credentials of the caller.  The caller can
  676.    save network bandwidth and server cpu cycles by using the new
  677.    credentials.
  678.  
  679.    The server may flush the shorthand opaque structure at any time.  If
  680.    this happens, the remote procedure call message will be rejected due
  681.    to an authentication error.  The reason for the failure will be
  682.    "AUTH_REJECTEDCRED".  At this point, the client may wish to try the
  683.    original "AUTH_UNIX" style of credentials.
  684.  
  685. 9.3 DES Authentication
  686.  
  687.    UNIX authentication suffers from three major problems:
  688.  
  689.    (1) The naming is too UNIX oriented.
  690.    (2) There is no universal name, uid, and gid space.
  691.    (3) There is no verifier, so credentials can easily be faked.
  692.  
  693.    DES authentication attempts to address these problems.
  694.  
  695. 9.3.1 Naming
  696.  
  697.    The first problem is handled by addressing the client by a simple
  698.    string of characters instead of by an operating system specific
  699.    integer.  This string of characters is known as the "netname" or
  700.    network name of the client. The server is not allowed to interpret
  701.    the contents of the client's name in any other way except to identify
  702.    the client.  Thus, netnames should be unique for every client in the
  703.    Internet.
  704.  
  705.    It is up to each operating system's implementation of DES
  706.    authentication to generate netnames for its users that insure this
  707.    uniqueness when they call upon remote servers.  Operating systems
  708.    already know how to distinguish users local to their systems. It is
  709.    usually a simple matter to extend this mechanism to the network.  For
  710.    example, a UNIX user at Sun with a user ID of 515 might be assigned
  711.    the following netname: "unix.515@sun.com".  This netname contains
  712.    three items that serve to insure it is unique.  Going backwards,
  713.    there is only one naming domain called "sun.com" in the Internet.
  714.    Within this domain, there is only one UNIX user with user ID 515.
  715.    However, there may be another user on another operating system, for
  716.    example VMS, within the same naming domain that, by coincidence,
  717.    happens to have the same user ID. To insure that these two users can
  718.    be distinguished we add the operating system name. So one user is
  719.    "unix.515@sun.com" and the other is "vms.515@sun.com".
  720.  
  721.  
  722.  
  723.  
  724. Sun Microsystems                                               [Page 13]
  725.  
  726. RFC 1057            Remote Procedure Call, Version 2           June 1988
  727.  
  728.  
  729.    The first field is actually a naming method rather than an operating
  730.    system name.  It happens that today there is almost a one-to-one
  731.    correspondence between naming methods and operating systems.  If the
  732.    world could agree on a naming standard, the first field could be the
  733.    name of that standard, instead of an operating system name.
  734.  
  735. 9.3.2 DES Authentication Verifiers
  736.  
  737.    Unlike UNIX authentication, DES authentication does have a verifier
  738.    so the server can validate the client's credential (and vice-versa).
  739.    The contents of this verifier is primarily an encrypted timestamp.
  740.    The server can decrypt this timestamp, and if it is close to the real
  741.    time, then the client must have encrypted it correctly.  The only way
  742.    the client could encrypt it correctly is to know the "conversation
  743.    key" of the RPC session. And if the client knows the conversation
  744.    key, then it must be the real client.
  745.  
  746.    The conversation key is a DES [5] key which the client generates and
  747.    passes to the server in its first RPC call.  The conversation key is
  748.    encrypted using a public key scheme in this first transaction.  The
  749.    particular public key scheme used in DES authentication is Diffie-
  750.    Hellman [3] with 192-bit keys.  The details of this encryption method
  751.    are described later.
  752.  
  753.    The client and the server need the same notion of the current time in
  754.    order for all of this to work, perhaps by using the Network Time
  755.    Protocol [4].  If network time synchronization cannot be guaranteed,
  756.    then the client can determine the server's time before beginning the
  757.    conversation using a simpler time request protocol.
  758.  
  759.    The way a server determines if a client timestamp is valid is
  760.    somewhat complicated. For any other transaction but the first, the
  761.    server just checks for two things:
  762.  
  763.    (1) the timestamp is greater than the one  previously seen from the
  764.    same client.
  765.    (2) the timestamp has not expired.
  766.  
  767.    A timestamp is expired if the server's time is later than the sum of
  768.    the client's timestamp plus what is known as the client's "window".
  769.    The "window" is a number the client passes (encrypted) to the server
  770.    in its first transaction.  You can think of it as a lifetime for the
  771.    credential.
  772.  
  773.    This explains everything but the first transaction.  In the first
  774.    transaction, the server checks only that the timestamp has not
  775.    expired.  If this was all that was done though, then it would be
  776.    quite easy for the client to send random data in place of the
  777.  
  778.  
  779.  
  780. Sun Microsystems                                               [Page 14]
  781.  
  782. RFC 1057            Remote Procedure Call, Version 2           June 1988
  783.  
  784.  
  785.    timestamp with a fairly good chance of succeeding.  As an added
  786.    check, the client sends an encrypted item in the first transaction
  787.    known as the "window verifier" which must be equal to the window
  788.    minus 1, or the server will reject the credential.
  789.  
  790.    The client too must check the verifier returned from the server to be
  791.    sure it is legitimate.  The server sends back to the client the
  792.    encrypted timestamp it received from the client, minus one second.
  793.    If the client gets anything different than this, it will reject it.
  794.  
  795. 9.3.3 Nicknames and Clock Synchronization
  796.  
  797.    After the first transaction, the server's DES authentication
  798.    subsystem returns in its verifier to the client an integer "nickname"
  799.    which the client may use in its further transactions instead of
  800.    passing its netname, encrypted DES key and window every time. The
  801.    nickname is most likely an index into a table on the server which
  802.    stores for each client its netname, decrypted DES key and window.
  803.  
  804.    Though they originally were synchronized, the client's and server's
  805.    clocks can get out of sync again.  When this happens the client RPC
  806.    subsystem most likely will get back "RPC_AUTHERROR" at which point it
  807.    should resynchronize.
  808.  
  809.    A client may still get the "RPC_AUTHERROR" error even though it is
  810.    synchronized with the server.  The reason is that the server's
  811.    nickname table is a limited size, and it may flush entries whenever
  812.    it wants.  A client should resend its original credential in this
  813.    case and the server will give it a new nickname.  If a server
  814.    crashes, the entire nickname table gets flushed, and all clients will
  815.    have to resend their original credentials.
  816.  
  817. 9.3.4 DES Authentication Protocol Specification
  818.  
  819.    There are two kinds of credentials: one in which the client uses its
  820.    full network name, and one in which it uses its "nickname" (just an
  821.    unsigned integer) given to it by the server.  The client must use its
  822.    fullname in its first transaction with the server, in which the
  823.    server will return to the client its nickname.  The client may use
  824.    its nickname in all further transactions with the server. There is no
  825.    requirement to use the nickname, but it is wise to use it for
  826.    performance reasons.
  827.  
  828.       enum authdes_namekind {
  829.          ADN_FULLNAME = 0,
  830.          ADN_NICKNAME = 1
  831.       };
  832.  
  833.  
  834.  
  835.  
  836. Sun Microsystems                                               [Page 15]
  837.  
  838. RFC 1057            Remote Procedure Call, Version 2           June 1988
  839.  
  840.  
  841.    A 64-bit block of encrypted DES data:
  842.  
  843.    typedef opaque des_block[8];
  844.  
  845.    Maximum length of a network user's name:
  846.  
  847.    const MAXNETNAMELEN = 255;
  848.  
  849.    A fullname contains the network name of the client, an encrypted
  850.    conversation key and the window. The window is actually a lifetime
  851.    for the credential.  If the time indicated in the verifier timestamp
  852.    plus the window has past, then the server should expire the request
  853.    and not grant it.  To insure that requests are not replayed, the
  854.    server should insist that timestamps are greater than the previous
  855.    one seen, unless it is the first transaction.  In the first
  856.    transaction, the server checks instead that the window verifier is
  857.    one less than the window.
  858.  
  859.    struct authdes_fullname {
  860.       string name<MAXNETNAMELEN>;  /* name of client                */
  861.       des_block key;               /* PK encrypted conversation key */
  862.       opaque window[4];            /* encrypted window              */
  863.    };
  864.  
  865.    A credential is either a fullname or a nickname:
  866.  
  867.    union authdes_cred switch (authdes_namekind adc_namekind) {
  868.    case ADN_FULLNAME:
  869.       authdes_fullname adc_fullname;
  870.    case ADN_NICKNAME:
  871.       int adc_nickname;
  872.    };
  873.  
  874.    A timestamp encodes the time since midnight,   March 1, 1970.
  875.  
  876.    struct timestamp {
  877.       unsigned int seconds;    /* seconds          */
  878.       unsigned int useconds;   /* and microseconds */
  879.    };
  880.  
  881.    Verifier: client variety.
  882.  
  883.    The window verifier is only used in the first transaction.  In
  884.    conjunction with a fullname credential, these items are packed into
  885.    the following structure before being encrypted:
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892. Sun Microsystems                                               [Page 16]
  893.  
  894. RFC 1057            Remote Procedure Call, Version 2           June 1988
  895.  
  896.  
  897.    struct {
  898.        adv_timestamp;        -- one DES block
  899.        adc_fullname.window;  -- one half DES block
  900.        adv_winverf;          -- one half DES block
  901.    }
  902.  
  903.    This structure is encrypted using CBC mode encryption with an input
  904.    vector of zero.  All other encryptions of timestamps use ECB mode
  905.    encryption.
  906.  
  907.    struct authdes_verf_clnt {
  908.       des_block adv_timestamp;    /* encrypted timestamp       */
  909.       opaque adv_winverf[4];      /* encrypted window verifier */
  910.    };
  911.  
  912.       Verifier: server variety.
  913.  
  914.    The server returns (encrypted) the same timestamp the client gave it
  915.    minus one second.  It also tells the client its nickname to be used
  916.    in future transactions (unencrypted).
  917.  
  918.    struct authdes_verf_svr {
  919.       des_block adv_timeverf;     /* encrypted verifier      */
  920.       int adv_nickname;      /* new nickname for client */
  921.    };
  922.  
  923. 9.3.5 Diffie-Hellman Encryption
  924.  
  925.    In this scheme, there are two constants "BASE" and "MODULUS" [3].
  926.    The particular values Sun has chosen for these for the DES
  927.    authentication protocol are:
  928.  
  929.    const BASE = 3;
  930.    const MODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
  931.  
  932.    The way this scheme works is best explained by an example.  Suppose
  933.    there are two people "A" and "B" who want to send encrypted messages
  934.    to each other.  So, A and B both generate "secret" keys at random
  935.    which they do not reveal to anyone.  Let these keys be represented as
  936.    SK(A) and SK(B).  They also publish in a public directory their
  937.    "public" keys. These keys are computed as follows:
  938.  
  939.          PK(A) = ( BASE ** SK(A) ) mod MODULUS
  940.          PK(B) = ( BASE ** SK(B) ) mod MODULUS
  941.  
  942.    The "**" notation is used here to represent exponentiation. Now, both
  943.    A and B can arrive at the "common" key between them, represented here
  944.    as CK(A, B), without revealing their secret keys.
  945.  
  946.  
  947.  
  948. Sun Microsystems                                               [Page 17]
  949.  
  950. RFC 1057            Remote Procedure Call, Version 2           June 1988
  951.  
  952.  
  953.    A computes:
  954.  
  955.       CK(A, B) = ( PK(B) ** SK(A)) mod MODULUS
  956.  
  957.    while B computes:
  958.  
  959.       CK(A, B) = ( PK(A) ** SK(B)) mod MODULUS
  960.  
  961.    These two can be shown to be equivalent:
  962.  
  963.       (PK(B) ** SK(A)) mod MODULUS = (PK(A) ** SK(B)) mod MODULUS
  964.  
  965.    We drop the "mod MODULUS" parts and assume modulo arithmetic to
  966.    simplify things:
  967.  
  968.       PK(B) ** SK(A) = PK(A) ** SK(B)
  969.  
  970.    Then, replace PK(B) by what B computed earlier and likewise for PK(A).
  971.  
  972.       ((BASE ** SK(B)) ** SK(A) = (BASE ** SK(A)) ** SK(B)
  973.  
  974.    which leads to:
  975.  
  976.       BASE ** (SK(A) * SK(B)) = BASE ** (SK(A) * SK(B))
  977.  
  978.    This common key CK(A, B) is not used to encrypt the timestamps used
  979.    in the protocol. Rather, it is used only to encrypt a conversation
  980.    key which is then used to encrypt the timestamps.  The reason for
  981.    doing this is to use the common key as little as possible, for fear
  982.    that it could be broken.  Breaking the conversation key is a far less
  983.    serious offense, since conversations are relatively short-lived.
  984.  
  985.    The conversation key is encrypted using 56-bit DES keys, yet the
  986.    common key is 192 bits.  To reduce the number of bits, 56 bits are
  987.    selected from the common key as follows. The middle-most 8-bytes are
  988.    selected from the common key, and then parity is added to the lower
  989.    order bit of each byte, producing a 56-bit key with 8 bits of parity.
  990.  
  991. 10. RECORD MARKING STANDARD
  992.  
  993.    When RPC messages are passed on top of a byte stream transport
  994.    protocol (like TCP), it is necessary to delimit one message from
  995.    another in order to detect and possibly recover from protocol errors.
  996.    This is called record marking (RM).  Sun uses this RM/TCP/IP
  997.    transport for passing RPC messages on TCP streams.  One RPC message
  998.    fits into one RM record.
  999.  
  1000.    A record is composed of one or more record fragments.  A record
  1001.  
  1002.  
  1003.  
  1004. Sun Microsystems                                               [Page 18]
  1005.  
  1006. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1007.  
  1008.  
  1009.    fragment is a four-byte header followed by 0 to (2**31) - 1 bytes of
  1010.    fragment data.  The bytes encode an unsigned binary number; as with
  1011.    XDR integers, the byte order is from highest to lowest.  The number
  1012.    encodes two values -- a boolean which indicates whether the fragment
  1013.    is the last fragment of the record (bit value 1 implies the fragment
  1014.    is the last fragment) and a 31-bit unsigned binary value which is the
  1015.    length in bytes of the fragment's data.  The boolean value is the
  1016.    highest-order bit of the header; the length is the 31 low-order bits.
  1017.    (Note that this record specification is NOT in XDR standard form!)
  1018.  
  1019. 11. THE RPC LANGUAGE
  1020.  
  1021.    Just as there was a need to describe the XDR data-types in a formal
  1022.    language, there is also need to describe the procedures that operate
  1023.    on these XDR data-types in a formal language as well.  The RPC
  1024.    Language is an extension to the XDR language, with the addition of
  1025.    "program", "procedure", and "version" declarations.  The following
  1026.    example is used to describe the essence of the language.
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Sun Microsystems                                               [Page 19]
  1061.  
  1062. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1063.  
  1064.  
  1065. 11.1 An Example Service Described in the RPC Language
  1066.  
  1067.    Here is an example of the specification of a simple ping program.
  1068.  
  1069.       program PING_PROG {
  1070.             /*
  1071.              * Latest and greatest version
  1072.              */
  1073.             version PING_VERS_PINGBACK {
  1074.                void
  1075.                PINGPROC_NULL(void) = 0;
  1076.  
  1077.                /*
  1078.                 * Ping the client, return the round-trip time
  1079.                 * (in microseconds). Returns -1 if the operation
  1080.                 * timed out.
  1081.                 */
  1082.                int
  1083.                PINGPROC_PINGBACK(void) = 1;
  1084.             } = 2;
  1085.  
  1086.             /*
  1087.              * Original version
  1088.              */
  1089.             version PING_VERS_ORIG {
  1090.                void
  1091.                PINGPROC_NULL(void) = 0;
  1092.             } = 1;
  1093.          } = 1;
  1094.  
  1095.          const PING_VERS = 2;      /* latest version */
  1096.  
  1097.    The first version described is PING_VERS_PINGBACK with two
  1098.    procedures, PINGPROC_NULL and PINGPROC_PINGBACK.  PINGPROC_NULL takes
  1099.    no arguments and returns no results, but it is useful for computing
  1100.    round-trip times from the client to the server and back again.  By
  1101.    convention, procedure 0 of any RPC protocol should have the same
  1102.    semantics, and never require any kind of authentication.  The second
  1103.    procedure is used for the client to have the server do a reverse ping
  1104.    operation back to the client, and it returns the amount of time (in
  1105.    microseconds) that the operation used.  The next version,
  1106.    PING_VERS_ORIG, is the original version of the protocol and it does
  1107.    not contain PINGPROC_PINGBACK procedure. It is useful for
  1108.    compatibility with old client programs, and as this program matures
  1109.    it may be dropped from the protocol entirely.
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116. Sun Microsystems                                               [Page 20]
  1117.  
  1118. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1119.  
  1120.  
  1121. 11.2 The RPC Language Specification
  1122.  
  1123.    The RPC language is identical to the XDR language defined in RFC
  1124.    1014, except for the added definition of a "program-def" described
  1125.    below.
  1126.  
  1127.    program-def:
  1128.       "program" identifier "{"
  1129.          version-def
  1130.          version-def *
  1131.       "}" "=" constant ";"
  1132.  
  1133.    version-def:
  1134.       "version" identifier "{"
  1135.           procedure-def
  1136.           procedure-def *
  1137.       "}" "=" constant ";"
  1138.  
  1139.    procedure-def:
  1140.       type-specifier identifier "(" type-specifier
  1141.         ("," type-specifier )* ")" "=" constant ";"
  1142.  
  1143. 11.3 Syntax Notes
  1144.  
  1145.    (1) The following keywords are added and cannot be used as
  1146.    identifiers: "program" and "version";
  1147.  
  1148.    (2) A version name cannot occur more than once within the scope of a
  1149.    program definition. Nor can a version number occur more than once
  1150.    within the scope of a program definition.
  1151.  
  1152.    (3) A procedure name cannot occur more than once within the scope of
  1153.    a version definition. Nor can a procedure number occur more than once
  1154.    within the scope of version definition.
  1155.  
  1156.    (4) Program identifiers are in the same name space as constant and
  1157.    type identifiers.
  1158.  
  1159.    (5) Only unsigned constants can be assigned to programs, versions and
  1160.    procedures.
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172. Sun Microsystems                                               [Page 21]
  1173.  
  1174. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1175.  
  1176.  
  1177. APPENDIX A: PORT MAPPER PROGRAM PROTOCOL
  1178.  
  1179.    The port mapper program maps RPC program and version numbers to
  1180.    transport-specific port numbers.  This program makes dynamic binding
  1181.    of remote programs possible.
  1182.  
  1183.    This is desirable because the range of reserved port numbers is very
  1184.    small and the number of potential remote programs is very large.  By
  1185.    running only the port mapper on a reserved port, the port numbers of
  1186.    other remote programs can be ascertained by querying the port mapper.
  1187.  
  1188.    The port mapper also aids in broadcast RPC.  A given RPC program will
  1189.    usually have different port number bindings on different machines, so
  1190.    there is no way to directly broadcast to all of these programs. The
  1191.    port mapper, however, does have a fixed port number.  So, to
  1192.    broadcast to a given program, the client actually sends its message
  1193.    to the port mapper located at the broadcast address. Each port mapper
  1194.    that picks up the broadcast then calls the local service specified by
  1195.    the client.  When the port mapper gets the reply from the local
  1196.    service, it sends the reply on back to the client.
  1197.  
  1198. A.1 Port Mapper Protocol Specification (in RPC Language)
  1199.  
  1200.          const PMAP_PORT = 111;      /* portmapper port number */
  1201.  
  1202.    A mapping of (program, version, protocol) to port number:
  1203.  
  1204.          struct mapping {
  1205.             unsigned int prog;
  1206.             unsigned int vers;
  1207.             unsigned int prot;
  1208.             unsigned int port;
  1209.          };
  1210.  
  1211.    Supported values for the "prot" field:
  1212.  
  1213.          const IPPROTO_TCP = 6;      /* protocol number for TCP/IP */
  1214.          const IPPROTO_UDP = 17;     /* protocol number for UDP/IP */
  1215.  
  1216.    A list of mappings:
  1217.  
  1218.          struct *pmaplist {
  1219.             mapping map;
  1220.             pmaplist next;
  1221.          };
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228. Sun Microsystems                                               [Page 22]
  1229.  
  1230. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1231.  
  1232.  
  1233.    Arguments to callit:
  1234.  
  1235.          struct call_args {
  1236.             unsigned int prog;
  1237.             unsigned int vers;
  1238.             unsigned int proc;
  1239.             opaque args<>;
  1240.          };
  1241.  
  1242.    Results of callit:
  1243.  
  1244.          struct call_result {
  1245.             unsigned int port;
  1246.             opaque res<>;
  1247.          };
  1248.  
  1249.    Port mapper procedures:
  1250.  
  1251.          program PMAP_PROG {
  1252.             version PMAP_VERS {
  1253.                void
  1254.                PMAPPROC_NULL(void)         = 0;
  1255.  
  1256.                bool
  1257.                PMAPPROC_SET(mapping)       = 1;
  1258.  
  1259.                bool
  1260.                PMAPPROC_UNSET(mapping)     = 2;
  1261.  
  1262.                unsigned int
  1263.                PMAPPROC_GETPORT(mapping)   = 3;
  1264.  
  1265.                pmaplist
  1266.                PMAPPROC_DUMP(void)         = 4;
  1267.  
  1268.                call_result
  1269.                PMAPPROC_CALLIT(call_args)  = 5;
  1270.             } = 2;
  1271.          } = 100000;
  1272.  
  1273. A.2 Port Mapper Operation
  1274.  
  1275.    The portmapper program currently supports two protocols (UDP and
  1276.    TCP).  The portmapper is contacted by talking to it on assigned port
  1277.    number 111 (SUNRPC) on either of these protocols.
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284. Sun Microsystems                                               [Page 23]
  1285.  
  1286. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1287.  
  1288.  
  1289.    The following is a description of each of the portmapper procedures:
  1290.  
  1291.    PMAPPROC_NULL:
  1292.  
  1293.    This procedure does no work.  By convention, procedure zero of any
  1294.    protocol takes no parameters and returns no results.
  1295.  
  1296.    PMAPPROC_SET:
  1297.  
  1298.    When a program first becomes available on a machine, it registers
  1299.    itself with the port mapper program on the same machine.  The program
  1300.    passes its program number "prog", version number "vers", transport
  1301.    protocol number "prot", and the port "port" on which it awaits
  1302.    service request.  The procedure returns a boolean reply whose value
  1303.    is "TRUE" if the procedure successfully established the mapping and
  1304.    "FALSE" otherwise.  The procedure refuses to establish a mapping if
  1305.    one already exists for the tuple "(prog, vers, prot)".
  1306.  
  1307.    PMAPPROC_UNSET:
  1308.  
  1309.    When a program becomes unavailable, it should unregister itself with
  1310.    the port mapper program on the same machine.  The parameters and
  1311.    results have meanings identical to those of "PMAPPROC_SET".  The
  1312.    protocol and port number fields of the argument are ignored.
  1313.  
  1314.    PMAPPROC_GETPORT:
  1315.  
  1316.    Given a program number "prog", version number "vers", and transport
  1317.    protocol number "prot", this procedure returns the port number on
  1318.    which the program is awaiting call requests.  A port value of zeros
  1319.    means the program has not been registered.  The "port" field of the
  1320.    argument is ignored.
  1321.  
  1322.    PMAPPROC_DUMP:
  1323.  
  1324.    This procedure enumerates all entries in the port mapper's database.
  1325.    The procedure takes no parameters and returns a list of program,
  1326.    version, protocol, and port values.
  1327.  
  1328.    PMAPPROC_CALLIT:
  1329.  
  1330.    This procedure allows a client to call another remote procedure on
  1331.    the same machine without knowing the remote procedure's port number.
  1332.    It is intended for supporting broadcasts to arbitrary remote programs
  1333.    via the well-known port mapper's port.  The parameters "prog",
  1334.    "vers", "proc", and the bytes of "args" are the program number,
  1335.    version number, procedure number, and parameters of the remote
  1336.    procedure.  Note:
  1337.  
  1338.  
  1339.  
  1340. Sun Microsystems                                               [Page 24]
  1341.  
  1342. RFC 1057            Remote Procedure Call, Version 2           June 1988
  1343.  
  1344.  
  1345.    (1) This procedure only sends a reply if the procedure was
  1346.    successfully executed and is silent (no reply) otherwise.
  1347.  
  1348.    (2) The port mapper communicates with the remote program using UDP
  1349.    only.
  1350.  
  1351.    The procedure returns the remote program's port number, and the reply
  1352.    is the reply of the remote procedure.
  1353.  
  1354. REFERENCES
  1355.  
  1356.    [1] Birrell, A. D.  & Nelson, B. J., "Implementing Remote Procedure
  1357.        Calls", XEROX CSL-83-7, October 1983.
  1358.  
  1359.    [2] Cheriton, D., "VMTP: Versatile Message Transaction Protocol",
  1360.        Preliminary Version 0.3, Stanford University, January 1987.
  1361.  
  1362.    [3] Diffie & Hellman, "New Directions in Cryptography", IEEE
  1363.        Transactions on Information Theory IT-22, November 1976.
  1364.  
  1365.    [4] Mills, D., "Network Time Protocol", RFC-958, M/A-COM Linkabit,
  1366.        September 1985.
  1367.  
  1368.    [5] National Bureau of Standards, "Data Encryption Standard", Federal
  1369.        Information Processing Standards Publication 46, January 1977.
  1370.  
  1371.    [6] Postel, J., "Transmission Control Protocol - DARPA Internet
  1372.        Program Protocol Specification", RFC-793, Information Sciences
  1373.        Institute, September 1981.
  1374.  
  1375.    [7] Postel, J., "User Datagram Protocol", RFC-768, Information
  1376.        Sciences Institute, August 1980.
  1377.  
  1378.    [8] Reynolds, J., and Postel, J., "Assigned Numbers", RFC-1010,
  1379.        Information Sciences Institute, May 1987.
  1380.  
  1381.    [9] Sun Microsystems, "XDR: External Data Representation Standard",
  1382.        RFC-1014, June 1987.
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396. Sun Microsystems                                               [Page 25]
  1397.  
  1398.