ThSmartsToThSmartsSunRPC.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Pier, May 24, 1990 12:50:16 pm PDT
Polle Zellweger (PTZ) October 29, 1990 5:04:22 pm PST
Swinehart, September 19, 1990 7:09:19 am PDT
ThSmarts is a voice service interface. It is exported to $recording service parties to provide access to procedures for recording and playing voice, and for VoiceRope editing activities.
This version uses Pup RPC interface records (ThSmartsRPCControl.InterfaceRecord) and maintains a separate RefTab for associating Sun RPC handles with the interface records. It differs from the other Sun stubs in two ways: first, the voice server (rather than the workstation) is the RPC client, and second, there are multiple instances of ThSmarts interfaces -- and there can even be multiple instances on the same workstation (i.e., FinchSmarts and MacawSmarts).
DIRECTORY
RefID USING [ID],
Rope USING [ROPE],
SRPCCalls USING [ Error, GetSHandle, NewRPCConversation, SHandle, TimeoutEnable ],
SunRPC USING [Handle],
Thrush,
ThrushSunRPC,
ThrushSunRPCConvert,
ThSmarts,
ThSmartsRpcControl USING [InterfaceRecord, InterfaceRecordObject],
ThSmartsSunImport,
ThSmartsSunRPC,
ThSmartsSunRPCClient
;
ThSmartsToThSmartsSunRPC: CEDAR PROGRAM
IMPORTS SRPCCalls, ThSmartsSunRPCClient, ThrushSunRPCConvert
EXPORTS ThSmartsSunImport
~ {
OPEN ThrushSunRPCConvert;
Types
InterfaceRecord: TYPE ~ ThSmartsRpcControl.InterfaceRecord;
SHHH: TYPE ~ Thrush.SHHH;
sunSHHH: CARD32 = 0;
Error: PUBLIC ERROR[errCode: ATOM, explanation: Rope.ROPE] ~ CODE;
Progress: PROC[
interface: InterfaceRecord,
shh: Thrush.SHHH,
convEvent: Thrush.ConvEvent
] = {
ENABLE SRPCCalls.Error => Error[errCode, explanation];
ThSmartsSunRPCClient.Progress[h: GetHandle[shh], shh: sunSHHH,
convEvent: ConvEventToSr[convEvent]];
};
ReportAction: PROC[
interface: InterfaceRecord,
shh: Thrush.SHHH,
report: Thrush.ActionReport
] = {
ENABLE SRPCCalls.Error => Error[errCode, explanation];
ThSmartsSunRPCClient.ReportAction[h: GetHandle[shh], shh: sunSHHH,
report: ActionReportToSr[report]];
};
Substitution: PROC[
interface: InterfaceRecord,
shh: Thrush.SHHH,
convEvent: Thrush.ConvEvent,
oldPartyID: Thrush.PartyID,
newPartyID: Thrush.PartyID
] = {
ENABLE SRPCCalls.Error => Error[errCode, explanation];
ThSmartsSunRPCClient.Substitution[h: GetHandle[shh], shh: sunSHHH,
convEvent: ConvEventToSr[convEvent], oldPartyID: oldPartyID,
newPartyID: newPartyID];
};
CheckIn: PROC[
interface: InterfaceRecord,
shh: Thrush.SHHH,
credentials: Thrush.Credentials,
voicePath: BOOLTRUE,
reason: Thrush.Reason,
remark: Thrush.ROPENIL,
nextScheduledCheck: INT
] = {
ENABLE SRPCCalls.Error => Error[errCode, explanation];
ThSmartsSunRPCClient.CheckIn[h: GetHandle[shh], shh: sunSHHH,
credentials: CredentialsToSr[credentials], voicePath: voicePath, reason: ATOMToSr[reason], remark: ROPEToSr[remark], nextScheduledCheck: nextScheduledCheck];
};
Handles
GetHandle: PROC [shhh: Thrush.SHHH] RETURNS [h: SunRPC.Handle←NIL] = {
sHandle: SRPCCalls.SHandle ← SRPCCalls.GetSHandle[shhh];
IF sHandle#NIL THEN h ← sHandle.handle;
};
Connecting
sunPgm: CARD ← 390910; -- decimal program number for ThSmarts
sunPgmVersion: CARD ← 1;
sunCallTimeout: INT ← 3000;
sunCallRetries: INT ← 3;
sunCallTimeoutEnable: SRPCCalls.TimeoutEnable ← always;
instance (address) should look like "sun#[1.2.3.4]#567", where [1.2.3.4] is the Arpa address, and 567 is the port.
ImportInterface: PUBLIC PROC [instance: Rope.ROPE, reportProblem: ThSmartsSunImport.ReportProblem←NIL, reportData: REFNIL]
Report stuff not implemented yet, if ever.
RETURNS [interface: InterfaceRecord, shhh: SHHH] ~ {
shhh ← SRPCCalls.NewRPCConversation[serverName: instance, rpcProgram: sunPgm, rpcVersion: sunPgmVersion, timeoutEnable: sunCallTimeoutEnable, timeoutInMs: sunCallTimeout, retries: sunCallRetries];
SRPCCalls.GetSHandle[shhh].enabled ← TRUE;
interface ← NEW[ThSmartsRpcControl.InterfaceRecordObject];
interface^ ← [clientStubProgress: Progress, clientStubReportAction: ReportAction, clientStubSubstitution: Substitution, clientStubCheckIn: CheckIn];
};
}.
Polle Zellweger (PTZ) June 25, 1990 11:59:18 am PDT
Add import routines to create new interface records.
changes to: SunHandleTable, GetHandle, SunProtocol, SunAddrFromRope, ImportInterface
Polle Zellweger (PTZ) August 13, 1990 2:07:40 pm PDT
Move SunProtocol, SunAddrFromRope to VoiceUtilsImpl (export to VoiceUtilsExtras)
changes to: DIRECTORY, ThSmartsToThSmartsSunRPC, ImportInterface
Swinehart, September 15, 1990 2:36:09 pm PDT
Change to track SRPCCalls and other related changes. Error management is not as elaborate on this side: ThParty implementation simply zaps clients whenever any communication error occurs; clients are expected to jump through hoops to recover (and do!).
Unlike ThParty stuboid, these procedures simply pass on errors to the caller, as errors. They do remap to an Error at this level, so that the clients don't need to know about any other interface.
Polle Zellweger (PTZ) October 29, 1990 5:04:09 pm PST
Allow detection of NIL ropes across a SunRPC connection.
changes to: CheckIn