-- Stub file LarkUserRpcServerImpl.mesa was translated on 4-Oct-82 -- 14:51:08 PDT by Lupine of 20-Aug-82 10:08:09 PDT. -- Source interface LarkUser came from file LarkUser.bcd, which was -- created on 4-Oct-82 14:48:53 PDT with version stamp 105#156#6772330575 -- from source of 4-Oct-82 14:38:42 PDT. -- The RPC stub modules for LarkUser are: -- LarkUserRpcControl.mesa; -- LarkUserRpcClientImpl.mesa; -- LarkUserRpcBinderImpl.mesa; -- LarkUserRpcServerImpl.mesa. -- The parameters for this translation are: -- Target language = Cedar; -- Default parameter passing = VALUE; -- Deallocate server heap arguments = TRUE; -- Inline RpcServerImpl dispatcher stubs = TRUE; -- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50; -- Acceptable parameter protocols = VersionRange[1,1]. DIRECTORY RPC, LarkUser, LarkUserRpcControl 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, DispatchingError, -- FinishThisPkt, ListHeader, MarshalingError, MarshalingExprError, -- NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord, RuntimeError, -- SequenceHeader, SHORT, StartNextPkt, StringHeader, StubPktDoubleWord, -- TranslationError, UnmarshalingError, UnmarshalingExprError, WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, ConvertUnsafe USING [AppendRope], Heap USING [systemMDSZone], Rope --USING SOME OF [Text]--, RopeInline --USING SOME OF [InlineFlatten, NewText]--, SafeStorage USING [GetSystemZone], UnsafeStorage USING [GetSystemUZone]; LarkUserRpcServerImpl: MONITOR IMPORTS LarkUser, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, ConvertUnsafe, Heap, RopeInline, SafeStorage, UnsafeStorage EXPORTS LarkUserRpcControl SHARES LarkUser, LarkUserRpcControl, Rope = BEGIN OPEN LarkUser, RpcControl: LarkUserRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN ← FALSE; myInterface: RpcPrivate.ExportHandle ← NULL; 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: LONG STRING] RETURNS [BOOLEAN] = INLINE {RETURN[ string=NIL OR string.length=0 ]}; IF bound THEN Lupine.BindingError; BEGIN type: STRING = [RpcPrivate.maxShortStringLength]; instance: STRING = [RpcPrivate.maxShortStringLength]; userString: STRING = [RpcPrivate.maxPrincipalLength]; ConvertUnsafe.AppendRope[to: type, from: interfaceName.type]; ConvertUnsafe.AppendRope[to: instance, from: interfaceName.instance]; ConvertUnsafe.AppendRope[to: userString, from: user]; myInterface ← RpcPrivate.ExportInterface [ interface: [ type: IF ~IsNull[type] THEN type ELSE "LarkUser~105#156#6772330575"L, instance: instance, version: interfaceName.version ], user: userString, password: password, dispatcher: ServerDispatcher, localOnly: RpcControl.InterMdsCallsOnly, stubProtocol: RpcControl.LupineProtocolVersion ]; END; paramZones ← [ gc: IF parameterStorage.gc # NIL THEN parameterStorage.gc ELSE SafeStorage.GetSystemZone[], heap: IF parameterStorage.heap # NIL THEN parameterStorage.heap ELSE UnsafeStorage.GetSystemUZone[], mds: IF parameterStorage.mds # NIL THEN parameterStorage.mds ELSE Heap.systemMDSZone ]; 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]]; GetChar => RETURN[ GetCharStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. RegisterStub: --PROCEDURE [machine: Machine] RETURNS [instance: RPC.ShortROPE]-- RpcPrivate.Dispatcher = INLINE BEGIN instance: RPC.ShortROPE; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, machine (1): Machine]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; [instance] ← Register[argPkt.machine]; pktLength ← 0; BEGIN -- Marshal instance: RPC.ShortROPE to pkt.data[pktLength]. pkt.data[pktLength] ← instance=NIL; pktLength ← pktLength+1; IF instance # NIL THEN BEGIN textRope: Rope.Text = RopeInline.InlineFlatten[r: instance]; IF textRope.length > RpcPrivate.maxShortStringLength THEN Lupine.MarshalingError; pkt.data[pktLength] ← textRope.length; pktLength ← pktLength+1; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[textRope.length], alwaysOnePkt: TRUE]; END; -- IF instance # NIL. END; -- Marshal instance. RETURN[returnLength: pktLength]; END; -- RegisterStub. GetCharStub: --PROCEDURE [value: CARDINAL]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, value (1): CARDINAL]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; GetChar[argPkt.value]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GetCharStub. -- No module initialization. END. -- LarkUserRpcServerImpl.