-- Copyright (C) 1985 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on July 19, 1985 11:00:06 am PDT by Lupine of May 23, 1985 8:38:08 am PDT
-- Source interface AlpineTransMgr came from file AlpineTransMgr.bcd, which was created on July 19, 1985 11:00:04 am PDT with version stamp 353#112#10053000062 from source of March 7, 1985 2:24:09 pm PST.

-- The RPC stub modules for AlpineTransMgr are:
--   AlpineTransMgrRpcControl.mesa;
--   AlpineTransMgrRpcClientImpl.mesa;
--   AlpineTransMgrRpcBinderImpl.mesa;
--   AlpineTransMgrRpcServerImpl.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
  AlpineEnvironment,
  AlpineTransMgr,
  RPC USING [defaultInterfaceName, EncryptionKey, InterfaceName, Principal,
      standardZones, VersionRange, Zones],
  RPCLupine USING [ImportHandle];


AlpineTransMgrRpcControl: DEFINITIONS
  SHARES  AlpineTransMgr
  = BEGIN OPEN AlpineTransMgr, RpcPublic: RPC, RpcPrivate: RPCLupine;


-- Public RPC types and constants.

  InterfaceName: TYPE = RpcPublic.InterfaceName;
  VersionRange: TYPE = RpcPublic.VersionRange;
  Principal: TYPE = RpcPublic.Principal;
  EncryptionKey: TYPE = RpcPublic.EncryptionKey;
  Zones: TYPE = RpcPublic.Zones;
  
  defaultInterfaceName: InterfaceName = RpcPublic.defaultInterfaceName;
  standardZones: Zones = RpcPublic.standardZones;


-- Standard remote binding routines.

  ImportInterface: SAFE PROCEDURE [
        interface: InterfaceRecord,
        interfaceName: InterfaceName ← defaultInterfaceName,
        parameterStorage: Zones ← standardZones ];


  ExportInterface: SAFE PROCEDURE [
        interfaceName: InterfaceName ← defaultInterfaceName,
        user: Principal,
        password: EncryptionKey,
        parameterStorage: Zones ← standardZones ];

  UnexportInterface: SAFE PROCEDURE;


-- Dynamic instantiation and binding.

  ImportNewInterface: SAFE PROCEDURE [
        interfaceName: InterfaceName ← defaultInterfaceName,
        parameterStorage: Zones ← standardZones ]
    RETURNS [interfaceRecord: InterfaceRecord];

  -- NewInterfaceRecord is necessary for Cedar clients who want to
  -- manufacture a private interface instance, because
  -- RpcBindingImpl has finalization on type InterfaceRecord.
  NewInterfaceRecord: SAFE PROCEDURE
    RETURNS [interfaceRecord: InterfaceRecord];

  InterfaceRecord: TYPE = REF InterfaceRecordObject;

  InterfaceRecordObject: TYPE = RECORD [
          myInterface: RpcPrivate.ImportHandle ← NIL,
      paramZones: RpcPublic.Zones ← RpcPublic.standardZones,
      clientStubRegisterWorker: PROCEDURE [interface: InterfaceRecord,
          conversation: AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID]
          RETURNS [RegisterWorkerResult],
      clientStubWorkerPrepare: PROCEDURE [interface: InterfaceRecord,
          conversation: AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID,
          newTrans: AlpineEnvironment.TransID] RETURNS [WorkerState],
      clientStubWorkerFinish: PROCEDURE [interface: InterfaceRecord,
          conversation: AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID,
          requiredOutcome: RequiredOutcome],
      Refused: ERROR [why: Refusal],
      bound: BOOL ← FALSE];

  RegisterWorker: PROCEDURE [interface: InterfaceRecord, conversation:
      AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID]
      RETURNS [RegisterWorkerResult] = INLINE  { RETURN interface.clientStubRegisterWorker[interface,
      conversation, trans]};
   WorkerPrepare: PROCEDURE [interface: InterfaceRecord, conversation:
      AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID,
      newTrans: AlpineEnvironment.TransID] RETURNS [WorkerState] = INLINE
       { RETURN interface.clientStubWorkerPrepare[interface, conversation,
      trans, newTrans]};
   WorkerFinish: PROCEDURE [interface: InterfaceRecord, conversation:
      AlpineEnvironment.Conversation, trans: AlpineEnvironment.TransID,
      requiredOutcome: RequiredOutcome] = INLINE  { interface.clientStubWorkerFinish[interface,
      conversation, trans, requiredOutcome]};
 
 -- Definitions for the stubs.
 
 LupineProtocolVersion: PUBLIC VersionRange = [first: 1, last: 1];
 
 InterMdsCallsOnly: PUBLIC BOOLEAN = FALSE;

  ProcedureIndex: PRIVATE TYPE = MACHINE DEPENDENT {
      LupineUnusedIndex (0), LupineLastIndex (3),
      RegisterWorker (4), WorkerPrepare (5), WorkerFinish (6)};

  SignalIndex: PRIVATE TYPE = MACHINE DEPENDENT {
      LupineUnusedIndex (0), LupineLastIndex (3),
      Refused (4)};


END.  -- AlpineTransMgrRpcControl.