-- Stub file  was translated on January 3, 1984 0:09 am by Lupine of December 20, 1983 1:22 pm
-- Source interface ThParty came from file ThParty.bcd, which was created on January 3, 1984 0:09 am with version stamp 137B#133B#34120436254B from source of December 28, 1983 11:09 pm.

-- The RPC stub modules for ThParty are:
--   ThPartyRpcControl.mesa;
--   ThPartyRpcClientImpl.mesa;
--   ThPartyRpcBinderImpl.mesa;
--   ThPartyRpcServerImpl.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
  Basics,
  Lark,
  Thrush,
  ThSmarts,
  ThParty,
  ThPartyRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion,
      ProcedureIndex, SignalIndex],
  RPC USING [EncryptionKey, InterfaceName, Principal, standardZones,
      Zones],
  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, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord,
      -- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader,
      -- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError,
      -- WordsForChars]--,
  Atom --USING SOME OF [GetPName, MakeAtom]--,
  Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--;


ThPartyRpcServerImpl: MONITOR
  IMPORTS ThParty, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom,
      Rope
  EXPORTS ThPartyRpcControl
  SHARES  ThParty, ThPartyRpcControl, Rope
  = BEGIN OPEN ThParty, RpcControl: ThPartyRpcControl, 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 "ThParty~137B#133B#34120436254B",
        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
      Alert => RETURN[
        AlertStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Advance => RETURN[
        AdvanceStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      CreateConversation => RETURN[
        CreateConversationStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      MergeConversations => RETURN[
        MergeConversationsStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      SetSubject => RETURN[
        SetSubjectStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      GetSubject => RETURN[
        GetSubjectStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      OtherParty => RETURN[
        OtherPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      DescribeParty => RETURN[
        DescribePartyStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      ConversationsForParty => RETURN[
        ConversationsForPartyStub[pkt: pkt, callLength: callLength,
            lastPkt: lastPkt, localConversation: localConversation]];
      SetInterval => RETURN[
        SetIntervalStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      RegisterKey => RETURN[
        RegisterKeyStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      CreateParty => RETURN[
        CreatePartyStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      GetParty => RETURN[
        GetPartyStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      GetJayParty => RETURN[
        GetJayPartyStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      GetPartyFromNumber => RETURN[
        GetPartyFromNumberStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      GetPartyFromFeepNum => RETURN[
        GetPartyFromFeepNumStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      ReleaseTrunkParty => RETURN[
        ReleaseTrunkPartyStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      GetRname => RETURN[
        GetRnameStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Register => RETURN[
        RegisterStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      RegisterClone => RETURN[
        RegisterCloneStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      Deregister => RETURN[
        DeregisterStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Enable => RETURN[
        EnableStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Disable => RETURN[
        DisableStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      GetNumbersForRName => RETURN[
        GetNumbersForRNameStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      ENDCASE => RETURN[Lupine.DispatchingError[]];

    END;  -- ServerDispatcher


-- Public procedure dispatcher stubs.

  AlertStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, state:
      -- StateInConv, reason: Reason, calledPartyID: PartyHandle, urgency:
      -- CallUrgency, alertKind: AlertKind, newConv: BOOL, comment: ROPE]
    -- RETURNS [nb: NB, convID: ConversationHandle]-- RpcPrivate.Dispatcher
        =
    BEGIN
    comment: ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials, state (8): StateInConv, reason (9): Reason, calledPartyID
        (10): PartyHandle, urgency (12): CallUrgency, alertKind (13): AlertKind,
        newConv (14): BOOL];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, convID (1): ConversationHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 15;
    BEGIN  -- Unmarshal comment: ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN comment ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          comment ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal comment.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb, resPkt.convID] ←
      Alert[localConversation, argPkt.credentials, argPkt.state, argPkt.reason,
          argPkt.calledPartyID, argPkt.urgency, argPkt.alertKind, argPkt.newConv,
          comment];
    pktLength ← 3;
    RETURN[returnLength: pktLength];
    END;  -- AlertStub.

  AdvanceStub: --PROCEDURE [shhh: SHHH, credentials: Credentials, state:
      -- StateInConv, reason: Reason, comment: ROPE]
    -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher =
    BEGIN
    comment: ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials, state (8): StateInConv, reason (9): Reason];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 10;
    BEGIN  -- Unmarshal comment: ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN comment ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          comment ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal comment.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb] ← Advance[localConversation, argPkt.credentials, argPkt.state,
        argPkt.reason, comment];
    pktLength ← 1;
    RETURN[returnLength: pktLength];
    END;  -- AdvanceStub.

  CreateConversationStub: --PROCEDURE [shhh: SHHH, credentials: Credentials,
      -- urgency: CallUrgency, alertKind: AlertKind]
    -- RETURNS [nb: NB, convID: ConversationHandle]-- RpcPrivate.Dispatcher
        =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials, urgency (8): CallUrgency, alertKind (9): AlertKind];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, convID (1): ConversationHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 10;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb, resPkt.convID] ←
      CreateConversation[localConversation, argPkt.credentials, argPkt.urgency,
          argPkt.alertKind];
    pktLength ← 3;
    RETURN[returnLength: pktLength];
    END;  -- CreateConversationStub.

  MergeConversationsStub: --PROCEDURE [shhh: SHHH, credentials: Credentials,
      -- otherStateID: StateID, otherConvID: ConversationHandle]
    -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials, otherStateID (8): StateID, otherConvID (9): ConversationHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 11;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb] ← MergeConversations[localConversation, argPkt.credentials,
        argPkt.otherStateID, argPkt.otherConvID];
    pktLength ← 1;
    RETURN[returnLength: pktLength];
    END;  -- MergeConversationsStub.

  SetSubjectStub: --PROCEDURE [shh: SHHH, convID: ConversationHandle,
      -- subject: ROPE]-- RpcPrivate.Dispatcher =
    BEGIN
    subject: ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, convID (1): ConversationHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    BEGIN  -- Unmarshal subject: ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN subject ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          subject ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal subject.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    SetSubject[localConversation, argPkt.convID, subject];
    pktLength ← 0;
    RETURN[returnLength: pktLength];
    END;  -- SetSubjectStub.

  GetSubjectStub: --PROCEDURE [shh: SHHH, convID: ConversationHandle]
      -- RETURNS [subject: ROPE]-- RpcPrivate.Dispatcher =
    BEGIN
    subject: ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, convID (1): ConversationHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [subject] ← GetSubject[localConversation, argPkt.convID];
    pktLength ← 0;
    BEGIN  -- Marshal subject: ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← subject=NIL;  pktLength ← pktLength+1;
      IF subject # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: subject];
          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 subject # NIL.
      END;  -- Marshal subject.
    RETURN[returnLength: pktLength];
    END;  -- GetSubjectStub.

  OtherPartyStub: --PROCEDURE [shhh: SHHH, credentials: Credentials]
      -- RETURNS [nb: NB, partyID: PartyHandle, description: Thrush.ROPE,
      -- conference: BOOL]-- RpcPrivate.Dispatcher =
    BEGIN
    description: Thrush.ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, partyID (1): PartyHandle, conference (3): BOOL];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 8;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb, resPkt.partyID, description, resPkt.conference] ←
      OtherParty[localConversation, argPkt.credentials];
    pktLength ← 4;
    BEGIN  -- Marshal description: Thrush.ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← description=NIL;  pktLength ← pktLength+1;
      IF description # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: description];
          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 description # NIL.
      END;  -- Marshal description.
    RETURN[returnLength: pktLength];
    END;  -- OtherPartyStub.

  DescribePartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle]
      -- RETURNS [description: Thrush.ROPE]-- RpcPrivate.Dispatcher =
    BEGIN
    description: Thrush.ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [description] ← DescribeParty[localConversation, argPkt.partyID];
    pktLength ← 0;
    BEGIN  -- Marshal description: Thrush.ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← description=NIL;  pktLength ← pktLength+1;
      IF description # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: description];
          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 description # NIL.
      END;  -- Marshal description.
    RETURN[returnLength: pktLength];
    END;  -- DescribePartyStub.

  ConversationsForPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle]--
      RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    ConversationsForParty[localConversation, argPkt.partyID];
    pktLength ← 0;
    RETURN[returnLength: pktLength];
    END;  -- ConversationsForPartyStub.

  SetIntervalStub: --PROCEDURE [shhh: SHHH, credentials: Credentials,
      -- intervalSpec: Thrush.IntervalSpec]
    -- RETURNS [nb: NB]-- RpcPrivate.Dispatcher =
    BEGIN
    intervalSpec: Thrush.IntervalSpec;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 8;
    BEGIN  -- Unmarshal intervalSpec: Thrush.IntervalSpec from pkt.data[pktLength].
      isNIL: Lupine.NilHeader;
      isNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF isNIL
        THEN intervalSpec ← NIL
        ELSE BEGIN
          intervalSpec ← (paramZones.gc.NEW[Thrush.IntervalSpecBody]);
          BEGIN  -- Unmarshal intervalSpec↑: Thrush.IntervalSpecBody
              -- from pkt.data[pktLength].
            pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
                dataAdr: LOOPHOLE[intervalSpec], dataLength: SIZE[Thrush.IntervalSpecBody],
                alwaysOnePkt: TRUE];
            END;  -- Unmarshal intervalSpec↑.
          END;  -- IF isNIL.
      END;  -- Unmarshal intervalSpec.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb] ← SetInterval[localConversation, argPkt.credentials,
        intervalSpec];
    pktLength ← 1;
    RETURN[returnLength: pktLength];
    END;  -- SetIntervalStub.

  RegisterKeyStub: --PROCEDURE [shh: SHHH, credentials: Credentials,
      -- key: Thrush.EncryptionKey]
    -- RETURNS [nb: NB, keyIndex: [0..15]]-- RpcPrivate.Dispatcher
        =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Credentials, key (8): Thrush.EncryptionKey];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, keyIndex (1): [0..15]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 12;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb, resPkt.keyIndex] ←
      RegisterKey[localConversation, argPkt.credentials, argPkt.key];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- RegisterKeyStub.

  CreatePartyStub: --PROCEDURE [shh: SHHH, rName: Rname, type: Thrush.PartyType]
    -- RETURNS [partyID: PartyHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    rName: Rname;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, type (1): Thrush.PartyType];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        partyID (0): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 2;
    BEGIN  -- Unmarshal rName: Rname from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN rName ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          rName ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal rName.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.partyID] ← CreateParty[localConversation, rName, argPkt.type];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- CreatePartyStub.

  GetPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, rName:
      -- Rname]
    -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    rName: Rname;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    BEGIN  -- Unmarshal rName: Rname from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN rName ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          rName ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal rName.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.newPartyID] ← GetParty[localConversation, argPkt.partyID,
        rName];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- GetPartyStub.

  GetJayPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle] RETURNS
      -- [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.newPartyID] ← GetJayParty[localConversation, argPkt.partyID];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- GetJayPartyStub.

  GetPartyFromNumberStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle,
      -- phoneNumber: Thrush.ROPE, description: ROPE, trunkOK: BOOL]
    -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    phoneNumber: Thrush.ROPE;
    description: ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle,
        trunkOK (3): BOOL];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    BEGIN  -- Unmarshal phoneNumber: Thrush.ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN phoneNumber ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          phoneNumber ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal phoneNumber.
    BEGIN  -- Unmarshal description: ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN description ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          description ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal description.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.newPartyID] ← GetPartyFromNumber[localConversation, argPkt.partyID,
        phoneNumber, description, argPkt.trunkOK];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- GetPartyFromNumberStub.

  GetPartyFromFeepNumStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle,
      -- feepNum: Thrush.ROPE]
    -- RETURNS [newPartyID: PartyHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    feepNum: Thrush.ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    BEGIN  -- Unmarshal feepNum: Thrush.ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN feepNum ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          feepNum ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal feepNum.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.newPartyID] ← GetPartyFromFeepNum[localConversation, argPkt.partyID,
        feepNum];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- GetPartyFromFeepNumStub.

  ReleaseTrunkPartyStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle]--
      RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    ReleaseTrunkParty[localConversation, argPkt.partyID];
    pktLength ← 0;
    RETURN[returnLength: pktLength];
    END;  -- ReleaseTrunkPartyStub.

  GetRnameStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle] RETURNS
      -- [Rname: Thrush.Rname]-- RpcPrivate.Dispatcher =
    BEGIN
    Rname: Thrush.Rname;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [Rname] ← GetRname[localConversation, argPkt.partyID];
    pktLength ← 0;
    BEGIN  -- Marshal Rname: Thrush.Rname to pkt.data[pktLength].
      pkt.data[pktLength] ← Rname=NIL;  pktLength ← pktLength+1;
      IF Rname # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: Rname];
          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 Rname # NIL.
      END;  -- Marshal Rname.
    RETURN[returnLength: pktLength];
    END;  -- GetRnameStub.

  RegisterStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle, interface:
      -- SmartsInterface, properties: ThSmarts.SmartsProperties, oldSmartsID:
      -- SmartsHandle]
    -- RETURNS [smartsID: SmartsHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    interface: SmartsInterface;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle,
        properties (3): ThSmarts.SmartsProperties, oldSmartsID (5): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        smartsID (0): SmartsHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    BEGIN  -- Unmarshal interface: SmartsInterface from pkt.data[pktLength].
      isNIL: Lupine.NilHeader;
      isNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF isNIL
        THEN interface ← NIL
        ELSE BEGIN
          interface ← (paramZones.gc.NEW[ThSmarts.SmartsInterfaceRecord]);
          BEGIN  -- Unmarshal interface↑: ThSmarts.SmartsInterfaceRecord
              -- from pkt.data[pktLength].
            pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
                dataAdr: LOOPHOLE[interface], dataLength: SIZE[ThSmarts.SmartsInterfaceRecord],
                alwaysOnePkt: TRUE];
            -- Restore garbled REFs to NIL following copy.
            BEGIN OPEN record: interface↑;
            LOOPHOLE[record.type, LONG POINTER] ← NIL;
            LOOPHOLE[record.instance, LONG POINTER] ← NIL;
            END;  -- OPEN record: interface↑.
            BEGIN OPEN record: interface↑;
            BEGIN  -- Unmarshal record.type: ShortROPE from pkt.data[pktLength].
              ropeIsNIL: Lupine.NilHeader;
              ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
              IF ropeIsNIL
                THEN record.type ← NIL
                ELSE BEGIN
                  ropeLength: Lupine.RopeHeader;
                  textRope: Rope.Text;
                  ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
                  IF ropeLength > RpcPrivate.maxShortStringLength
                    THEN Lupine.UnmarshalingError;
                  record.type ← textRope ← Rope.NewText[size: ropeLength];
                  pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
                      pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
                      dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt:
                      TRUE];
                  END;  -- IF ropeIsNIL.
              END;  -- Unmarshal record.type.
            BEGIN  -- Unmarshal record.instance: ShortROPE from pkt.data[pktLength].
              ropeIsNIL: Lupine.NilHeader;
              ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
              IF ropeIsNIL
                THEN record.instance ← NIL
                ELSE BEGIN
                  ropeLength: Lupine.RopeHeader;
                  textRope: Rope.Text;
                  ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
                  IF ropeLength > RpcPrivate.maxShortStringLength
                    THEN Lupine.UnmarshalingError;
                  record.instance ← textRope ← Rope.NewText[size: ropeLength];
                  pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
                      pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
                      dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt:
                      TRUE];
                  END;  -- IF ropeIsNIL.
              END;  -- Unmarshal record.instance.
            END;  -- OPEN record: interface↑.
            END;  -- Unmarshal interface↑.
          END;  -- IF isNIL.
      END;  -- Unmarshal interface.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.smartsID] ← Register[localConversation, argPkt.partyID,
        interface, argPkt.properties, argPkt.oldSmartsID];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- RegisterStub.

  RegisterCloneStub: --PROCEDURE [shh: SHHH, partyID: PartyHandle,
      -- clonePartyID: PartyHandle, oldSmartsID: SmartsHandle]
    -- RETURNS [smartsID: SmartsHandle]-- RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, partyID (1): PartyHandle,
        clonePartyID (3): PartyHandle, oldSmartsID (5): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        smartsID (0): SmartsHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.smartsID] ← RegisterClone[localConversation, argPkt.partyID,
        argPkt.clonePartyID, argPkt.oldSmartsID];
    pktLength ← 2;
    RETURN[returnLength: pktLength];
    END;  -- RegisterCloneStub.

  DeregisterStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle]--
      RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    Deregister[localConversation, argPkt.smartsID];
    pktLength ← 0;
    RETURN[returnLength: pktLength];
    END;  -- DeregisterStub.

  EnableStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle] RETURNS
      -- [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): Thrush.NB];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb] ← Enable[localConversation, argPkt.smartsID];
    pktLength ← 1;
    RETURN[returnLength: pktLength];
    END;  -- EnableStub.

  DisableStub: --PROCEDURE [shh: SHHH, smartsID: SmartsHandle] RETURNS
      -- [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, smartsID (1): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): Thrush.NB];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [resPkt.nb] ← Disable[localConversation, argPkt.smartsID];
    pktLength ← 1;
    RETURN[returnLength: pktLength];
    END;  -- DisableStub.

  GetNumbersForRNameStub: --PROCEDURE [shh: SHHH, rName: ROPE] RETURNS
      -- [fullRName: ROPE, number: ROPE, homeNumber: ROPE]-- RpcPrivate.Dispatcher
      =
    BEGIN
    rName: ROPE;
    fullRName: ROPE;
    number: ROPE;
    homeNumber: ROPE;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal rName: ROPE from pkt.data[pktLength].
      ropeIsNIL: Lupine.NilHeader;
      ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
      IF ropeIsNIL
        THEN rName ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          rName ← textRope ← Rope.NewText[size: ropeLength];
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
              alwaysOnePkt: TRUE];
          END;  -- IF ropeIsNIL.
      END;  -- Unmarshal rName.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [fullRName, number, homeNumber] ←
      GetNumbersForRName[localConversation, rName];
    pktLength ← 0;
    BEGIN  -- Marshal fullRName: ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← fullRName=NIL;  pktLength ← pktLength+1;
      IF fullRName # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: fullRName];
          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 fullRName # NIL.
      END;  -- Marshal fullRName.
    BEGIN  -- Marshal number: ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← number=NIL;  pktLength ← pktLength+1;
      IF number # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: number];
          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 number # NIL.
      END;  -- Marshal number.
    BEGIN  -- Marshal homeNumber: ROPE to pkt.data[pktLength].
      pkt.data[pktLength] ← homeNumber=NIL;  pktLength ← pktLength+1;
      IF homeNumber # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.InlineFlatten[r: homeNumber];
          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 homeNumber # NIL.
      END;  -- Marshal homeNumber.
    RETURN[returnLength: pktLength];
    END;  -- GetNumbersForRNameStub.


-- No module initialization.

END.  -- ThPartyRpcServerImpl.