SunRPCRuntimeDoc.tioga
Copyright Ó 1987, 1990, 1992 by Xerox Corporation. All rights reserved.
Demers, November 9, 1987
Demers, November 9, 1987 4:02:53 pm PST
Michael Plass, May 11, 1990 3:56 pm PDT
Chauser, January 7, 1992 11:32 am PST
Sun RPC Runtime
PCEDAR2.0 —
Sun RPC Runtime
Runtime support for Sun RPC on UDP and NetworkStreams
A. Demers
© Copyright 1987, 1990 Xerox Corporation. All rights reserved.
Abstract: As the name suggests, SunRPCRuntime is a collection of (client and server) runtime support routines for RPC using the Sun protocols. Clients may choose to create UDP handles through the SunRPCOnUDP interface or TCP handles (actually NetworkStream handles) through the SunRPCOnNetworkStream interface. The created handles are then passed to procedures in SunRPC, itself, to do the work.
Created by: A. Demers
Maintained by: A. Demers <Demers.pa>
Keywords: Interoperability, Sun, RPC, UDP, TCP, NetworkStream
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

1. Impenetrable description
A number of Sun RPC remote programs are described in Sun documentation and elsewhere. We have client implementations for quite a few of them, and servers for a couple. They all have the following structure.
For remote program Blort there are Mesa interfaces Blort.mesa, BlortClient.mesa, and BlortServer.mesa. Blort.mesa consists of Mesa type definitions corresponding to the data types and procedures of Blort. BlortClient.mesa and BlortServer.mesa, which are identical except for their names, consist of procedure declarations using the types from Blort.mesa. Clients of Blort import from BlortClient.mesa; the server exports to BlortServer.mesa. A Mesa program BlortClientStub.mesa does serialization/deserialization on the client side. It exports to BlortClient.mesa and invokes the communication primitives defined in SunRPC.mesa. Another Mesa program, BlortServerStub.mesa, does serialization/deserialization on the server side. It registers itself with SunRPCOnUDP.mesa or SunRPCOnNetworkStream to be invoked when an RPC call is received, and imports from BlortServer.mesa.
This structure is a bit baroque, but please adhere to it. See Section 3 for info about automatically generating these files.
2. How to understand it, really ...
Look at an example. A reasonably straightforward client is the SunNFS client package on CedarChest. I don't yet have a good example of a server; there is a SunPMap server, but it's slightly nonstandard since it's the only SunRPC program that listens at a well-known UDP port.
Look at an example: the LocalRegistry package contains examples of both a client and a server using UDP transport.
3. cedarrpcgen (Marvin Theimer)
Look at /project/ubi/src/utils/cedarrpcgen/ (source) and /project/ubi/bin/cedarrpcgen (executable) for a Sun rpcgen-based stub generator using this runtime package.
4. A scheme stab at machine-generated stubs (Michael Plass)
Look at RPCGenerate.scheme, and Example.rpc. You may be able to figure it out. Or maybe not; be warned it needs some polishing to make it real. In particular, its outputs are partitioned and named differently than section 1 suggests; this inconsistency ought to be fixed.
Try this:

% Bringover -p /PCedar/Top/SunRPCRuntime-Source.df
Start: [PCedar]<Top>SunRPCRuntime-Source.df!7
[net]<palain>palain>plass>try>SunRPCRuntime-Source.df <-- [PCedar2.0]<Top>SunRPCRuntime-Source.df {11-May-90 15:54:00 PDT}
[net]<palain>palain>plass>try>Example.rpc <-- [PCedar2.0]<SunRPCRuntime>Example.rpc!1 {10-May-90 10:14:54 PDT}
[net]<palain>palain>plass>try>RPCGenerate.scheme <-- [PCedar2.0]<SunRPCRuntime>RPCGenerate.scheme!3 {11-May-90 14:35:45 PDT}
[net]<palain>palain>plass>try>RPCGenerate.$cheme <-- [PCedar2.0]<SunRPCRuntime>RPCGenerate.$cheme!1 {11-May-90 14:36:17 PDT}
End: [PCedar]<Top>SunRPCRuntime-Source.df!7
4 files acted upon
{ 20.75 sec }
% Scheme
(user) (load "RPCGenerate")
(cedarsunrpcgen)
(user) (cedarsunrpcgen "Example.rpc")
ExampleSunRPC.mesa ... ExampleXDRImpl.mesa ... ExampleSunRPCClientImpl.mesa ... ExampleSunRPCServerImpl.mesa ... #!unspecified
(user) (quit)
{ 43.19 sec }
%