-- Stub file was translated on July 12, 1984 2:50:52 am PDT by Lupine of July 11, 1984 11:51:36 pm PDT -- Source interface Agent came from file Agent.bcd, which was created on March 22, 1984 4:21:31 pm PST with version stamp 63#37#37644543706 from source of August 31, 1983 9:20:56 am PDT. -- The RPC stub modules for Agent are: -- AgentRpcControl.mesa; -- AgentRpcClientImpl.mesa; -- AgentRpcBinderImpl.mesa; -- AgentRpcServerImpl.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 DESFace, RPC, RPCPkt, Agent, AgentRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, GetStubPkt, -- ImportHandle, ImportInterface, maxDataLength, maxPrincipalLength, -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, -- StartCall, StartSignal, StubPkt, UnimportInterface]--, 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]--; AgentRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, LupineRuntimeExtras: LupineRuntimeExtras, Atom, Rope EXPORTS Agent, AgentRpcControl SHARES Agent, AgentRpcControl, Rope = BEGIN OPEN Agent, RpcControl: AgentRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN ← FALSE; myInterface: RpcPrivate.ImportHandle; paramZones: RpcPublic.Zones ← RpcPublic.standardZones; ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, 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.ImportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "Agent~63#37#37644543706", instance: interfaceName.instance, version: interfaceName.version ], 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; UnimportInterface: PUBLIC ENTRY SAFE PROCEDURE = TRUSTED BEGIN ENABLE UNWIND => NULL; IF ~bound THEN Lupine.BindingError; myInterface ← RpcPrivate.UnimportInterface[myInterface]; paramZones ← RpcPublic.standardZones; bound ← FALSE; END; -- Remote public procedure stubs. Authenticate: PUBLIC PROCEDURE [nonceId: LONG INTEGER, a: Principal, b: Principal] RETURNS [an: Frob, ar: Frob] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Authenticate, nonceId (1): LONG INTEGER]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+136] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [nonceId: nonceId]; BEGIN -- Marshal a: Principal to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[a, pkt, pktLength]; END; -- Marshal a. BEGIN -- Marshal b: Principal to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[b, pkt, pktLength]; END; -- Marshal b. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 136, signalHandler: ClientDispatcher]; pktLength ← 0; BEGIN -- Unmarshal an: Frob from pkt.data[pktLength]. [an, pktLength] ← UnmarshalFrob[pkt, pktLength]; END; -- Unmarshal an. BEGIN -- Unmarshal ar: Frob from pkt.data[pktLength]. [ar, pktLength] ← UnmarshalFrob[pkt, pktLength]; END; -- Unmarshal ar. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RETURN[an, ar]; END; -- Authenticate. Vitae: PUBLIC PROCEDURE [clientMachine: RPCPkt.Machine, range: RPC.VersionRange, interfaceType: RPC.ShortROPE] RETURNS [--serverMachine:-- RPCPkt.Machine, --clientRname:-- Principal, --clientInstance:-- RPC.ShortROPE, --serverInstance:-- RPC.ShortROPE] = BEGIN clientRname: Principal; clientInstance: RPC.ShortROPE; serverInstance: RPC.ShortROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Vitae, clientMachine (1): RPCPkt.Machine, range (2): RPC.VersionRange]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ serverMachine (0): RPCPkt.Machine]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+103] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 4; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [clientMachine: clientMachine, range: range]; BEGIN -- Marshal interfaceType: RPC.ShortROPE to pkt.data[pktLength]. pktLength ← LupineRuntimeExtras.MarshalRope[interfaceType, pkt, pktLength]; END; -- Marshal interfaceType. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 103, signalHandler: ClientDispatcher]; pktLength ← 1; BEGIN -- Unmarshal clientRname: Principal from pkt.data[pktLength]. [clientRname, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal clientRname. BEGIN -- Unmarshal clientInstance: RPC.ShortROPE from pkt.data[pktLength]. [clientInstance, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal clientInstance. BEGIN -- Unmarshal serverInstance: RPC.ShortROPE from pkt.data[pktLength]. [serverInstance, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength]; END; -- Unmarshal serverInstance. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RETURN[resPkt.serverMachine, clientRname, clientInstance, serverInstance]; END; -- Vitae. -- Remote public signals and errors. -- Public signal and error dispatcher. ClientDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength, -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength: -- DataLength]-- RpcPrivate.Dispatcher = BEGIN SELECT LOOPHOLE[pkt.data[0], RpcControl.SignalIndex] FROM ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. -- Marshall/Unmarshal procedures. UnmarshalFrob: PROC[pkt: RpcPrivate.StubPkt, pktLength: RpcPrivate.DataLength] RETURNS[value: Agent.Frob, newLength: RpcPrivate.DataLength] = BEGIN BEGIN -- Unmarshal value↑: Agent.FrobRecord 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.StubPktDoubleWord[pkt, pktLength]↑; pktLength ← pktLength + 2; value ← (paramZones.gc.NEW[Agent.FrobRecord[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Agent.FrobRecord[LENGTH[DESCRIPTOR[value↑]]]], alwaysOnePkt: TRUE]; END; -- IF recordIsNIL. END; -- Unmarshal value↑. END; -- No module initialization. END. -- AgentRpcClientImpl.