-- Copyright (C) 1986 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 31, 1986 4:14:27 pm PDT by Lupine of February 22, 1986 5:15:54 pm PST -- Source interface LarkSmarts came from file LarkSmarts.bcd, which was created on May 31, 1986 4:14:02 pm PDT with version stamp 331#250#2151644751 from source of May 9, 1986 4:55:45 pm PDT. -- The RPC stub modules for LarkSmarts are: -- LarkSmartsRpcControl.mesa; -- LarkSmartsRpcClientImpl.mesa; -- LarkSmartsRpcBinderImpl.mesa; -- LarkSmartsRpcServerImpl.mesa. -- The parameters for this translation are: -- Target language = Cedar -- Default parameter passing = VALUE -- Deallocate server heap arguments = TRUE -- Inline RpcServerImpl dispatcher stubs = TRUE -- 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 BasicTime, Lark, RPC, LarkSmarts, LarkSmartsRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError, -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT, -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError, -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--; LarkSmartsRpcServerImpl: MONITOR IMPORTS LarkSmarts, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS LarkSmartsRpcControl SHARES LarkSmarts, LarkSmartsRpcControl, Rope = BEGIN OPEN LarkSmarts, RpcControl: LarkSmartsRpcControl, 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 "LarkSmarts~331#250#2151644751", 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 Register => RETURN[ RegisterStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; RecordEvent => RETURN[ RecordEventStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; EventRope => RETURN[ EventRopeStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Login => RETURN[ LoginStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. RegisterStub: --PROCEDURE [shh: SHHH, oldSmartsID: SmartsHandle, -- oldEpoch: Epoch, machine: Machine, model: Lark.LarkModel, authenticated: -- BOOL, clientInstance: ROPE] -- RETURNS [smartsID: SmartsHandle, epoch: Epoch]-- RpcPrivate.Dispatcher = INLINE BEGIN clientInstance: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, oldSmartsID (1): SmartsHandle, oldEpoch (3): Epoch, machine (5): Machine, model (6): Lark.LarkModel, authenticated (8): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ smartsID (0): SmartsHandle, epoch (2): Epoch]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 9; BEGIN -- Unmarshal clientInstance: ROPE from pkt.data[pktLength]. [clientInstance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal clientInstance. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.smartsID, resPkt.epoch] ← Register[localConversation, argPkt.oldSmartsID, argPkt.oldEpoch, argPkt.machine, argPkt.model, argPkt.authenticated, clientInstance]; pktLength ← 4; RETURN[returnLength: pktLength]; END; -- RegisterStub. RecordEventStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle, -- whatHappened: Lark.StatusEvents] -- RETURNS [success: BOOL]-- RpcPrivate.Dispatcher = INLINE BEGIN whatHappened: Lark.StatusEvents; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ success (0): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; BEGIN -- Unmarshal whatHappened: Lark.StatusEvents from pkt.data[pktLength]. [whatHappened, pktLength] ← UnmarshalLarkDotStatusEvents[pkt, pktLength]; END; -- Unmarshal whatHappened. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.success] ← RecordEvent[localConversation, argPkt.smartsID, whatHappened]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- RecordEventStub. EventRopeStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle, time: -- CARDINAL, device: Lark.Device, events: ROPE] -- RETURNS [success: BOOL]-- RpcPrivate.Dispatcher = INLINE BEGIN events: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle, time (3): CARDINAL, device (4): Lark.Device]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ success (0): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 5; BEGIN -- Unmarshal events: ROPE from pkt.data[pktLength]. [events, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal events. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.success] ← EventRope[localConversation, argPkt.smartsID, argPkt.time, argPkt.device, events]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- EventRopeStub. LoginStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle, authenticated: -- BOOL]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle, authenticated (3): BOOL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 4; Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; Login[localConversation, argPkt.smartsID, argPkt.authenticated]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- LoginStub. -- Marshall/Unmarshal procedures. UnmarshalLarkDotStatusEvents: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Lark.StatusEvents, pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { BEGIN -- Unmarshal value↑: Lark.StatusEventSequence from pkt.data[pktLength]. recordIsNIL: Lupine.NilHeader; recordIsNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF recordIsNIL THEN value ← NIL ELSE BEGIN seqLength: Lupine.SequenceHeader; seqLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; value ← (paramZones.gc.NEW[Lark.StatusEventSequence[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Lark.StatusEventSequence[LENGTH[DESCRIPTOR[value↑]]]], alwaysOnePkt: TRUE]; END; -- IF recordIsNIL. END; -- Unmarshal value↑. };END; -- No module initialization. END. -- LarkSmartsRpcServerImpl.