-- Copyright (C) 1987 by Xerox Corporation. All rights reserved. -- Stub file was translated on February 9, 1987 9:01:52 am PST by Lupine of February 22, 1986 5:15:54 pm PST -- Source interface NamesGV came from file NamesGV.bcd, which was created on February 9, 1987 9:01:32 am PST with version stamp 102#157#17524602220 from source of April 29, 1986 6:28:22 pm PDT. -- The RPC stub modules for NamesGV are: -- NamesGVRpcControl.mesa; -- NamesGVRpcClientImpl.mesa; -- NamesGVRpcBinderImpl.mesa; -- NamesGVRpcServerImpl.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 GVBasics, Rope, RPC, VoiceUtils, NamesGV, NamesGVRpcControl 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]--; NamesGVRpcServerImpl: MONITOR IMPORTS NamesGV, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS NamesGVRpcControl SHARES NamesGV, NamesGVRpcControl, Rope = BEGIN OPEN NamesGV, RpcControl: NamesGVRpcControl, 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 "NamesGV~102#157#17524602220", 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 GVGetAttribute => RETURN[ GVGetAttributeStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVSetAttribute => RETURN[ GVSetAttributeStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVGetAttributeSeq => RETURN[ GVGetAttributeSeqStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVSetAttributeSeq => RETURN[ GVSetAttributeSeqStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVGetAttributes => RETURN[ GVGetAttributesStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVAuthenticate => RETURN[ GVAuthenticateStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVIsAuthenticated => RETURN[ GVIsAuthenticatedStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVUpdate => RETURN[ GVUpdateStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVUpdateAll => RETURN[ GVUpdateAllStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVWait => RETURN[ GVWaitStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVFlushCache => RETURN[ GVFlushCacheStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVSaveCache => RETURN[ GVSaveCacheStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVRestoreCache => RETURN[ GVRestoreCacheStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GVHostFromInstance => RETURN[ GVHostFromInstanceStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. GVGetAttributeStub: --PROCEDURE [rName: ROPE, attribute: ATOM, default: -- ROPE] -- RETURNS [value: ROPE]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; attribute: ATOM; default: ROPE; value: ROPE; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. BEGIN -- Unmarshal attribute: ATOM from pkt.data[pktLength]. [attribute, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength]; END; -- Unmarshal attribute. BEGIN -- Unmarshal default: ROPE from pkt.data[pktLength]. [default, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal default. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [value] ← GVGetAttribute[rName, attribute, default]; pktLength ← 0; BEGIN -- Marshal value: ROPE to pkt.data[pktLength]. pktLength ← Lupine.MarshalRope[value, pkt, pktLength, FALSE]; END; -- Marshal value. RETURN[returnLength: pktLength]; END; -- GVGetAttributeStub. GVSetAttributeStub: --PROCEDURE [rName: ROPE, attribute: ATOM, value: -- ROPE]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; attribute: ATOM; value: ROPE; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. BEGIN -- Unmarshal attribute: ATOM from pkt.data[pktLength]. [attribute, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength]; END; -- Unmarshal attribute. BEGIN -- Unmarshal value: ROPE from pkt.data[pktLength]. [value, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal value. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; GVSetAttribute[rName, attribute, value]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVSetAttributeStub. GVGetAttributeSeqStub: --PROCEDURE [rName: ROPE, attribute: ATOM] -- RETURNS [value: AttributeSeq]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; attribute: ATOM; value: AttributeSeq; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. BEGIN -- Unmarshal attribute: ATOM from pkt.data[pktLength]. [attribute, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength]; END; -- Unmarshal attribute. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [value] ← GVGetAttributeSeq[rName, attribute]; pktLength ← 0; BEGIN -- Marshal value: AttributeSeq to pkt.data[pktLength]. pktLength ← MarshalAttributeSeq[value, pkt, pktLength]; END; -- Marshal value. RETURN[returnLength: pktLength]; END; -- GVGetAttributeSeqStub. GVSetAttributeSeqStub: --PROCEDURE [rName: ROPE, attribute: ATOM, -- value: AttributeSeq]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; attribute: ATOM; value: AttributeSeq; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. BEGIN -- Unmarshal attribute: ATOM from pkt.data[pktLength]. [attribute, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength]; END; -- Unmarshal attribute. BEGIN -- Unmarshal value: AttributeSeq from pkt.data[pktLength]. [value, pktLength] ← UnmarshalAttributeSeq[pkt, pktLength]; END; -- Unmarshal value. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; GVSetAttributeSeq[rName, attribute, value]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVSetAttributeSeqStub. GVGetAttributesStub: --PROCEDURE [rName: ROPE] RETURNS [value: AttributeSeq]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; value: AttributeSeq; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; [value] ← GVGetAttributes[rName]; pktLength ← 0; BEGIN -- Marshal value: AttributeSeq to pkt.data[pktLength]. pktLength ← MarshalAttributeSeq[value, pkt, pktLength]; END; -- Marshal value. RETURN[returnLength: pktLength]; END; -- GVGetAttributesStub. GVAuthenticateStub: --PROCEDURE [rName: ROPE, key: RPC.EncryptionKey] -- RETURNS [authenticity: Authenticity]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; key: RPC.EncryptionKey; ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, key (1): RPC.EncryptionKey]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ authenticity (0): Authenticity]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay; pktLength: RpcPrivate.DataLength ← 5; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [key: key] ← argPkt↑; END; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; resPkt ← @pkt.data[0]; IF onePkt THEN [resPkt.authenticity] ← GVAuthenticate[rName, argPkt.key] ELSE [resPkt.authenticity] ← GVAuthenticate[rName, key]; END; -- OnePkt. pktLength ← 1; RETURN[returnLength: pktLength]; END; -- GVAuthenticateStub. GVIsAuthenticatedStub: --PROCEDURE [rName: ROPE] RETURNS [authenticity: -- Authenticity]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ authenticity (0): Authenticity]; resPkt: LONG POINTER TO ResultOverlay; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; resPkt ← @pkt.data[0]; [resPkt.authenticity] ← GVIsAuthenticated[rName]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- GVIsAuthenticatedStub. GVUpdateStub: --PROCEDURE [rName: ROPE]-- RpcPrivate.Dispatcher = INLINE BEGIN rName: ROPE; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal rName: ROPE from pkt.data[pktLength]. [rName, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal rName. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; GVUpdate[rName]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVUpdateStub. GVUpdateAllStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; GVUpdateAll[]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVUpdateAllStub. GVWaitStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; GVWait[]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVWaitStub. GVFlushCacheStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; GVFlushCache[]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVFlushCacheStub. GVSaveCacheStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; GVSaveCache[]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVSaveCacheStub. GVRestoreCacheStub: --PROCEDURE-- RpcPrivate.Dispatcher = INLINE BEGIN pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; GVRestoreCache[]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- GVRestoreCacheStub. GVHostFromInstanceStub: --PROCEDURE [instance: Rope.ROPE] RETURNS -- [anonP1id3264091: VoiceUtils.NetAddress]-- RpcPrivate.Dispatcher = INLINE BEGIN instance: Rope.ROPE; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ anonP1id3264091 (0): VoiceUtils.NetAddress]; resPkt: LONG POINTER TO ResultOverlay; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal instance: Rope.ROPE from pkt.data[pktLength]. [instance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal instance. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; resPkt ← @pkt.data[0]; [resPkt.anonP1id3264091] ← GVHostFromInstance[instance]; pktLength ← 3; RETURN[returnLength: pktLength]; END; -- GVHostFromInstanceStub. -- Marshall/Unmarshal procedures. MarshalAttributeSeq: PROC[value: NamesGV.AttributeSeq, pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { BEGIN -- Marshal value↑: NamesGV.AttributeSeqRec to pkt.data[pktLength]. IF pktLength+3 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: 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[NamesGV.AttributeSeqRec[LENGTH[DESCRIPTOR[value↑]]]], alwaysOnePkt: FALSE]; BEGIN OPEN record: value↑; BEGIN -- Marshal record.s: SEQUENCE maxLength: CARDINAL OF NamesGV.AttributeSeqValue -- to pkt.data[pktLength]. -- The sequence's length was carried by its record. FOR element3: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]]) DO BEGIN -- Marshal record.s[element3]: NamesGV.AttributeSeqValue -- to pkt.data[pktLength]. BEGIN OPEN record: record.s[element3]; BEGIN -- Marshal record.attributeName: ATOM to pkt.data[pktLength]. pktLength ← Lupine.MarshalAtom[record.attributeName, pkt, pktLength]; END; -- Marshal record.attributeName. BEGIN -- Marshal record.attributeValue: NamesGV.ROPE to -- pkt.data[pktLength]. pktLength ← Lupine.MarshalRope[record.attributeValue, pkt, pktLength, FALSE]; END; -- Marshal record.attributeValue. END; -- OPEN record: record.s[element3]. END; -- Marshal record.s[element3]. ENDLOOP; -- FOR element3. END; -- Marshal record.s. END; -- OPEN record: value↑. END; -- IF value # NIL. END; -- Marshal value↑. };END; UnmarshalAttributeSeq: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength] RETURNS[value: NamesGV.AttributeSeq, pktLength: RpcPrivate.DataLength] = BEGIN pktLength ← pktLength0; { BEGIN -- Unmarshal value↑: NamesGV.AttributeSeqRec from pkt.data[pktLength]. recordIsNIL: Lupine.NilHeader; IF pktLength+3 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; 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[NamesGV.AttributeSeqRec[Lupine.SHORT[seqLength]]]); pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: LOOPHOLE[value], dataLength: SIZE[NamesGV.AttributeSeqRec[LENGTH[DESCRIPTOR[value↑]]]], alwaysOnePkt: FALSE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: value↑; FOR element2: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]]) DO BEGIN OPEN record: record.s[element2]; LOOPHOLE[record.attributeName, LONG POINTER] ← NIL; LOOPHOLE[record.attributeValue, LONG POINTER] ← NIL; END; -- OPEN record: record.s[element2]. ENDLOOP; -- FOR element2. END; -- OPEN record: value↑. BEGIN OPEN record: value↑; BEGIN -- Unmarshal record.s: SEQUENCE maxLength: CARDINAL -- OF NamesGV.AttributeSeqValue from pkt.data[pktLength]. -- The sequence's length was carried by its record. FOR element3: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]]) DO BEGIN -- Unmarshal record.s[element3]: NamesGV.AttributeSeqValue -- from pkt.data[pktLength]. BEGIN OPEN record: record.s[element3]; BEGIN -- Unmarshal record.attributeName: ATOM from pkt.data[pktLength]. [record.attributeName, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength]; END; -- Unmarshal record.attributeName. BEGIN -- Unmarshal record.attributeValue: NamesGV.ROPE -- from pkt.data[pktLength]. [record.attributeValue, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE]; END; -- Unmarshal record.attributeValue. END; -- OPEN record: record.s[element3]. END; -- Unmarshal record.s[element3]. ENDLOOP; -- FOR element3. END; -- Unmarshal record.s. END; -- OPEN record: value↑. END; -- IF recordIsNIL. END; -- Unmarshal value↑. };END; -- No module initialization. END. -- NamesGVRpcServerImpl.