-- Copyright (C) 1985 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on July 19, 1985 10:54:06 am PDT by Lupine of May 23, 1985 8:38:08 am PDT
-- Source interface AlpineFile came from file AlpineFile.bcd, which was created on July 19, 1985 10:53:53 am PDT with version stamp 353#114#10613107072 from source of July 19, 1985 9:11:54 am PDT.

-- The RPC stub modules for AlpineFile are:
--   AlpineFileRpcControl.mesa;
--   AlpineFileRpcClientImpl.mesa;
--   AlpineFileRpcBinderImpl.mesa;
--   AlpineFileRpcServerImpl.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 = FALSE
--   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,
  AlpineFile,
  RPC USING [defaultInterfaceName, EncryptionKey, InterfaceName, Principal,
      standardZones, VersionRange, Zones],
  RPCLupine USING [ImportHandle];


AlpineFileRpcControl: DEFINITIONS
  SHARES  AlpineFile
  = BEGIN OPEN AlpineFile, 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,
      clientStubOpen: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, transID: TransID, universalFile: UniversalFile,
          access: AccessRights, lock: LockOption, recoveryOption: RecoveryOption,
          referencePattern: ReferencePattern] RETURNS [openFileID: OpenFileID,
          fileID: FileID],
      clientStubCreate: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, transID: TransID, volumeID: VolOrVolGroupID, owner:
          OwnerName, initialSize: PageCount, recoveryOption: RecoveryOption,
          referencePattern: ReferencePattern] RETURNS [openFileID: OpenFileID,
          universalFile: UniversalFile],
      clientStubClose: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID],
      clientStubDelete: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID],
      clientStubGetUniversalFile: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [universalFile:
          UniversalFile],
      clientStubGetTransID: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [transID:
          TransID],
      clientStubGetAccessRights: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [access:
          AccessRights],
      clientStubGetLockOption: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [lock:
          LockOption],
      clientStubSetLockOption: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, lock: LockOption],
      clientStubGetRecoveryOption: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [recoveryOption:
          RecoveryOption],
      clientStubGetReferencePattern: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID] RETURNS [referencePattern:
          ReferencePattern],
      clientStubSetReferencePattern: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, referencePattern:
          ReferencePattern],
      clientStubReadPages: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID, pageRun: PageRun, pageBuffer:
          RESULTPageBuffer, lock: LockOption],
      clientStubWritePages: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, pageRun:
          PageRun, pageBuffer: VALUEPageBuffer, lock: LockOption],
      clientStubLockPages: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID, pageRun: PageRun, lock:
          LockOption],
      clientStubUnlockPages: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, pageRun:
          PageRun],
      clientStubReadProperties: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, desiredProperties:
          PropertySet, lock: LockOption] RETURNS [properties: LIST OF PropertyValuePair],
      clientStubWriteProperties: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, properties:
          LIST OF PropertyValuePair, lock: LockOption],
      clientStubUnlockVersion: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID],
      clientStubIncrementVersion: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, increment:
          LONG INTEGER],
      clientStubGetSize: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID, lock: LockOption] RETURNS
          [size: PageCount],
      clientStubSetSize: PROCEDURE [interface: InterfaceRecord, conversation:
          Conversation, openFileID: OpenFileID, size: PageCount, lock:
          LockOption],
      clientStubUnlockFile: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID],
      AccessFailed: ERROR [missingAccess: AlpineEnvironment.NeededAccess],
      LockFailed: ERROR [why: AlpineEnvironment.LockFailure],
      OperationFailed: ERROR [why: AlpineEnvironment.OperationFailure],
      StaticallyInvalid: ERROR,
      Unknown: ERROR [what: AlpineEnvironment.UnknownType],
      PossiblyDamaged: SIGNAL,
      bound: BOOL ← FALSE];

  Open: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      transID: TransID, universalFile: UniversalFile, access: AccessRights,
      lock: LockOption, recoveryOption: RecoveryOption, referencePattern:
      ReferencePattern] RETURNS [openFileID: OpenFileID, fileID: FileID]
      = INLINE  { RETURN interface.clientStubOpen[interface, conversation,
      transID, universalFile, access, lock, recoveryOption, referencePattern]};
   Create: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      transID: TransID, volumeID: VolOrVolGroupID, owner: OwnerName, initialSize:
      PageCount, recoveryOption: RecoveryOption, referencePattern: ReferencePattern]
      RETURNS [openFileID: OpenFileID, universalFile: UniversalFile] =
      INLINE  { RETURN interface.clientStubCreate[interface, conversation,
      transID, volumeID, owner, initialSize, recoveryOption, referencePattern]};
   Close: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      openFileID: OpenFileID] = INLINE  { interface.clientStubClose[interface,
      conversation, openFileID]};
   Delete: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      openFileID: OpenFileID] = INLINE  { interface.clientStubDelete[interface,
      conversation, openFileID]};
   GetUniversalFile: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [universalFile: UniversalFile]
      = INLINE  { RETURN interface.clientStubGetUniversalFile[interface,
      conversation, openFileID]};
   GetTransID: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [transID: TransID]
      = INLINE  { RETURN interface.clientStubGetTransID[interface, conversation,
      openFileID]};
   GetAccessRights: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [access: AccessRights]
      = INLINE  { RETURN interface.clientStubGetAccessRights[interface,
      conversation, openFileID]};
   GetLockOption: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [lock: LockOption]
      = INLINE  { RETURN interface.clientStubGetLockOption[interface,
      conversation, openFileID]};
   SetLockOption: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, lock: LockOption] = INLINE
       { interface.clientStubSetLockOption[interface, conversation, openFileID,
      lock]};
   GetRecoveryOption: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [recoveryOption: RecoveryOption]
      = INLINE  { RETURN interface.clientStubGetRecoveryOption[interface,
      conversation, openFileID]};
   GetReferencePattern: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] RETURNS [referencePattern:
      ReferencePattern] = INLINE  { RETURN interface.clientStubGetReferencePattern[interface,
      conversation, openFileID]};
   SetReferencePattern: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, referencePattern: ReferencePattern]
      = INLINE  { interface.clientStubSetReferencePattern[interface, conversation,
      openFileID, referencePattern]};
   ReadPages: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, pageRun: PageRun, pageBuffer:
      RESULTPageBuffer, lock: LockOption] = INLINE  { interface.clientStubReadPages[interface,
      conversation, openFileID, pageRun, pageBuffer, lock]};
   WritePages: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, pageRun: PageRun, pageBuffer:
      VALUEPageBuffer, lock: LockOption] = INLINE  { interface.clientStubWritePages[interface,
      conversation, openFileID, pageRun, pageBuffer, lock]};
   LockPages: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, pageRun: PageRun, lock: LockOption]
      = INLINE  { interface.clientStubLockPages[interface, conversation,
      openFileID, pageRun, lock]};
   UnlockPages: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, pageRun: PageRun] = INLINE
       { interface.clientStubUnlockPages[interface, conversation, openFileID,
      pageRun]};
   ReadProperties: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, desiredProperties: PropertySet,
      lock: LockOption] RETURNS [properties: LIST OF PropertyValuePair]
      = INLINE  { RETURN interface.clientStubReadProperties[interface,
      conversation, openFileID, desiredProperties, lock]};
   WriteProperties: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, properties: LIST OF PropertyValuePair,
      lock: LockOption] = INLINE  { interface.clientStubWriteProperties[interface,
      conversation, openFileID, properties, lock]};
   UnlockVersion: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] = INLINE  { interface.clientStubUnlockVersion[interface,
      conversation, openFileID]};
   IncrementVersion: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, increment: LONG INTEGER] =
      INLINE  { interface.clientStubIncrementVersion[interface, conversation,
      openFileID, increment]};
   GetSize: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      openFileID: OpenFileID, lock: LockOption] RETURNS [size: PageCount]
      = INLINE  { RETURN interface.clientStubGetSize[interface, conversation,
      openFileID, lock]};
   SetSize: PROCEDURE [interface: InterfaceRecord, conversation: Conversation,
      openFileID: OpenFileID, size: PageCount, lock: LockOption] = INLINE
       { interface.clientStubSetSize[interface, conversation, openFileID,
      size, lock]};
   UnlockFile: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID] = INLINE  { interface.clientStubUnlockFile[interface,
      conversation, openFileID]};
 
 -- Definitions for the stubs.
 
 LupineProtocolVersion: PUBLIC VersionRange = [first: 1, last: 1];
 
 InterMdsCallsOnly: PUBLIC BOOLEAN = FALSE;

  ProcedureIndex: PRIVATE TYPE = MACHINE DEPENDENT {
      LupineUnusedIndex (0), LupineLastIndex (3),
      Open (4), Create (5), Close (6), Delete (7), GetUniversalFile (8),
      GetTransID (9), GetAccessRights (10), GetLockOption (11), SetLockOption
      (12), GetRecoveryOption (13), GetReferencePattern (14), SetReferencePattern
      (15), ReadPages (16), WritePages (17), LockPages (18), UnlockPages
      (19), ReadProperties (20), WriteProperties (21), UnlockVersion (22),
      IncrementVersion (23), GetSize (24), SetSize (25), UnlockFile (26)};

  SignalIndex: PRIVATE TYPE = MACHINE DEPENDENT {
      LupineUnusedIndex (0), LupineLastIndex (3),
      AccessFailed (4), LockFailed (5), OperationFailed (6), StaticallyInvalid
      (7), Unknown (8), PossiblyDamaged (9)};


END.  -- AlpineFileRpcControl.