next up previous top
Next: RTLoad
Up: Player Type
Previous: RPCCall

RPCDef

Semantics

The player type RPCDef corresponds to an exported remote procedure definition in a component. It has a name and a signature. The name is the identifier used in the implementation of the remote procedure, and the signature describes the types of the arguments and the return type that the remote procedure has in the implementation. Remote procedure definitions are services defined within a Process or a SchedProcess component, and are made available (exported) to other processes or schedulable processes executing in the environment.

An RPCDef player describes a definition of a service that is accessed by a remote process. It does not describe a routine that can be called locally within a single process.

Component Types In

A player of type RPCDef can legally be defined in components of the following types:

Role Type
Associations

A player of type RPCDef can legally be associated with the following role type in a RemoteProcCall connection:

Properties

The following properties can be legally included in the property list of an RPCDef player:

The syntax for the MaxAssocs property in an RPCDef player is a single <integer> surrounded by parentheses:

MAXASSOCS (1)
The syntax for the MinAssocs property in an RPCDef player is a single <integer> surrounded by parentheses:

MINASSOCS (1)
The syntax for the Signature property in an RPCDef player consists of two fields, separated by a semicolon, surrounded by parentheses. Each of the fields is optional, yet one of them must be specified. The first field is a comma-separated list of items that are either <identifier>s or "string"s. The second field is a single <identifier> or "string". If the first field is omitted, the semicolon is required. If the second field is omitted, the semicolon must not be present:

SIGNATURE (int, "char *", double; "void")
SIGNATURE (int, "char *", double)
SIGNATURE (; "void")

Implementation Considerations

In the source code implementation, an RPCDef player is implemented as a normal procedure or function definition in the syntax of the given programming language (in this case C). The UniCon compiler generates the glue code to turn the routine into a remote procedure definition, and this remote procedure definition gets created at system construction time. The function or procedure definition must be at the outer-most scope of the enclosing compilation unit. It may also reference globally defined variables within the same compilation unit. The following are example function definitions in C that can be turned into remote procedure definitions:

  #include <stdio.h>
  #include <time.h>

  void timeget_Mach(int *get_time) {
      time(get_time); /* get the system time */
  }

  void timeshow(void) {
      int show_time;

      time(&show_time); /* get the system time */

      /* display the system time */
      fprintf(stdout, "Server: %s\n", ctime(&show_time));
  }

  int timeget_RPCGen(void) {
      int get_time;

      time(&get_time); /* get the system time */
      return get_time;
  }
NOTE: The UniCon compiler generates glue code that supports two forms of remote procedure calls: InterProcess Communication (IPC) calls on Mach platforms, and RPCGen-based remote procedure calls on SunOS platforms. The Mach IPC facility does not permit remote function definitions, only remote procedure definitions. Therefore, no remote procedure definition in a Mach application may return a value (i.e., all remote procedure definitions must look like definitions one and two in the example above). If results must be returned in a Mach application, they must be returned via the arguments in the argument list (as in definition number one, above).


next up previous top
Next: RTLoad
Up: Player Type
Previous: RPCCall

Comments? Mail the current maintainer of this page.

Author: Gregory Zelesnik

Last Modified: May 12, 1996