DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
XDR/RPC protocol specification

The RPC language

Just as there was a need to describe the XDR data-types in a formal language, there is also need to describe the procedures that operate on these XDR data-types in a formal language as well. We use the RPC Language for this purpose. It is an extension to the XDR language. The following example specification of a simple ping program describes the essence of the language.

   /*
   * Simple ping program
   */
   program PING_PROG {
   	/* Latest and greatest version */
   	version PING_VERS_PINGBACK {
   		void
   		PINGPROC_NULL(void) = 0;
   

/* * Ping the caller, return the round-trip time * (in microseconds). Returns -1 if the operation * timed out. */ int PINGPROC_PINGBACK(void) = 1; } = 2;

/* * Original version */ version PING_VERS_ORIG { void PINGPROC_NULL(void) = 0; } = 1; } = 1; } = 200000;

const PING_VERS = 2; /* latest version */

The first version described is PING_VERS_PINGBACK with two procedures, PINGPROC_NULL and PINGPROC_PINGBACK.

PINGPROC_NULL takes no arguments and returns no results, but it is useful for such things as computing round-trip times from the client to the server and back again. By convention, procedure 0 of any RPC protocol should have the same semantics, and never require authentication.

The second procedure is used for the client to have the server do a reverse ping operation back to the client, and it returns the amount of time (in microseconds) that the operation used.

The next version, PING_VERS_ORIG, is the original version of the protocol and it does not contain PINGPROC_PINGBACK procedure. It is useful for compatibility with old client programs, and as this program matures it may be dropped from the protocol entirely.

The RPC language specification

The RPC language is identical to the XDR language, except for the added definitions described below.

program-definition:
	program program-ident {
		version-list
	} = value

version-list: version ; version ; version-list

version: version version-ident { procedure-list } = value

procedure-list: procedure ; procedure ; procedure-list

procedure: type-ident procedure-ident ( type-ident ) = value

Syntax notes

  1. The following keywords are added and cannot be used as identifiers:
       program	version
    

  2. A version name cannot occur more than once within the scope of a program definition. Nor can a version number occur more than once within the scope of a program definition.

  3. A procedure name cannot occur more than once within the scope of a version definition. Nor can a procedure number occur more than once within the scope of version definition.

  4. Program identifiers are in the same name space as constant and type identifiers.

  5. Only unsigned constants can be assigned to programs, versions and procedures.

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004