-- Copyright (C) 1985 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 23, 1985 10:33:42 am PDT by Lupine of May 23, 1985 8:38:08 am PDT -- Source interface Agent came from file Agent.bcd, which was created on May 14, 1985 1:30:43 pm PDT with version stamp 210#216#15453247750 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 [InterfaceRecord, InterMdsCallsOnly, LupineProtocolVersion, ProcedureIndex, SignalIndex], RPCLupine --USING SOME OF [Alloc, Call, DataLength, DeAlloc, Dispatcher, -- GetPkt, 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError, -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT, -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError, -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, PrincOpsUtils --USING SOME OF [Enter, Exit]--, Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--, VM --USING SOME OF [AddressForPageNumber, PageCount, PageNumber, -- PageNumberForAddress, PagesForWords]--; AgentRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, PrincOpsUtils, 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]}; myInterface ← RpcPrivate.ImportInterface [ interface: [ type: IF ~IsNull[interfaceName.type] THEN interfaceName.type ELSE "Agent~210#216#15453247750", 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]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+136]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+136]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [nonceId: nonceId]; BEGIN -- Marshal a: Principal to pkt.data[pktLength]. pktLength ← Lupine.MarshalRope[a, pkt, pktLength, TRUE]; END; -- Marshal a. BEGIN -- Marshal b: Principal to pkt.data[pktLength]. pktLength ← Lupine.MarshalRope[b, pkt, pktLength, TRUE]; 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]; RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+136]; RETURN[an, ar]; END; -- UNWIND. 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 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]; pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+103]]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 4; lastPkt: BOOLEAN; BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+103]; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [clientMachine: clientMachine, range: range]; BEGIN -- Marshal interfaceType: RPC.ShortROPE to pkt.data[pktLength]. pktLength ← Lupine.MarshalRope[interfaceType, pkt, pktLength, TRUE]; END; -- Marshal interfaceType. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 103, signalHandler: ClientDispatcher]; pktLength ← 1; [serverMachine: serverMachine] ← resPkt↑; BEGIN -- Unmarshal clientRname: Principal from pkt.data[pktLength]. [clientRname, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal clientRname. BEGIN -- Unmarshal clientInstance: RPC.ShortROPE from pkt.data[pktLength]. [clientInstance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal clientInstance. BEGIN -- Unmarshal serverInstance: RPC.ShortROPE from pkt.data[pktLength]. [serverInstance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal serverInstance. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+103]; RETURN[serverMachine, clientRname, clientInstance, serverInstance]; END; -- UNWIND. 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.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: Agent.Frob, pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { 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.RpcPktDoubleWord[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.