-- Stub file  was translated on January 13, 1985 12:57:44 pm PST by Lupine of July 22, 1984 2:36:32 pm PDT
-- Source interface ThParty came from file ThParty.bcd, which was created on January 13, 1985 12:57:40 pm PST with version stamp 323#367#35722265661 from source of September 6, 1984 5:31:52 pm PDT.

-- 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 [InterfaceName, standardZones, Zones],
  RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, 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, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord,
      -- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader,
      -- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError,
      -- WordsForChars]--,
  LupineRuntimeExtras --USING SOME OF [MarshalRope, MarshalAtom, UnmarshalRope,
      -- UnmarshalAtom]--,
  Atom --USING SOME OF [GetPName, MakeAtom]--,
  Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--;


ThPartyRpcClientImpl: MONITOR
  IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, LupineRuntimeExtras:
      LupineRuntimeExtras, Atom, Rope
  EXPORTS ThParty, ThPartyRpcControl
  SHARES  ThParty, ThPartyRpcControl, Rope
  = BEGIN OPEN ThParty, RpcControl: ThPartyRpcControl, 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]};
    IF bound THEN Lupine.BindingError;
    myInterface ← RpcPrivate.ImportInterface [
      interface: [
        type: IF ~IsNull[interfaceName.type]
          THEN interfaceName.type ELSE "ThParty~323#367#35722265661",
        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.

  Alert: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials: Credentials,
      state: StateInConv, reason: Reason, calledPartyID: PartyHandle, urgency:
      CallUrgency, alertKind: AlertKind, newConv: BOOL, comment: ROPE]
    RETURNS [--nb:-- NB, --convID:-- ConversationHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Alert, 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];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+49] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 15;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials, state: state, reason: reason,
        calledPartyID: calledPartyID, urgency: urgency, alertKind: alertKind,
        newConv: newConv];
    BEGIN  -- Marshal comment: ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[comment, pkt, pktLength];
      END;  -- Marshal comment.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 3, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 3];
    RETURN[resPkt.nb, resPkt.convID];
    END;  -- Alert.

  Advance: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials: Credentials,
      state: StateInConv, reason: Reason, comment: ROPE]
    RETURNS [--nb:-- NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Advance, credentials
        (1): Credentials, state (8): StateInConv, reason (9): Reason];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+44] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 10;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials, state: state, reason: reason];
    BEGIN  -- Marshal comment: ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[comment, pkt, pktLength];
      END;  -- Marshal comment.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.nb];
    END;  -- Advance.

  CreateConversation: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials:
      Credentials, urgency: CallUrgency, alertKind: AlertKind]
    RETURNS [--nb:-- NB, --convID:-- ConversationHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← CreateConversation,
        credentials (1): Credentials, urgency (8): CallUrgency, alertKind
        (9): AlertKind];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, convID (1): ConversationHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+10] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 10;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials, urgency: urgency, alertKind:
        alertKind];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 3, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 3];
    RETURN[resPkt.nb, resPkt.convID];
    END;  -- CreateConversation.

  MergeConversations: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials:
      Credentials, otherStateID: StateID, otherConvID: ConversationHandle]
    RETURNS [--nb:-- NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← MergeConversations,
        credentials (1): Credentials, otherStateID (8): StateID, otherConvID
        (9): ConversationHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+11] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 11;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials, otherStateID: otherStateID,
        otherConvID: otherConvID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.nb];
    END;  -- MergeConversations.

  SetSubject: PUBLIC SAFE PROCEDURE [shh: SHHH, convID: ConversationHandle,
      subject: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← SetSubject, convID
        (1): ConversationHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+37] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [convID: convID];
    BEGIN  -- Marshal subject: ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[subject, pkt, pktLength];
      END;  -- Marshal subject.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- SetSubject.

  GetSubject: PUBLIC SAFE PROCEDURE [shh: SHHH, convID: ConversationHandle]
      RETURNS [subject: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetSubject, convID
        (1): ConversationHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+34] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [convID: convID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 34, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal subject: ROPE from pkt.data[pktLength].
      [subject, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal subject.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[subject];
    END;  -- GetSubject.

  OtherParty: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials: Credentials]
      RETURNS [--nb:-- NB, --partyID:-- PartyHandle, --description:-- Thrush.ROPE,
      --conference:-- BOOL] =
    TRUSTED BEGIN
    description: Thrush.ROPE;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← OtherParty, credentials
        (1): Credentials];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, partyID (1): PartyHandle, conference (3): BOOL];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+38] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 8;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 38, signalHandler: ClientDispatcher];
    pktLength ← 4;
    BEGIN  -- Unmarshal description: Thrush.ROPE from pkt.data[pktLength].
      [description, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal description.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[resPkt.nb, resPkt.partyID, description, resPkt.conference];
    END;  -- OtherParty.

  DescribeParty: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle]
      RETURNS [description: Thrush.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← DescribeParty, partyID
        (1): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+34] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 34, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal description: Thrush.ROPE from pkt.data[pktLength].
      [description, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal description.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[description];
    END;  -- DescribeParty.

  ConversationsForParty: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID:
      PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ConversationsForParty,
        partyID (1): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- ConversationsForParty.

  SetIntervals: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials: Credentials,
      intervalSpecs: Thrush.IntervalSpecs]
    RETURNS [--nb:-- NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← SetIntervals, credentials
        (1): Credentials];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 8;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials];
    BEGIN  -- Marshal intervalSpecs: Thrush.IntervalSpecs to pkt.data[pktLength].
      thisNode1: Thrush.IntervalSpecs;
      listLength: Lupine.ListHeader ← 0;
      FOR thisNode1 ← intervalSpecs, thisNode1.rest UNTIL thisNode1
          = NIL DO
        listLength ← listLength + 1;  ENDLOOP;
      IF pktLength+2 > RpcPrivate.maxDataLength
        THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
      Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← listLength;
      pktLength ← pktLength + 2;
      FOR thisNode1 ← intervalSpecs, thisNode1.rest UNTIL thisNode1
          = NIL DO
        BEGIN  -- Marshal thisNode1.first: Thrush.IntervalSpec to pkt.data[pktLength].
          pktLength ← MarshalThrushDotIntervalSpec[thisNode1.first,
              pkt, pktLength];
          END;  -- Marshal thisNode1.first.
        ENDLOOP;  -- FOR thisNode1.
      END;  -- Marshal intervalSpecs.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.nb];
    END;  -- SetIntervals.

  DescribeInterval: PUBLIC SAFE PROCEDURE [shhh: SHHH, credentials:
      Credentials, targetInterval: Thrush.IntervalSpec, minSilence: Thrush.VoiceTime]
    RETURNS [nb: NB, exists: BOOL, intervals: Thrush.IntervalSpecs]
        =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← DescribeInterval,
        credentials (1): Credentials, minSilence (8): Thrush.VoiceTime];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, exists (1): BOOL];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 10;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shhh];
    argPkt↑ ← [credentials: credentials, minSilence: minSilence];
    BEGIN  -- Marshal targetInterval: Thrush.IntervalSpec to pkt.data[pktLength].
      pktLength ← MarshalThrushDotIntervalSpec[targetInterval, pkt,
          pktLength];
      END;  -- Marshal targetInterval.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 254, signalHandler: ClientDispatcher];
    pktLength ← 2;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [nb: nb, exists: exists] ← resPkt↑;
      END;
    BEGIN  -- Unmarshal intervals: Thrush.IntervalSpecs from pkt.data[pktLength].
      lastNode: Thrush.IntervalSpecs ← (intervals ← NIL);
      listLength: Lupine.ListHeader;
      IF pktLength+2 > RpcPrivate.maxDataLength
        THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
            pktLength];
      listLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
      pktLength ← pktLength + 2;
      WHILE listLength > 0 DO
        thisNode1: Thrush.IntervalSpecs = paramZones.gc.CONS[--DefaultValue--,NIL];
        BEGIN  -- Unmarshal thisNode1.first: Thrush.IntervalSpec from
            -- pkt.data[pktLength].
          [thisNode1.first, pktLength] ← UnmarshalThrushDotIntervalSpec[pkt,
              pktLength];
          END;  -- Unmarshal thisNode1.first.
        IF lastNode # NIL
          THEN lastNode ← (lastNode.rest ← thisNode1)
          ELSE lastNode ← (intervals ← thisNode1);
        listLength ← listLength - 1;
        ENDLOOP;  -- WHILE listLength > 0.
      END;  -- Unmarshal intervals.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    IF onePkt
      THEN RETURN[resPkt.nb, resPkt.exists, intervals]
      ELSE RETURN[nb, exists, intervals];
    END;  -- OnePkt.
    END;  -- DescribeInterval.

  RegisterKey: PUBLIC SAFE PROCEDURE [shh: SHHH, credentials: Credentials,
      key: Thrush.EncryptionKey]
    RETURNS [--nb:-- NB, --keyIndex:-- [0..15]] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← RegisterKey, credentials
        (1): Credentials, key (8): Thrush.EncryptionKey];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): NB, keyIndex (1): [0..15]];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+12] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 12;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [credentials: credentials, key: key];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.nb, resPkt.keyIndex];
    END;  -- RegisterKey.

  CreateParty: PUBLIC SAFE PROCEDURE [shh: SHHH, rName: Rname, type:
      Thrush.PartyType]
    RETURNS [--partyID:-- PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← CreateParty, type
        (1): Thrush.PartyType];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        partyID (0): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+36] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 2;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [type: type];
    BEGIN  -- Marshal rName: Rname to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[rName, pkt, pktLength];
      END;  -- Marshal rName.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.partyID];
    END;  -- CreateParty.

  GetParty: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      rName: Rname]
    RETURNS [--newPartyID:-- PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetParty, partyID
        (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+37] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    BEGIN  -- Marshal rName: Rname to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[rName, pkt, pktLength];
      END;  -- Marshal rName.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.newPartyID];
    END;  -- GetParty.

  GetJayParty: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle]
      RETURNS [--newPartyID:-- PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetJayParty, partyID
        (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.newPartyID];
    END;  -- GetJayParty.

  GetPartyFromNumber: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      phoneNumber: Thrush.ROPE, description: ROPE, trunkOK: BOOL]
    RETURNS [--newPartyID:-- PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetPartyFromNumber,
        partyID (1): PartyHandle, trunkOK (3): BOOL];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+72] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID, trunkOK: trunkOK];
    BEGIN  -- Marshal phoneNumber: Thrush.ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[phoneNumber, pkt,
          pktLength];
      END;  -- Marshal phoneNumber.
    BEGIN  -- Marshal description: ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[description, pkt,
          pktLength];
      END;  -- Marshal description.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.newPartyID];
    END;  -- GetPartyFromNumber.

  GetPartyFromFeepNum: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      feepNum: Thrush.ROPE]
    RETURNS [--newPartyID:-- PartyHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetPartyFromFeepNum,
        partyID (1): PartyHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        newPartyID (0): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+37] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    BEGIN  -- Marshal feepNum: Thrush.ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[feepNum, pkt, pktLength];
      END;  -- Marshal feepNum.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.newPartyID];
    END;  -- GetPartyFromFeepNum.

  ReleaseTrunkParty: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle]
      =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReleaseTrunkParty,
        partyID (1): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- ReleaseTrunkParty.

  GetRname: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle]
      RETURNS [Rname: Thrush.Rname] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetRname, partyID
        (1): PartyHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+34] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 34, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal Rname: Thrush.Rname from pkt.data[pktLength].
      [Rname, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt, pktLength];
      END;  -- Unmarshal Rname.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[Rname];
    END;  -- GetRname.

  Register: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      interface: SmartsInterface, properties: ThSmarts.SmartsProperties,
      oldSmartsID: SmartsHandle]
    RETURNS [--smartsID:-- SmartsHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Register, partyID
        (1): PartyHandle, properties (3): ThSmarts.SmartsProperties, oldSmartsID
        (5): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        smartsID (0): SmartsHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+82] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID, properties: properties, oldSmartsID:
        oldSmartsID];
    BEGIN  -- Marshal interface: SmartsInterface to pkt.data[pktLength].
      pktLength ← MarshalSmartsInterface[interface, pkt, pktLength];
      END;  -- Marshal interface.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.smartsID];
    END;  -- Register.

  RegisterClone: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      clonePartyID: PartyHandle, oldSmartsID: SmartsHandle]
    RETURNS [--smartsID:-- SmartsHandle] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← RegisterClone, partyID
        (1): PartyHandle, clonePartyID (3): PartyHandle, oldSmartsID (5):
        SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        smartsID (0): SmartsHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+7] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID, clonePartyID: clonePartyID, oldSmartsID:
        oldSmartsID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.smartsID];
    END;  -- RegisterClone.

  Deregister: PUBLIC SAFE PROCEDURE [shh: SHHH, smartsID: SmartsHandle]
      =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Deregister, smartsID
        (1): SmartsHandle];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [smartsID: smartsID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- Deregister.

  Enable: PUBLIC SAFE PROCEDURE [shh: SHHH, smartsID: SmartsHandle]
      RETURNS [--nb:-- Thrush.NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Enable, smartsID
        (1): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): Thrush.NB];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [smartsID: smartsID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.nb];
    END;  -- Enable.

  Disable: PUBLIC SAFE PROCEDURE [shh: SHHH, smartsID: SmartsHandle]
      RETURNS [--nb:-- Thrush.NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← Disable, smartsID
        (1): SmartsHandle];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nb (0): Thrush.NB];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [smartsID: smartsID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.nb];
    END;  -- Disable.

  GetNumbersForRName: PUBLIC SAFE PROCEDURE [shh: SHHH, rName: ROPE]
      RETURNS [fullRName: ROPE, number: ROPE, homeNumber: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetNumbersForRName];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+102] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt.transferIndex ← GetNumbersForRName;
    BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
      pktLength ← LupineRuntimeExtras.MarshalRope[rName, pkt, pktLength];
      END;  -- Marshal rName.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 102, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal fullRName: ROPE from pkt.data[pktLength].
      [fullRName, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal fullRName.
    BEGIN  -- Unmarshal number: ROPE from pkt.data[pktLength].
      [number, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal number.
    BEGIN  -- Unmarshal homeNumber: ROPE from pkt.data[pktLength].
      [homeNumber, pktLength] ← LupineRuntimeExtras.UnmarshalRope[pkt,
          pktLength];
      END;  -- Unmarshal homeNumber.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[fullRName, number, homeNumber];
    END;  -- GetNumbersForRName.

  SetRingEnable: PUBLIC SAFE PROCEDURE [shh: SHHH, partyID: PartyHandle,
      ringEnable: Thrush.RingEnable, ringInterval: INT, update: BOOL] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← SetRingEnable, partyID
        (1): PartyHandle, ringEnable (3): Thrush.RingEnable, ringInterval
        (4): INT, update (6): BOOL];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+7] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        shh];
    argPkt↑ ← [partyID: partyID, ringEnable: ringEnable, ringInterval:
        ringInterval, update: update];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- SetRingEnable.


-- 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.
MarshalSmartsInterface: PROC[value: ThParty.SmartsInterface, pkt: RpcPrivate.StubPkt,
    pktLength0: RpcPrivate.DataLength]
  RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN
  pktLength ← pktLength0; {
  pkt.data[pktLength] ← value=NIL;  pktLength ← pktLength+1;
  IF value # NIL THEN
    BEGIN  -- Marshal value↑: ThSmarts.SmartsInterfaceRecord to pkt.data[pktLength].
      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
          dataAdr: LOOPHOLE[value], dataLength: SIZE[ThSmarts.SmartsInterfaceRecord],
          alwaysOnePkt: TRUE];
      BEGIN OPEN record: value↑;
      BEGIN  -- Marshal record.type: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← LupineRuntimeExtras.MarshalRope[record.type, pkt,
            pktLength];
        END;  -- Marshal record.type.
      BEGIN  -- Marshal record.instance: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← LupineRuntimeExtras.MarshalRope[record.instance,
            pkt, pktLength];
        END;  -- Marshal record.instance.
      END;  -- OPEN record: value↑.
      END;  -- Marshal value↑.
  };END;

MarshalThrushDotIntervalSpec: PROC[value: Thrush.IntervalSpec, pkt:
    RpcPrivate.StubPkt, pktLength0: RpcPrivate.DataLength]
  RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN
  pktLength ← pktLength0; {
  IF pktLength+1 > RpcPrivate.maxDataLength
    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
  pkt.data[pktLength] ← value=NIL;  pktLength ← pktLength+1;
  IF value # NIL THEN
    BEGIN  -- Marshal value↑: Thrush.IntervalSpecBody to pkt.data[pktLength].
      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
          dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.IntervalSpecBody],
          alwaysOnePkt: FALSE];
      END;  -- Marshal value↑.
  };END;

UnmarshalThrushDotIntervalSpec: PROC[pkt: RpcPrivate.StubPkt, pktLength0:
    RpcPrivate.DataLength]
  RETURNS[value: Thrush.IntervalSpec, pktLength: RpcPrivate.DataLength]
      = BEGIN
  pktLength ← pktLength0; {
  isNIL: Lupine.NilHeader;
  IF pktLength+1 > RpcPrivate.maxDataLength
    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength];
  isNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
  IF isNIL
    THEN value ← NIL
    ELSE BEGIN
      value ← (paramZones.gc.NEW[Thrush.IntervalSpecBody]);
      BEGIN  -- Unmarshal value↑: Thrush.IntervalSpecBody from pkt.data[pktLength].
        pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
            dataAdr: LOOPHOLE[value], dataLength: SIZE[Thrush.IntervalSpecBody],
            alwaysOnePkt: FALSE];
        END;  -- Unmarshal value↑.
      END;  -- IF isNIL.
  };END;



-- No module initialization.

END.  -- ThPartyRpcClientImpl.