-- Copyright (C) 1987 by Xerox Corporation. All rights reserved. -- Stub file was translated on April 4, 1987 3:33:00 pm PST by Lupine of January 22, 1987 5:37:32 pm PST -- Source interface LarkSmarts came from file LarkSmarts.bcd, which was created on April 4, 1987 3:32:53 pm PST with version stamp 317#365#23112662400 from source of June 10, 1986 9:03:37 am 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~317#365#23112662400", 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: SmartsID, oldEpoch: -- Epoch, machine: Machine, model: Lark.LarkModel, authenticated: -- BOOL, clientInstance: ROPE] -- RETURNS [smartsID: SmartsID, epoch: Epoch]-- RpcPrivate.Dispatcher = INLINE BEGIN clientInstance: ROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, oldSmartsID (1): SmartsID, oldEpoch (3): Epoch, machine (5): Machine, model (6): Lark.LarkModel, authenticated (8): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ smartsID (0): SmartsID, 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: SmartsID, whatHappened: -- Lark.StatusEvents] -- RETURNS [success: BOOL]-- RpcPrivate.Dispatcher = INLINE BEGIN whatHappened: Lark.StatusEvents; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsID]; 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: SmartsID, 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): SmartsID, 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: SmartsID, authenticated: -- BOOL]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsID, 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.