-- Copyright (C) 1986 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 25, 1986 12:45:17 pm PDT by Lupine of February 22, 1986 5:15:54 pm PST -- Source interface Agent came from file Agent.bcd, which was created on May 23, 1986 3:27:14 pm PDT with version stamp 227#132#22277337402 from source of May 23, 1986 3:27:05 pm 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 = 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 DESFace, Pup, RPC, Agent, AgentRpcControl 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]--; AgentRpcServerImpl: MONITOR IMPORTS Agent, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS AgentRpcControl SHARES Agent, AgentRpcControl, Rope = BEGIN OPEN Agent, RpcControl: AgentRpcControl, 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 "Agent~227#132#22277337402", 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 Authenticate => RETURN[ AuthenticateStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Vitae => RETURN[ VitaeStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; RoutingHostForHost => RETURN[ RoutingHostForHostStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. AuthenticateStub: --PROCEDURE [nonceId: LONG INTEGER, a: Principal, -- b: Principal] -- RETURNS [an: Frob, ar: Frob]-- RpcPrivate.Dispatcher = BEGIN a: Principal; b: Principal; an: Frob; ar: Frob; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, nonceId (1): LONG INTEGER]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 3; BEGIN -- Unmarshal a: Principal from pkt.data[pktLength]. [a, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal a. BEGIN -- Unmarshal b: Principal from pkt.data[pktLength]. [b, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal b. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [an, ar] _ Authenticate[argPkt.nonceId, a, b]; pktLength _ 0; BEGIN -- Marshal an: Frob to pkt.data[pktLength]. pktLength _ MarshalFrob[an, pkt, pktLength]; END; -- Marshal an. BEGIN -- Marshal ar: Frob to pkt.data[pktLength]. pktLength _ MarshalFrob[ar, pkt, pktLength]; END; -- Marshal ar. RETURN[returnLength: pktLength]; END; -- AuthenticateStub. VitaeStub: --PROCEDURE [clientMachine: Machine, range: RPC.VersionRange, -- interfaceType: RPC.ShortROPE] -- RETURNS [serverMachine: Machine, clientRname: Principal, clientInstance: -- RPC.ShortROPE, serverInstance: RPC.ShortROPE]-- RpcPrivate.Dispatcher = BEGIN interfaceType: RPC.ShortROPE; clientRname: Principal; clientInstance: RPC.ShortROPE; serverInstance: RPC.ShortROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, clientMachine (1): Machine, range (2): RPC.VersionRange]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ serverMachine (0): Machine]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength _ 4; BEGIN -- Unmarshal interfaceType: RPC.ShortROPE from pkt.data[pktLength]. [interfaceType, pktLength] _ Lupine.UnmarshalRope[pkt, pktLength, TRUE]; END; -- Unmarshal interfaceType. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [resPkt.serverMachine, clientRname, clientInstance, serverInstance] _ Vitae[argPkt.clientMachine, argPkt.range, interfaceType]; pktLength _ 1; BEGIN -- Marshal clientRname: Principal to pkt.data[pktLength]. pktLength _ Lupine.MarshalRope[clientRname, pkt, pktLength, TRUE]; END; -- Marshal clientRname. BEGIN -- Marshal clientInstance: RPC.ShortROPE to pkt.data[pktLength]. pktLength _ Lupine.MarshalRope[clientInstance, pkt, pktLength, TRUE]; END; -- Marshal clientInstance. BEGIN -- Marshal serverInstance: RPC.ShortROPE to pkt.data[pktLength]. pktLength _ Lupine.MarshalRope[serverInstance, pkt, pktLength, TRUE]; END; -- Marshal serverInstance. RETURN[returnLength: pktLength]; END; -- VitaeStub. RoutingHostForHostStub: --PROCEDURE [clientMachine: Machine, targetMachine: -- Machine] RETURNS [routingMachine: Machine]-- RpcPrivate.Dispatcher = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, clientMachine (1): Machine, targetMachine (2): Machine]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ routingMachine (0): Machine]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 3]; [resPkt.routingMachine] _ RoutingHostForHost[argPkt.clientMachine, argPkt.targetMachine]; pktLength _ 1; RETURN[returnLength: pktLength]; END; -- RoutingHostForHostStub. -- Marshall/Unmarshal procedures. MarshalFrob: PROC[value: Agent.Frob, pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN pktLength _ pktLength0; { BEGIN -- Marshal value^: Agent.FrobRecord to pkt.data[pktLength]. pkt.data[pktLength] _ value=NIL; pktLength _ pktLength+1; IF value # NIL THEN BEGIN -- Record has a sequence, put its length up front. Lupine.RpcPktDoubleWord[pkt, pktLength]^ _ LENGTH[DESCRIPTOR[value^]]; pktLength _ pktLength + 2; pktLength _ Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[Agent.FrobRecord[LENGTH[DESCRIPTOR[value^]]]], alwaysOnePkt: TRUE]; END; -- IF value # NIL. END; -- Marshal value^. };END; -- No module initialization. END. -- AgentRpcServerImpl.