-- Stub file was translated on January 13, 1985 12:57:51 pm PST by Lupine of July 22, 1984 2:36:32 pm PDT -- Source interface ThParty came from file ThParty.bcd, which was created on January 13, 1985 12:57:40 pm PST with version stamp 323#367#35722265661 from source of September 6, 1984 5:31:52 pm PDT. -- The RPC stub modules for ThParty are: -- ThPartyRpcControl.mesa; -- ThPartyRpcClientImpl.mesa; -- ThPartyRpcBinderImpl.mesa; -- ThPartyRpcServerImpl.mesa. -- The parameters for this translation are: -- Target language = Cedar -- Default parameter passing = VALUE -- Deallocate server heap arguments = TRUE -- Inline RpcServerImpl dispatcher stubs = FALSE -- Declare signals = TRUE -- Warn about short POINTER ("MDS") allocations = TRUE -- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50 -- Acceptable parameter protocols = VersionRange[1..1]. DIRECTORY Basics, Lark, Thrush, ThSmarts, ThParty, ThPartyRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPC USING [EncryptionKey, InterfaceName, Principal, standardZones, Zones], RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, ExportHandle, -- ExportInterface, GetStubPkt, maxDataLength, maxPrincipalLength, -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, -- StartCall, StartSignal, StubPkt, UnexportInterface]--, LupineRuntime --USING SOME OF [BindingError, CheckPktLength, CopyFromPkt, -- CopyFromMultiplePkts, CopyToPkt, CopyToMultiplePkts, defaultZones, -- DispatchingError, FinishThisPkt, ListHeader, MarshalingError, -- MarshalingExprError, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord, -- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader, -- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError, -- WordsForChars]--, LupineRuntimeExtras --USING SOME OF [MarshalRope, MarshalAtom, UnmarshalRope, -- UnmarshalAtom]--, Atom --USING SOME OF [GetPName, MakeAtom]--, Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--; ThPartyRpcServerImpl: MONITOR IMPORTS ThParty, RpcPrivate: RPCLupine, Lupine: LupineRuntime, LupineRuntimeExtras: LupineRuntimeExtras, Atom, Rope EXPORTS ThPartyRpcControl SHARES ThParty, ThPartyRpcControl, Rope = BEGIN OPEN ThParty, RpcControl: ThPartyRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN ← FALSE; myInterface: RpcPrivate.ExportHandle; paramZones: RpcPublic.Zones ← RpcPublic.standardZones; ExportInterface: PUBLIC ENTRY SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, user: RpcPublic.Principal, password: RpcPublic.EncryptionKey, parameterStorage: RpcPublic.Zones ] = TRUSTED BEGIN ENABLE UNWIND => NULL; IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] = INLINE {RETURN[string.Length[] = 0]}; IF bound THEN Lupine.BindingError; myInterface ← RpcPrivate.ExportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "ThParty~323#367#35722265661", instance: interfaceName.instance, version: interfaceName.version ], user: user, password: password, dispatcher: ServerDispatcher, localOnly: RpcControl.InterMdsCallsOnly, stubProtocol: RpcControl.LupineProtocolVersion ]; paramZones ← [ gc: IF parameterStorage.gc # NIL THEN parameterStorage.gc ELSE Lupine.defaultZones.gc, heap: IF parameterStorage.heap # NIL THEN parameterStorage.heap ELSE Lupine.defaultZones.heap, mds: IF parameterStorage.mds # NIL THEN parameterStorage.mds ELSE Lupine.defaultZones.mds ]; bound ← TRUE; END; UnexportInterface: PUBLIC ENTRY SAFE PROCEDURE = TRUSTED BEGIN ENABLE UNWIND => NULL; IF ~bound THEN Lupine.BindingError; myInterface ← RpcPrivate.UnexportInterface[myInterface]; paramZones ← RpcPublic.standardZones; bound ← FALSE; END; -- Public procedure dispatcher and public signal and error catcher. ServerDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength, -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength: -- DataLength]-- RpcPrivate.Dispatcher = BEGIN -- Catch public signals. ENABLE BEGIN END; -- Catch public signals. -- Call public procedures (still in dispatcher). SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM Alert => RETURN[ AlertStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Advance => RETURN[ AdvanceStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; CreateConversation => RETURN[ CreateConversationStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; MergeConversations => RETURN[ MergeConversationsStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; SetSubject => RETURN[ SetSubjectStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetSubject => RETURN[ GetSubjectStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; OtherParty => RETURN[ OtherPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; DescribeParty => RETURN[ DescribePartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ConversationsForParty => RETURN[ ConversationsForPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; SetIntervals => RETURN[ SetIntervalsStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; DescribeInterval => RETURN[ DescribeIntervalStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; RegisterKey => RETURN[ RegisterKeyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; CreateParty => RETURN[ CreatePartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetParty => RETURN[ GetPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetJayParty => RETURN[ GetJayPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetPartyFromNumber => RETURN[ GetPartyFromNumberStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetPartyFromFeepNum => RETURN[ GetPartyFromFeepNumStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ReleaseTrunkParty => RETURN[ ReleaseTrunkPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetRname => RETURN[ GetRnameStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Register => RETURN[ RegisterStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; RegisterClone => RETURN[ RegisterCloneStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Deregister => RETURN[ DeregisterStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Enable => RETURN[ EnableStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Disable => RETURN[ DisableStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetNumbersForRName => RETURN[ GetNumbersForRNameStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; SetRingEnable => RETURN[ SetRingEnableStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. AlertStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, state: -- StateInConv, reason: Reason, calledPartyID: PartyHandle, urgency: -- CallUrgency, alertKind: AlertKind, newConv: BOOL, comment: ROPE] -- RETURNS [nb: NB, convID: ConversationHandle]-- RpcPrivate.Dispatcher = BEGIN comment: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, state (8): StateInConv, reason (9): Reason, calledPartyID (10): PartyHandle, urgency (12): CallUrgency, alertKind (13): AlertKind, newConv (14): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB, convID (1): ConversationHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 15; BEGIN -- Unmarshal comment: ROPE from pkt.data[pktLength]. [comment, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal comment. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb, resPkt.convID] ← Alert[localConversation, argPkt.credentials, argPkt.state, argPkt.reason, argPkt.calledPartyID, argPkt.urgency, argPkt.alertKind, argPkt.newConv, comment]; pktLength ← 3; RETURN[returnLength: pktLength]; END; -- AlertStub. AdvanceStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, state: -- StateInConv, reason: Reason, comment: ROPE] -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher = BEGIN comment: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, state (8): StateInConv, reason (9): Reason]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 10; BEGIN -- Unmarshal comment: ROPE from pkt.data[pktLength]. [comment, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal comment. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb] ← Advance[localConversation, argPkt.credentials, argPkt.state, argPkt.reason, comment]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- AdvanceStub. CreateConversationStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, -- urgency: CallUrgency, alertKind: AlertKind] -- RETURNS [nb: NB, convID: ConversationHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, urgency (8): CallUrgency, alertKind (9): AlertKind]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB, convID (1): ConversationHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 10; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb, resPkt.convID] ← CreateConversation[localConversation, argPkt.credentials, argPkt.urgency, argPkt.alertKind]; pktLength ← 3; RETURN[returnLength: pktLength]; END; -- CreateConversationStub. MergeConversationsStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, -- otherStateID: StateID, otherConvID: ConversationHandle] -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, otherStateID (8): StateID, otherConvID (9): ConversationHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 11; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb] ← MergeConversations[localConversation, argPkt.credentials, argPkt.otherStateID, argPkt.otherConvID]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- MergeConversationsStub. SetSubjectStub: --PROCEDURE [shh: SHHH, convID: ConversationHandle, -- subject: ROPE]-- RpcPrivate.Dispatcher = BEGIN subject: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, convID (1): ConversationHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- Unmarshal subject: ROPE from pkt.data[pktLength]. [subject, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal subject. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; SetSubject[localConversation, argPkt.convID, subject]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- SetSubjectStub. GetSubjectStub: --PROCEDURE [shh: SHHH, convID: ConversationHandle] -- RETURNS [subject: ROPE]-- RpcPrivate.Dispatcher = BEGIN subject: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, convID (1): ConversationHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [subject] ← GetSubject[localConversation, argPkt.convID]; pktLength ← 0; BEGIN -- Marshal subject: ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[subject, pkt, pktLength]; END; -- Marshal subject. RETURN[returnLength: pktLength]; END; -- GetSubjectStub. OtherPartyStub: --PROCEDURE [shhh: SHHH, credentials: Credentials] -- RETURNS [nb: NB, partyID: PartyHandle, description: Thrush.ROPE, -- conference: BOOL]-- RpcPrivate.Dispatcher = BEGIN description: Thrush.ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB, partyID (1): PartyHandle, conference (3): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 8; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb, resPkt.partyID, description, resPkt.conference] ← OtherParty[localConversation, argPkt.credentials]; pktLength ← 4; BEGIN -- Marshal description: Thrush.ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[description, pkt, pktLength]; END; -- Marshal description. RETURN[returnLength: pktLength]; END; -- OtherPartyStub. DescribePartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle] -- RETURNS [description: Thrush.ROPE]-- RpcPrivate.Dispatcher = BEGIN description: Thrush.ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [description] ← DescribeParty[localConversation, argPkt.partyID]; pktLength ← 0; BEGIN -- Marshal description: Thrush.ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[description, pkt, pktLength]; END; -- Marshal description. RETURN[returnLength: pktLength]; END; -- DescribePartyStub. ConversationsForPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; ConversationsForParty[localConversation, argPkt.partyID]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- ConversationsForPartyStub. SetIntervalsStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, -- intervalSpecs: Thrush.IntervalSpecs] -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher = BEGIN credentials: Credentials; intervalSpecs: Thrush.IntervalSpecs; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay; pktLength: RpcPrivate.DataLength ← 8; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [credentials: credentials] ← argPkt↑; END; BEGIN -- Unmarshal intervalSpecs: Thrush.IntervalSpecs from pkt.data[pktLength]. lastNode: Thrush.IntervalSpecs ← (intervalSpecs ← NIL); listLength: Lupine.ListHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; listLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; WHILE listLength > 0 DO thisNode1: Thrush.IntervalSpecs = paramZones.gc.CONS[--DefaultValue--,NIL]; BEGIN -- Unmarshal thisNode1.first: Thrush.IntervalSpec from -- pkt.data[pktLength]. [thisNode1.first, pktLength] ← UnmarshalThrushDotIntervalSpec[pkt, pktLength]; END; -- Unmarshal thisNode1.first. IF lastNode # NIL THEN lastNode ← (lastNode.rest ← thisNode1) ELSE lastNode ← (intervalSpecs ← thisNode1); listLength ← listLength - 1; ENDLOOP; -- WHILE listLength > 0. END; -- Unmarshal intervalSpecs. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; resPkt ← @pkt.data[0]; IF onePkt THEN [resPkt.nb] ← SetIntervals[localConversation, argPkt.credentials, intervalSpecs] ELSE [resPkt.nb] ← SetIntervals[localConversation, credentials, intervalSpecs]; END; -- OnePkt. pktLength ← 1; RETURN[returnLength: pktLength]; END; -- SetIntervalsStub. DescribeIntervalStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, -- targetInterval: Thrush.IntervalSpec, minSilence: Thrush.VoiceTime] -- RETURNS [nb: NB, exists: BOOL, intervals: Thrush.IntervalSpecs]-- RpcPrivate.Dispatcher = BEGIN targetInterval: Thrush.IntervalSpec; intervals: Thrush.IntervalSpecs; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, minSilence (8): Thrush.VoiceTime]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB, exists (1): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 10; BEGIN -- Unmarshal targetInterval: Thrush.IntervalSpec from pkt.data[pktLength]. [targetInterval, pktLength] ← UnmarshalThrushDotIntervalSpec[pkt, pktLength]; END; -- Unmarshal targetInterval. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb, resPkt.exists, intervals] ← DescribeInterval[localConversation, argPkt.credentials, targetInterval, argPkt.minSilence]; pktLength ← 2; BEGIN -- Marshal intervals: Thrush.IntervalSpecs to pkt.data[pktLength]. thisNode1: Thrush.IntervalSpecs; listLength: Lupine.ListHeader ← 0; FOR thisNode1 ← intervals, thisNode1.rest UNTIL thisNode1 = NIL DO listLength ← listLength + 1; ENDLOOP; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; Lupine.RpcPktDoubleWord[pkt, pktLength]↑ ← listLength; pktLength ← pktLength + 2; FOR thisNode1 ← intervals, thisNode1.rest UNTIL thisNode1 = NIL DO BEGIN -- Marshal thisNode1.first: Thrush.IntervalSpec to pkt.data[pktLength]. pktLength ← MarshalThrushDotIntervalSpec[thisNode1.first, pkt, pktLength]; END; -- Marshal thisNode1.first. ENDLOOP; -- FOR thisNode1. END; -- Marshal intervals. RETURN[returnLength: pktLength]; END; -- DescribeIntervalStub. RegisterKeyStub: --PROCEDURE [shh: SHHH, credentials: Credentials, -- key: Thrush.EncryptionKey] -- RETURNS [nb: NB, keyIndex: [0..15]]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, credentials (1): Credentials, key (8): Thrush.EncryptionKey]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): NB, keyIndex (1): [0..15]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 12; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb, resPkt.keyIndex] ← RegisterKey[localConversation, argPkt.credentials, argPkt.key]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- RegisterKeyStub. CreatePartyStub: --PROCEDURE [shh: SHHH, rName: Rname, type: Thrush.PartyType] -- RETURNS [partyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN rName: Rname; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, type (1): Thrush.PartyType]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ partyID (0): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; BEGIN -- Unmarshal rName: Rname from pkt.data[pktLength]. [rName, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.partyID] ← CreateParty[localConversation, rName, argPkt.type]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- CreatePartyStub. GetPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, rName: -- Rname] -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN rName: Rname; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ newPartyID (0): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- Unmarshal rName: Rname from pkt.data[pktLength]. [rName, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.newPartyID] ← GetParty[localConversation, argPkt.partyID, rName]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- GetPartyStub. GetJayPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle] RETURNS -- [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ newPartyID (0): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.newPartyID] ← GetJayParty[localConversation, argPkt.partyID]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- GetJayPartyStub. GetPartyFromNumberStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, -- phoneNumber: Thrush.ROPE, description: ROPE, trunkOK: BOOL] -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN phoneNumber: Thrush.ROPE; description: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle, trunkOK (3): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ newPartyID (0): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 4; BEGIN -- Unmarshal phoneNumber: Thrush.ROPE from pkt.data[pktLength]. [phoneNumber, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal phoneNumber. BEGIN -- Unmarshal description: ROPE from pkt.data[pktLength]. [description, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal description. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.newPartyID] ← GetPartyFromNumber[localConversation, argPkt.partyID, phoneNumber, description, argPkt.trunkOK]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- GetPartyFromNumberStub. GetPartyFromFeepNumStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, -- feepNum: Thrush.ROPE] -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN feepNum: Thrush.ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ newPartyID (0): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- Unmarshal feepNum: Thrush.ROPE from pkt.data[pktLength]. [feepNum, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal feepNum. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.newPartyID] ← GetPartyFromFeepNum[localConversation, argPkt.partyID, feepNum]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- GetPartyFromFeepNumStub. ReleaseTrunkPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; ReleaseTrunkParty[localConversation, argPkt.partyID]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- ReleaseTrunkPartyStub. GetRnameStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle] RETURNS -- [Rname: Thrush.Rname]-- RpcPrivate.Dispatcher = BEGIN Rname: Thrush.Rname; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [Rname] ← GetRname[localConversation, argPkt.partyID]; pktLength ← 0; BEGIN -- Marshal Rname: Thrush.Rname to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[Rname, pkt, pktLength]; END; -- Marshal Rname. RETURN[returnLength: pktLength]; END; -- GetRnameStub. RegisterStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, interface: -- SmartsInterface, properties: ThSmarts.SmartsProperties, oldSmartsID: -- SmartsHandle] -- RETURNS [smartsID: SmartsHandle]-- RpcPrivate.Dispatcher = BEGIN interface: SmartsInterface; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle, properties (3): ThSmarts.SmartsProperties, oldSmartsID (5): SmartsHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ smartsID (0): SmartsHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 7; BEGIN -- Unmarshal interface: SmartsInterface from pkt.data[pktLength]. [interface, pktLength] ← UnmarshalSmartsInterface[pkt, pktLength]; END; -- Unmarshal interface. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.smartsID] ← Register[localConversation, argPkt.partyID, interface, argPkt.properties, argPkt.oldSmartsID]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- RegisterStub. RegisterCloneStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, -- clonePartyID: PartyHandle, oldSmartsID: SmartsHandle] -- RETURNS [smartsID: SmartsHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle, clonePartyID (3): PartyHandle, oldSmartsID (5): SmartsHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ smartsID (0): SmartsHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 7; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.smartsID] ← RegisterClone[localConversation, argPkt.partyID, argPkt.clonePartyID, argPkt.oldSmartsID]; pktLength ← 2; RETURN[returnLength: pktLength]; END; -- RegisterCloneStub. DeregisterStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; Deregister[localConversation, argPkt.smartsID]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- DeregisterStub. EnableStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle] RETURNS -- [nb: Thrush.NB]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): Thrush.NB]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb] ← Enable[localConversation, argPkt.smartsID]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- EnableStub. DisableStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle] RETURNS -- [nb: Thrush.NB]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ nb (0): Thrush.NB]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.nb] ← Disable[localConversation, argPkt.smartsID]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- DisableStub. GetNumbersForRNameStub: --PROCEDURE [shh: SHHH, rName: ROPE] RETURNS -- [fullRName: ROPE, number: ROPE, homeNumber: ROPE]-- RpcPrivate.Dispatcher = BEGIN rName: ROPE; fullRName: ROPE; number: ROPE; homeNumber: ROPE; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [fullRName, number, homeNumber] ← GetNumbersForRName[localConversation, rName]; pktLength ← 0; BEGIN -- Marshal fullRName: ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[fullRName, pkt, pktLength]; END; -- Marshal fullRName. BEGIN -- Marshal number: ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[number, pkt, pktLength]; END; -- Marshal number. BEGIN -- Marshal homeNumber: ROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[homeNumber, pkt, pktLength]; END; -- Marshal homeNumber. RETURN[returnLength: pktLength]; END; -- GetNumbersForRNameStub. SetRingEnableStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, -- ringEnable: Thrush.RingEnable, ringInterval: INT, update: BOOL]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle, ringEnable (3): Thrush.RingEnable, ringInterval (4): INT, update (6): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 7; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; SetRingEnable[localConversation, argPkt.partyID, argPkt.ringEnable, argPkt.ringInterval, argPkt.update]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- SetRingEnableStub. -- Marshall/Unmarshal procedures. UnmarshalSmartsInterface: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: ThParty.SmartsInterface, pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { isNIL: Lupine.NilHeader; isNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF isNIL THEN value ← NIL ELSE BEGIN value ← (paramZones.gc.NEW[ThSmarts.SmartsInterfaceRecord]); BEGIN -- Unmarshal value↑: ThSmarts.SmartsInterfaceRecord from -- pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[ThSmarts.SmartsInterfaceRecord], alwaysOnePkt: TRUE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: value↑; LOOPHOLE[record.type, LONG POINTER] ← NIL; LOOPHOLE[record.instance, LONG POINTER] ← NIL; END; -- OPEN record: value↑. BEGIN OPEN record: value↑; BEGIN -- Unmarshal record.type: RPC.ShortROPE from pkt.data[pktLength]. [record.type, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal record.type. BEGIN -- Unmarshal record.instance: RPC.ShortROPE from pkt.data[pktLength]. [record.instance, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal record.instance. END; -- OPEN record: value↑. END; -- Unmarshal value↑. END; -- IF isNIL. };END; MarshalThrushDotIntervalSpec: PROC[value: Thrush.IntervalSpec, pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← value=NIL; pktLength ← pktLength+1; IF value # NIL THEN BEGIN -- Marshal value↑: Thrush.IntervalSpecBody to pkt.data[pktLength]. pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.IntervalSpecBody], alwaysOnePkt: FALSE]; END; -- Marshal value↑. };END; UnmarshalThrushDotIntervalSpec: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Thrush.IntervalSpec, pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { isNIL: Lupine.NilHeader; IF pktLength+1 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; isNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF isNIL THEN value ← NIL ELSE BEGIN value ← (paramZones.gc.NEW[Thrush.IntervalSpecBody]); BEGIN -- Unmarshal value↑: Thrush.IntervalSpecBody from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.IntervalSpecBody], alwaysOnePkt: FALSE]; END; -- Unmarshal value↑. END; -- IF isNIL. };END; -- No module initialization. END. -- ThPartyRpcServerImpl.