<> <> <> <> 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]; }.