rfc1050.txt

来自「RFC 的详细文档!」· 文本 代码 · 共 1,347 行 · 第 1/4 页

TXT
1,347
字号






Network Working Group                             Sun Microsystems, Inc.
Request for Comments: 1050                        April 1988



                       RPC: Remote Procedure Call
                         Protocol Specification

STATUS OF THIS MEMO

   This RFC describes a standard that Sun Microsystems and others are
   using and is one we wish to propose for the Internet's consideration.
   This memo is not an Internet standard at this time.  Distribution of
   this memo is unlimited.

1. INTRODUCTION

   This document specifies a message protocol used in implementing Sun's
   Remote Procedure Call (RPC) package.  The message protocol is
   specified with the eXternal Data Representation (XDR) language [9].
   This document assumes that the reader is familiar with XDR.  It does
   not attempt to justify RPC or its uses.  The paper by Birrell and
   Nelson [1] is recommended as an excellent background to and
   justification of RPC.

2. TERMINOLOGY

   This document discusses servers, services, programs, procedures,
   clients, and versions.  A server is a piece of software where network
   services are implemented.  A network service is a collection of one
   or more remote programs.  A remote program implements one or more
   remote procedures; the procedures, their parameters, and results are
   documented in the specific program's protocol specification (see
   Appendix A for an example).  Network clients are pieces of software
   that initiate remote procedure calls to services.  A server may
   support more than one version of a remote program in order to be
   forward compatible with changing protocols.

   For example, a network file service may be composed of two programs.
   One program may deal with high-level applications such as file system
   access control and locking.  The other may deal with low-level file
   IO and have procedures like "read" and "write".  A client machine of
   the network file service would call the procedures associated with
   the two programs of the service on behalf of some user on the client
   machine.






Sun Microsystems, Inc.                                          [Page 1]

RFC 1050                 Remote Procedure Call                April 1988


3. THE RPC MODEL

   The remote procedure call model is similar to the local procedure
   call model.  In the local case, the caller places arguments to a
   procedure in some well-specified location (such as a result
   register).  It then transfers control to the procedure, and
   eventually gains back control.  At that point, the results of the
   procedure are extracted from the well-specified location, and the
   caller continues execution.

   The remote procedure call is similar, in that one thread of control
   logically winds through two processes -- one is the caller's process,
   the other is a server's process.  That is, the caller process sends a
   call message to the server process and waits (blocks) for a reply
   message.  The call message contains the procedure's parameters, among
   other things.  The reply message contains the procedure's results,
   among other things.  Once the reply message is received, the results
   of the procedure are extracted, and caller's execution is resumed.

   On the server side, a process is dormant awaiting the arrival of a
   call message.  When one arrives, the server process extracts the
   procedure's parameters, computes the results, sends a reply message,
   and then awaits the next call message.

   Note that in this model, only one of the two processes is active at
   any given time.  However, this model is only given as an example.
   The RPC protocol makes no restrictions on the concurrency model
   implemented, and others are possible.  For example, an implementation
   may choose to have RPC calls be asynchronous, so that the client may
   do useful work while waiting for the reply from the server.  Another
   possibility is to have the server create a task to process an
   incoming request, so that the server can be free to receive other
   requests.

4. TRANSPORTS AND SEMANTICS

   The RPC protocol is independent of transport protocols.  That is, RPC
   does not care how a message is passed from one process to another.
   The protocol deals only with specification and interpretation of
   messages.

   It is important to point out that RPC does not try to implement any
   kind of reliability and that the application must be aware of the
   type of transport protocol underneath RPC.  If it knows it is running
   on top of a reliable transport such as TCP/IP [6], then most of the
   work is already done for it.  On the other hand, if it is running on
   top of an unreliable transport such as UDP/IP [7], it must implement
   its own retransmission and time-out policy as the RPC layer does not



Sun Microsystems, Inc.                                          [Page 2]

RFC 1050                 Remote Procedure Call                April 1988


   provide this service.

   Because of transport independence, the RPC protocol does not attach
   specific semantics to the remote procedures or their execution.
   Semantics can be inferred from (but should be explicitly specified
   by) the underlying transport protocol.  For example, consider RPC
   running on top of an unreliable transport such as UDP/IP.  If an
   application retransmits RPC messages after short time-outs, the only
   thing it can infer if it receives no reply is that the procedure was
   executed zero or more times.  If it does receive a reply, then it can
   infer that the procedure was executed at least once.

   A server may wish to remember previously granted requests from a
   client and not regrant them in order to insure some degree of
   execute-at-most-once semantics.  A server can do this by taking
   advantage of the transaction ID that is packaged with every RPC
   request.  The main use of this transaction is by the client RPC layer
   in matching replies to requests.  However, a client application may
   choose to reuse its previous transaction ID when retransmitting a
   request.  The server application, knowing this fact, may choose to
   remember this ID after granting a request and not regrant requests
   with the same ID in order to achieve some degree of execute-at-most-
   once semantics.  The server is not allowed to examine this ID in any
   other way except as a test for equality.

   On the other hand, if using a reliable transport such as TCP/IP, the
   application can infer from a reply message that the procedure was
   executed exactly once, but if it receives no reply message, it cannot
   assume the remote procedure was not executed.  Note that even if a
   connection-oriented protocol like TCP is used, an application still
   needs time-outs and reconnection to handle server crashes.

   There are other possibilities for transports besides datagram- or
   connection-oriented protocols.  For example, a request-reply protocol
   such as VMTP [2] is perhaps the most natural transport for RPC.

   Note:  At Sun, RPC is currently implemented on top of both TCP/IP and
   UDP/IP transports.

5. BINDING AND RENDEZVOUS INDEPENDENCE

   The act of binding a client to a service is NOT part of the remote
   procedure call specification.  This important and necessary function
   is left up to some higher-level software.  (The software may use RPC
   itself; see Appendix A.)

   Implementors should think of the RPC protocol as the jump-subroutine
   instruction ("JSR") of a network; the loader (binder) makes JSR



Sun Microsystems, Inc.                                          [Page 3]

RFC 1050                 Remote Procedure Call                April 1988


   useful, and the loader itself uses JSR to accomplish its task.
   Likewise, the network makes RPC useful, using RPC to accomplish this
   task.

6. AUTHENTICATION

   The RPC protocol provides the fields necessary for a client to
   identify itself to a service and vice-versa.  Security and access
   control mechanisms can be built on top of the message authentication.
   Several different authentication protocols can be supported.  A field
   in the RPC header indicates which protocol is being used.  More
   information on specific authentication protocols is in section 9:
   "Authentication Protocols".

7. RPC PROTOCOL REQUIREMENTS

   The RPC protocol must provide for the following:

      (1) Unique specification of a procedure to be called.
      (2) Provisions for matching response messages to request messages.
      (3) Provisions for authenticating the caller to service and
          vice-versa.

   Besides these requirements, features that detect the following are
   worth supporting because of protocol roll-over errors, implementation
   bugs, user error, and network administration:

      (1) RPC protocol mismatches.
      (2) Remote program protocol version mismatches.
      (3) Protocol errors (such as misspecification of a procedure's
          parameters).
      (4) Reasons why remote authentication failed.
      (5) Any other reasons why the desired procedure was not called.

7.1 RPC Programs and Procedures

   The RPC call message has three unsigned fields:  remote program
   number, remote program version number, and remote procedure number.
   The three fields uniquely identify the procedure to be called.
   Program numbers are administered by some central authority (like
   Sun).  Once an implementor has a program number, he can implement his
   remote program; the first implementation would most likely have the
   version number of 1.  Because most new protocols evolve into better,
   stable, and mature protocols, a version field of the call message
   identifies which version of the protocol the caller is using.
   Version numbers make speaking old and new protocols through the same
   server process possible.




Sun Microsystems, Inc.                                          [Page 4]

RFC 1050                 Remote Procedure Call                April 1988


   The procedure number identifies the procedure to be called.  These
   numbers are documented in the specific program's protocol
   specification.  For example, a file service's protocol specification
   may state that its procedure number 5 is "read" and procedure number
   12 is "write".

   Just as remote program protocols may change over several versions,
   the actual RPC message protocol could also change.  Therefore, the
   call message also has in it the RPC version number, which is always
   equal to two for the version of RPC described here.

   The reply message to a request message has enough information to
   distinguish the following error conditions:

      (1) The remote implementation of RPC does speak protocol version 2.
          The lowest and highest supported RPC version numbers are
          returned.

      (2) The remote program is not available on the remote system.

      (3) The remote program does not support the requested version number.
          The lowest and highest supported remote program version numbers
          are returned.

      (4) The requested procedure number does not exist.  (This is usually
          a caller side protocol or programming error.)

      (5) The parameters to the remote procedure appear to be garbage
          from the server's point of view.  (Again, this is usually
          caused by a disagreement about the protocol between client
          and service.)




















Sun Microsystems, Inc.                                          [Page 5]

RFC 1050                 Remote Procedure Call                April 1988


7.2 Authentication

   Provisions for authentication of caller to service and vice-versa are
   provided as a part of the RPC protocol.  The call message has two
   authentication fields, the credentials and verifier.  The reply
   message has one authentication field, the response verifier.  The RPC
   protocol specification defines all three fields to be the following
   opaque type:

         enum auth_flavor {
            AUTH_NULL       = 0,
            AUTH_UNIX       = 1,
            AUTH_SHORT      = 2,
            AUTH_DES        = 3
            /* and more to be defined */
         };

         struct opaque_auth {
            auth_flavor flavor;
            opaque body<400>;
         };

   In simple English, any "opaque_auth" structure is an "auth_flavor"
   enumeration followed by bytes which are opaque to the RPC protocol
   implementation.

   The interpretation and semantics of the data contained within the
   authentication fields is specified by individual, independent
   authentication protocol specifications.  (Section 9 defines the
   various authentication protocols.)

   If authentication parameters were rejected, the response message
   contains information stating why they were rejected.

7.3 Program Number Assignment

   Program numbers are given out in groups of hexadecimal 20000000
   (decimal 536870912) according to the following chart:

                 0 - 1fffffff   defined by Sun
          20000000 - 3fffffff   defined by user
          40000000 - 5fffffff   transient
          60000000 - 7fffffff   reserved
          80000000 - 9fffffff   reserved
          a0000000 - bfffffff   reserved
          c0000000 - dfffffff   reserved
          e0000000 - ffffffff   reserved




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?