LarkFeepToLarkFeepSunRPC.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Pier, May 24, 1990 12:47:50 pm PDT
Swinehart, September 19, 1990 7:17:38 am PDT
Polle Zellweger (PTZ) October 29, 1990 3:31:44 pm PST
DIRECTORY
IO,
RefID USING [ ID ],
Rope USING [ROPE],
RuntimeError USING [ UNCAUGHT ],
SRPCCalls USING [
Conversation, Error, GetSHandle, Handle, NewRPCConversation, ReleaseConversation, ReportProc, SHandle, TimeoutEnable],
Thrush,
ThrushSunRPC,
ThrushSunRPCConvert,
LarkFeep,
LarkFeepRpcControl,
LarkFeepSunRPC,
LarkFeepSunRPCClient,
LarkFeepSunImport,
VoiceUtils
;
LarkFeepToLarkFeepSunRPC: CEDAR PROGRAM
IMPORTS IO, LarkFeepSunRPCClient, RuntimeError, SRPCCalls, ThrushSunRPCConvert, VoiceUtils
EXPORTS LarkFeepSunImport = {
OPEN IO, ThrushSunRPCConvert;
sunSHHH: CARD32 = 0;
SHandle: TYPE ~ SRPCCalls.SHandle;
InterfaceRecord: TYPE = LarkFeepRpcControl.InterfaceRecord;
Procedures
Feep: PROC [interface: InterfaceRecord, shhh: Thrush.SHHH, serviceID: RefID.ID, convID: Thrush.ConversationID, requestingParty: Thrush.PartyID, number: Rope.ROPE, noisy: BOOLEAN ¬ FALSE, on, off: CARDINAL¬ 177777B] RETURNS [nb: Thrush.NB] = {
ENABLE {
SRPCCalls.Error => { nb ¬ ReportError[shhh, errCode, explanation]; CONTINUE; };
RuntimeError.UNCAUGHT => { nb ¬ ReportError[shhh, $unknownError]; CONTINUE; };
};
srNB: ThrushSunRPC.NB;
srNB ¬ LarkFeepSunRPCClient.Feep[h: GetHandle[shhh], shhh: sunSHHH, serviceID: serviceID, convID: ConvIDToSr[convID], requestingParty: requestingParty, number: ROPEToSr[number], noisy: noisy, on: on, off: off];
nb ¬ SrToATOM[srNB];
};
Flash: PROC [interface: InterfaceRecord, shhh: Thrush.SHHH, serviceID: RefID.ID, convID: Thrush.ConversationID, requestingParty: Thrush.PartyID, actionID: Thrush.ActionID, extraTime: CARDINAL¬ 177777B] RETURNS [nb: Thrush.NB] = {
ENABLE {
SRPCCalls.Error => { nb ¬ ReportError[shhh, errCode, explanation]; CONTINUE; };
RuntimeError.UNCAUGHT => { nb ¬ ReportError[shhh, $unknownError]; CONTINUE; };
};
srNB: ThrushSunRPC.NB;
srNB ¬ LarkFeepSunRPCClient.Flash[h: GetHandle[shhh], shhh: sunSHHH, serviceID: serviceID, convID: ConvIDToSr[convID], requestingParty: requestingParty, actionID: actionID, extraTime: extraTime];
nb ¬ SrToATOM[srNB];
};
Handles
GetHandle: PROC[shhh: Thrush.SHHH] RETURNS [h: SRPCCalls.Handle] ~ {
sHandle: SHandle;
IF shhh = NIL THEN SRPCCalls.Error[$noConversationSupplied];
sHandle ¬ SRPCCalls.GetSHandle[shhh];
IF sHandle=NIL THEN SRPCCalls.Error[$invalidConversationSupplied];
h ¬ sHandle.handle;
};
Connecting
sunPgm: CARD ¬ 390914; -- decimal program number for VoiceRopeServer
sunPgmVersion: CARD ¬ 1;
sunCallTimeout: INT ¬ 3000;
sunCallRetries: INT ¬ 3;
sunCallTimeoutEnable: SRPCCalls.TimeoutEnable ¬ always;
ImportInterface: PUBLIC PROC [instance: Rope.ROPE]
RETURNS [interface: InterfaceRecord, shhh: Thrush.SHHH] ~ {
instance should be a SunRPC address, in the form "sun#[1.2.3.4]#5", where [1.2.3.4] is the Arpa address, and 5 is the port.
shhh ¬ SRPCCalls.NewRPCConversation[serverName: instance, rpcProgram: sunPgm, rpcVersion: sunPgmVersion, timeoutEnable: sunCallTimeoutEnable, timeoutInMs: sunCallTimeout, retries: sunCallRetries, reportProc: ForwardReports];
SRPCCalls.GetSHandle[shhh].enabled ¬ TRUE;
interface ¬ NEW[LarkFeepRpcControl.InterfaceRecordObject];
interface­ ¬ [clientStubFeep: Feep, clientStubFlash: Flash ];
};
UnImportInterface: PUBLIC PROC [shhh: Thrush.SHHH] ~ {
SRPCCalls.ReleaseConversation[shhh];
};
ReportError: PROC[shhh: Thrush.SHHH, errCode: ATOM, explanation: Rope.ROPE¬NIL]
RETURNS[nb: Thrush.NB] ~ {
sHandle: SHandle ¬ SRPCCalls.GetSHandle[shhh];
IF sHandle=NIL THEN RETURN;
ForwardReports[sHandle, errCode, explanation];
nb ¬ $callFailed;
};
ForwardReports: SRPCCalls.ReportProc ~ {
VoiceUtils.ProblemFR[remark: "Lark Feep Failure, code: %g, expl: %g", where: $System, a1: atom[ec], a2: rope[expl]];
};
}.
Polle Zellweger (PTZ) October 29, 1990 12:05:26 pm PST
Allow detection of NIL ropes across a SunRPC connection.
changes to: Feep