DIRECTORY Basics, Rope USING [ ROPE ], SunRPC USING [ Handle, GetCard32, PutCard32, ServerProc ], RPC USING [ Conversation ] ; SRPCCalls: CEDAR DEFINITIONS IMPORTS Basics, SunRPC ~ { Handle: TYPE ~ SunRPC.Handle; ROPE: TYPE ~ Rope.ROPE; 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] }; SunRPCPutBool: PROC [h: Handle, bool: BOOL] ~ INLINE { SunRPC.PutCard32[h, IF bool THEN 1 ELSE 0] }; SunRPCProgramCall: PROC [h: Handle, remoteProc: CARD, putArgs: SunRPCPutArgsProc, getResults: SunRPCGetResultsProc, getError: SunRPCGetErrorProc]; 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 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, 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]; ReleaseConversation: PROC[conversation: Conversation]; GetSHandle: PROC[conversation: Conversation] RETURNS [handle: SHandle]; ExportSunRPCInterface: PROC[previousPort: CARD_0, server: SunRPC.ServerProc, rpcPgm: CARD, rpcPgmVersion: CARD] RETURNS [uniquePort: CARD]; }. SRPCCalls.mesa Copyright Σ 1990 by Xerox Corporation. All rights reserved. Pier, May 24, 1990 2:37:57 pm PDT Swinehart, September 17, 1990 2:39:23 pm PDT RPC Call Management Generic conversion routine, needed often by stubs. Generic conversion routine, needed often by stubs. Place call and Get results (via getResults). In all known current instances, getError is a no-op. Handle Management TRUE: If communications have failed, retry the connection on each program call. FALSE: Raise Error if connection does not exist or communications have failed. Set on explicit connect; cleared by processes at any level that no longer believe it feasible to attempt reconnection automatically. 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. If not released, handle info will persist due to circular links. ΚR˜šœ™Icode™