SRPCCalls.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Pier, May 24, 1990 2:37:57 pm PDT
Swinehart, September 17, 1990 2:39:23 pm PDT
DIRECTORY
Basics,
Rope USING [ ROPE ],
SunRPC USING [ Handle, GetCard32, PutCard32, ServerProc ],
RPC USING [ Conversation ]
;
RPC Call Management
Error:
ERROR[errCode:
ATOM, explanation:
ROPE¬
NIL];
-- Some communications failures are handled automatically at this level; these are not.
SunRPCPutArgsProc: TYPE ~ PROC [h: Handle];
SunRPCGetResultsProc: TYPE ~ PROC [h: Handle];
SunRPCGetErrorProc: TYPE ~ PROC [h: Handle];
SunRPCGetBool:
PROC [h: Handle]
RETURNS [
BOOL] ~
INLINE {
RETURN [SunRPC.GetCard32[h] # 0] };
Generic conversion routine, needed often by stubs.
SunRPCPutBool:
PROC [h: Handle, bool:
BOOL] ~
INLINE {
SunRPC.PutCard32[h, IF bool THEN 1 ELSE 0] };
Generic conversion routine, needed often by stubs.
SunRPCProgramCall:
PROC [h: Handle, remoteProc:
CARD,
putArgs: SunRPCPutArgsProc, getResults: SunRPCGetResultsProc,
getError: SunRPCGetErrorProc];
Place call and Get results (via getResults).
In all known current instances, getError is a no-op.
Handle Management
Conversation: TYPE ~ RPC.Conversation;
ReportProc: TYPE ~ PROC[sHandle: SHandle, ec: ATOM, expl: ROPE];
TimeoutEnable: TYPE ~ { dontCare, always, never }; -- NIY
SHandle: TYPE ~ REF SunRPCHandleBody;
SunRPCHandleBody:
TYPE ~
MONITORED
RECORD [
serverName: ROPE, -- serverName or hostAddress must be supplied by client.
rpcProgram: CARD,
rpcVersion: CARD,
clientData:
REF,
-- could be property list, either enforced or by convention
TRUE: If communications have failed, retry the connection on each program call.
FALSE: Raise Error if connection does not exist or communications have failed.
timeoutEnable: TimeoutEnable, -- (NIY) Don't time out at all.
timeoutInMs: INT, -- For each retry
retries: INT, -- After the first
reportProc: ReportProc, -- Report problems that do not result in errors or return codes (optional)
enabled:
BOOL¬
FALSE,
Set on explicit connect; cleared by processes at any level that no longer believe it feasible to attempt reconnection automatically.
connected: BOOL¬FALSE, -- Connection currently established; server seems to be there
errorDetected: BOOL¬FALSE, -- Used only by SRPCCalls implementation
handle: Handle, -- Sun RPC handle (back link)
conversation: Conversation -- RPC "conversation handle" (back link)
];
NewRPCConversation:
PROC [
serverName: ROPE¬NIL,
rpcProgram: CARD, rpcVersion: CARD¬1, clientData: REF¬NIL, reportProc: ReportProc ¬ NIL,
timeoutEnable: TimeoutEnable ¬ always, timeoutInMs: INT¬3000, retries: INT ¬ 5]
RETURNS [conversation: Conversation];
Creates all the structures associating Conversations with lower-level handle information. Then binds to the remote service. serverName should either be the name of a host or a rope specifying an IP net address of the form "sun#[1.2.3.4]#5, where [1.2.3.4] is the IP address and 4 is the port.
ReleaseConversation:
PROC[conversation: Conversation];
If not released, handle info will persist due to circular links.
GetSHandle: PROC[conversation: Conversation] RETURNS [handle: SHandle];
ExportSunRPCInterface:
PROC[previousPort:
CARD¬0, server: SunRPC.ServerProc, rpcPgm:
CARD, rpcPgmVersion:
CARD]
RETURNS [uniquePort:
CARD];
}.