-- Copyright (C) 1987 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on March 25, 1987 3:05:35 pm PST by Lupine of January 22, 1987 5:37:32 pm PST
-- Source interface AlpineFile came from file AlpineFile.bcd, which was created on March 25, 1987 12:09:49 pm PST with version stamp 257#330#25514770454 from source of June 16, 1986 10:44:04 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, noHost, RPCHost];


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,
        hostHint: RpcPrivate.RPCHost←RpcPrivate.noHost];


  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,
        hostHint: RpcPrivate.RPCHost←RpcPrivate.noHost]
    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, retainCacheLocks: BOOLEAN],
      clientStubValidateCachePageLock: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, lock: CachePageLockConversion] RETURNS
          [success: BOOLEAN],
      clientStubValidateCachePageLocks: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, locks: CachePageLockConversions]
          RETURNS [locksGranted: LIST OF CachePageLockConversion, locksNotGranted:
          LIST OF CachePageLockConversion],
      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],
      clientStubReadUserProperties: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, desiredProperties:
          UserProperties, lock: LockOption] RETURNS [properties: UserPropertyValuePairs],
      clientStubWriteUserProperties: PROCEDURE [interface: InterfaceRecord,
          conversation: Conversation, openFileID: OpenFileID, properties:
          UserPropertyValuePairs, 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, retainCacheLocks:
          BOOLEAN],
      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, retainCacheLocks:
      BOOLEAN] = INLINE  { interface.clientStubUnlockPages[interface,
      conversation, openFileID, pageRun, retainCacheLocks]};
   ValidateCachePageLock: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, lock: CachePageLockConversion] RETURNS [success: BOOLEAN]
      = INLINE  { RETURN interface.clientStubValidateCachePageLock[interface,
      conversation, lock]};
   ValidateCachePageLocks: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, locks: CachePageLockConversions] RETURNS [locksGranted:
      LIST OF CachePageLockConversion, locksNotGranted: LIST OF CachePageLockConversion]
      = INLINE  { RETURN interface.clientStubValidateCachePageLocks[interface,
      conversation, locks]};
   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]};
   ReadUserProperties: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, desiredProperties: UserProperties,
      lock: LockOption] RETURNS [properties: UserPropertyValuePairs] =
      INLINE  { RETURN interface.clientStubReadUserProperties[interface,
      conversation, openFileID, desiredProperties, lock]};
   WriteUserProperties: PROCEDURE [interface: InterfaceRecord, conversation:
      Conversation, openFileID: OpenFileID, properties: UserPropertyValuePairs,
      lock: LockOption] = INLINE  { interface.clientStubWriteUserProperties[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, retainCacheLocks: BOOLEAN]
      = INLINE  { interface.clientStubUnlockFile[interface, conversation,
      openFileID, retainCacheLocks]};
 
 -- 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), ValidateCachePageLock (20), ValidateCachePageLocks (21), ReadProperties
      (22), WriteProperties (23), ReadUserProperties (24), WriteUserProperties
      (25), UnlockVersion (26), IncrementVersion (27), GetSize (28), SetSize
      (29), UnlockFile (30)};

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


END.  -- AlpineFileRpcControl.