--*********************************************************************
--  Title:  Object-oriented CMW Interface Specification for Ada 83
--  Description:
--    This package provides object-oriented Ada 83 package
--    specifications for Unix platforms.  It contains the following
--    sub-package specifications: 
--         Directory, MLD, File, Device
--         ACL
--         Clearance, SLabel, ILabel, Privilege
--         Current_Process, 
--         Command_Authorizations_DB, Passwords_DB, Defaults_DB,
--            Devices_DB, File_Control_DB, Terminal_Control_DB, 
--            Printer_Control_DB, Security_Policy_DB, 
--            TNet_Interfaces_DB, Tnet_Remote_Hosts_DB,
--            Tnet_Config_DB, 
--            Shared_Memory, Semaphore, Message
--         User, Audit, TCB, Disk
--     This package also contains specifications of utility functions
--     and procedures, which are not part of the above sub-packages.
--
--  SCCS:  @(#)cmw.ads 3.4 94/08/01
--*********************************************************************
 
with System;
with CMW_Hardware_Dependencies;  use CMW_Hardware_Dependencies;

package CMW is

   ---------------------------------------------------------------------
   --  The standard error reporting procedure is for the called routines
   --  to raise one of the following exceptions.  The caller is advised
   --  to call Get_Error_Code() to get an error code from the concrete
   --  layer which describes more specifically the error condition.
   ---------------------------------------------------------------------
   CMW_Error          : exception;
   -- General error exception to be raised when there is an error
   -- resulting from an API call.  Also see function Get_Error_Code().
 
   CMW_End_of_Data    : exception;
   -- General status exception to be raised when there is no more data
   -- to return to an API call.
 
   CMW_Database_Error : exception;
   -- General database exception.
 
   ------------------
   --  Global Types
   ------------------
   subtype Mask is Mask_Type;
   subtype Permissions is Permissions_Type;
   subtype Tag_Object is Tag_Object_Type;
 
   type  Comparison_Result is
             (Left_Dominates,   --  The left label dominates
              Right_Dominates,  --  The right label dominates
              Equal,            --  Both labels are equal
              Incomparable);    --  The labels cannot be compared
   --
   subtype Label_Value     is String;
   --
   type Label_Range is record
      Low  : Label_Value(1 .. 256) := (others => ' ');
      High : Label_Value(1 .. 256) := (others => ' ');
   end record;
   --
   subtype Pathname        is String;
   --
   type    User_ID         is new Natural;

   Success     : Integer renames Successful;
   Fail        : Integer renames Failure;
   Not_Open    : Integer renames NotOpen;
   Busy        : Integer renames BusyNow;
   No_Space    : Integer renames NoSpace;
   Not_Created : Integer renames NotCreated;

 
 
   --==================================================
   --
   -- Sub-Package specification of Sensitivity Object
   --
   --==================================================
   package SLabel is
      
      type    SLabel_Object is private;
      Null_SLabel_Object : constant SLabel_Object;

      --=============================================================
      --  Procedure: Create
      --  Description:
      --    Create a Sensitivity object which has the proper number of
      --      compartment words as defined by the site dependent setup
      --      files.
      --  Input:  None.
      --  Output: SLabel   New object.
      --=============================================================
      procedure Create(SLabel : in out SLabel_Object);
 
      --=============================================================
      --  Procedure: Destroy
      --  Description:
      --    Returns a previously allocated Sensitivity object to the
      --    free space pool.
      --  Input:  SLabel   Object to be deallocated.
      --  Output: None.
      --=============================================================
      procedure Destroy(SLabel : in out SLabel_Object);
 
      --=============================================================
      --  Procedure: Copy
      --  Description:
      --    Copies the source object to the destination  object
      --  Input:  Source_SLabel        Object to copy from.
      --  Output: Destination_SLabel   Object to copy to.
      --=============================================================
      procedure Copy(Source_SLabel      : in SLabel_Object;
                     Destination_SLabel : in out SLabel_Object);
 
      --=============================================================
      --  Function: String_Of
      --  Description:
      --    Converts the given SLabel into a string.  An empty
      --      string is returned if the Sensitivity object contains
      --      compartments that are undefined or cannot be combined.
      --  Input:  SLabel         Object to convert from.
      --  Output: Text           Text representation of object.
      --=============================================================  
      function String_Of(SLabel : SLabel_Object) return String;
 
      --=============================================================
      --  Function: SLabel_Of
      --  Description:
      --    Converts the given string into a Sensitivity object.  The
      --      string must not be terminated by a newline.  The routine
      --      returns a dynamically allocated Sensitivity object, which
      --      may be freed using SLabel.Destroy().  A null object is
      --      returned if the conversion cannot be made.
      --  Input:   SLabel_String     Text representation of object.
      --  Output:  SLabel            Object converted from text.
      --=============================================================
      function SLabel_Of(SLabel_String : in String)
                          return SLabel_Object;

      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the given SLabel to the specified clearance level.
      --     The clearance level is a string with platform-dependent
      --     content.
      --  Input:  SLabel         Object to set.
      --          Label_Level    Text representing the clearance.
      --  Output: SLabel         Updated object.
      --=============================================================
      procedure Set(SLabel      : in out SLabel_Object;
                    Label_Level : in Label_Value);
 
      --=============================================================
      --  Function: Tag_Of
      --  Description:
      --    Converts the given SLabel into a Tag.  A tag of zero(0)
      --      is returned on error.
      --  Input:  SLabel         Object to convert from.
      --  Output: Tag            Tag representation of object.
      --=============================================================
      function Tag_Of(SLabel : SLabel_Object) return Tag_Object;
 
      --=============================================================
      --  Function: SLabel_Of
      --  Description:
      --      Converts the given Tag into a Sensitivity object.
      --      The routine returns a dynamically allocated Sensitivity
      --      object, which may be freed using SLabel.Destroy().  
      --      A null object is returned if the conversion cannot be made.
      --  Input:   Tag         Tag representation of object.
      --  Output:  SLabel      Object converted from tag.
      --=============================================================
      function SLabel_Of(Tag : Tag_Object) return SLabel_Object;
 
      --=============================================================
      --  Function: Compare
      --  Description:
      --    Compares the two given Sensitivity Labels and returns a
      --    value representing their relationship.
      --  Input:   SLabel1         Object for comparison.
      --  Output:  SLabel2         Object for comparison.
      --=============================================================
      function Compare(SLabel1 : SLabel_Object;
                       SLabel2 : SLabel_Object)
                        return Comparison_Result;
 
      --=============================================================
      --  Function: Compare
      --  Description:
      --    Compares the two given Tags and returns a value
      --      representing their relationship.
      --  Input:   Tag1         Object for comparison.
      --  Output:  Tag2         Object for comparison.
      --=============================================================
      function Compare(Tag1 : Tag_Object;
                       Tag2 : Tag_Object) return Comparison_Result;
 
      --=============================================================
      --  Function: Is_In_Accred_Range
      --  Description:
      --    Returns whether the given Sensitivity Label is in the
      --      Accreditation range.
      --  Input:   SLabel       Sensitivity Object.
      --  Output:  True/False   In accredited range/Out of range.
      --=============================================================
      function Is_In_Accred_Range(SLabel : SLabel_Object)
                                   return Boolean;
 
      --=============================================================
      --  Function: ">"
      --  Description:
      --      Returns whether the given Left Sensitivity Label dominates
      --      the Right Sensitivity Label.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominant / Not dominant.
      --=============================================================
      function ">" (Left  : SLabel_Object;
                    Right : SLabel_Object) return Boolean;
 
      --=============================================================
      --  Function: "<"
      --  Description:
      --      Returns whether the given Left SLabel is dominated by
      --      the Right SLabel.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominated / Not dominated.
      --=============================================================
      function "<" (Left  : SLabel_Object;
                    Right : SLabel_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal
      --  Description:
      --      Returns whether the Left SLabel is equal to the Right one.
      --  Input:  Left           Object for comparison.
      --          Right          Object for comparison.
      --  Output: True/False     Equal/Unequal.
      --=============================================================
      function Is_Equal(Left  : SLabel_Object;
                        Right : SLabel_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal_Value
      --  Description:
      --     Returns whether the given SLabel is equal to the given
      --     value. 
      --     The clearance level is a string with platform-dependent
      --     content.
      --  Input:  SLabel         Object for comparison.
      --          Label_Level    Text representing the Sensitivity for
      --                         comparing with given Object.
      --  Output: True/False     Equal/Unequal.
      --=============================================================
      function Is_Equal_Value(SLabel      : SLabel_Object;
                              Label_Level : Label_Value) return Boolean;
 
      --=============================================================
      --  Function: Is_In_Range
      --  Description:
      --      Returns whether the given SLabel is within the given
      --      SLabel range, inclusive.
      --  Input:  SLabel          Object for comparison.
      --          Label_Bracket   Record containing High and Low values.
      --  Output: True/False      In range/Out of range.
      --=============================================================
      function Is_In_Range(SLabel        : SLabel_Object;
                           Label_Bracket : Label_Range) return Boolean;


   private
      type SLabel_Object is new SLabel_Object_Type;
      Null_SLabel_Object : constant SLabel_Object := null;

   end SLabel;
 
 
   --=======================================================
   --
   -- Sub-Package Specification of Information Label Object
   --
   --=======================================================
   package ILabel is
      type    ILabel_Object           is private;
      
   --=============================================================
   --  Procedure: Create
   --  Description:
   --    Create a Information object which has the proper number of
   --      compartments and marking words as defined by the site
   --      dependent setup files.
   --  Input:  None.
   --  Output: ILabel   New object.
   --=============================================================
      procedure Create(ILabel : in out ILabel_Object);
 
      --=============================================================
      --  Procedure: Destroy
      --  Description:
      --    Returns a previously allocated Information object to the
      --    free space pool.
      --  Input:  ILabel   Object to be deallocated.
      --  Output: None.
      --=============================================================
      procedure Destroy(ILabel : in out ILabel_Object);
 
      --=============================================================
      --  Procedure: Copy
      --  Description:
      --    Copies the source object to the destination  object
      --  Input:  Source_ILabel         Object to copy from.
      --  Output: Destination_ILabel    Object to copy to.
      --=============================================================
      procedure Copy(Source_ILabel      : in ILabel_Object;
                     Destination_ILabel : in out ILabel_Object);
 
      --=============================================================
      --  Function: String_Of
      --  Description:
      --    Converts the given ILabel into a string.  An empty
      --      string is returned if the Information object contains
      --      compartments or markings that are undefined or cannot be
      --      combined.
      --  Input:  ILabel         Object to convert from.
      --  Output: Text           Text representation of object.
      --=============================================================
      function String_Of(ILabel : ILabel_Object) return String;
 
      --=============================================================
      --  Function: ILabel_Of
      --  Description:
      --    Converts the given string into a Information object.  The
      --      string must not be terminated by a newline.  The routine
      --      returns a dynamically allocated Information object, which
      --      may be freed using ILabel.Destroy().  A null object is
      --      returned if the conversion cannot be made.
      --  Input:   ILabel_String      Text representation of object.
      --  Output:   ILabel            Object converted from text.
      --=============================================================
      function ILabel_Of(ILabel_String : String) return ILabel_Object;

      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the given ILabel to the specified clearance level.
      --     The clearance level is a string with platform-dependent
      --     content.
      --  Input:  ILabel         Object to set.
      --          Label_Level    Text representing the clearance.
      --  Output: ILabel         Updated object.
      --=============================================================
      procedure Set(ILabel      : in out ILabel_Object;
                    Label_Level : in Label_Value);
 
      --=============================================================
      --  Function: Tag_Of
      --  Description:
      --    Converts the given ILabel into a Tag.  A tag of zero(0)
      --      is returned on error.
      --  Input:  ILabel         Object to convert from.
      --  Output:   Tag            Tag representation of object.
      --=============================================================
      function Tag_Of(ILabel : ILabel_Object) return Tag_Object;
 
      --=============================================================
      --  Function: ILabel_Of
      --  Description:
      --    Converts the given Tag into a Information object.  The
      --      string must not be terminated by a newline.  The routine
      --      returns a dynamically allocated Information object, which
      --      may be freed using ILabel.Destroy().  A null object is
      --      returned if the conversion cannot be made.
      --  Input:   Tag         Tag representation of object.
      --  Output:   ILabel      Object converted from tag.
      --=============================================================
      function ILabel_Of(Tag : in Tag_Object) return ILabel_Object;
 
      --=============================================================
      --  Function: Compare
      --  Description:
      --    Compares the two given Information Labels and returns a
      --    value representing their relationship.
      --  Input:   ILabel1         Object for comparison.
      --  Output:  ILabel2         Object for comparison.
      --=============================================================
      function Compare(ILabel1 : ILabel_Object;
                       ILabel2 : ILabel_Object)
                        return Comparison_Result;
 
      --=============================================================
      --  Function: ">"
      --  Description:
      --      Returns whether the given Left Information Label dominates
      --      the Right Information Label.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominant / Not dominant.
      --=============================================================
      function ">" (Left  : ILabel_Object;
                    Right : ILabel_Object) return Boolean;
 
      --=============================================================
      --  Function: "<"
      --  Description:
      --      Returns whether the given Left ILabel is dominated by
      --      the Right ILabel.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominated / Not dominated.
      --=============================================================
      function "<" (Left  : ILabel_Object;
                    Right : ILabel_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal
      --  Description:
      --      Returns whether the Left ILabel is equal to the Right one.
      --  Input:  Left              Object for comparison.
      --          Right             Object for comparison.
      --  Output: True/False        Equal/Unequal.
      --=============================================================
      function Is_Equal(Left  : ILabel_Object;
                        Right : ILabel_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal_Value
      --  Description:
      --     Returns whether the given ILabel is equal to the given
      --     value. 
      --     The clearance level is a string with platform-dependent
      --     content.
      --  Input:  ILabel         Object for comparison.
      --          Label_Level    Text representing the Information for
      --                         comparing with given Object.
      --  Output: True/False     Equal/Unequal.
      --=============================================================
      function Is_Equal_Value(ILabel      : ILabel_Object;
                              Label_Level : Label_Value) return Boolean;
 
      --=============================================================
      --  Function: Is_In_Range
      --  Description:
      --      Returns whether the given ILabel is within the given
      --      ILabel range, inclusive.
      --  Input: ILabel          Object for comparison.
      --         Label_Bracket   Record containing High and Low values.
      -- Output: True/False      In range/Out of range.
      --=============================================================
      function Is_In_Range(ILabel        : ILabel_Object;
                           Label_Bracket : Label_Range) return Boolean;

   private
      type ILabel_Object is new ILabel_Object_Type;

   end ILabel;
  
   --================================================
   --
   -- Sub-Package Specification of Privilege Object
   --
   --================================================
   package Privilege is
      type    Privilege_Vector_Object is private;
      type    Process_Privilege_Set   is (Maximum_Privileges,
                                          Base_Privileges, 
                                          Effective_Privileges);
      subtype Privilege_Vector_Value  is 
         Natural range 0 .. Max_Privilege_Value;
      type    File_Privilege_Set      is (Potential_Privileges,
                                          Granted_Privileges);
 
      --=============================================================
      --  Procedure: Create
      --  Description:
      --    Creates a Privilege object which contains one or more
      --    privileges.  Each bit in the object corresponds to a 
      --    single privilege.  Destroy() must be called when this 
      --    object is no longer used.
      --  Input:  None.
      --  Output: Privilege   New object.
      --=============================================================
      procedure Create(Privilege : in out Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Destroy
      --  Description:
      --    Deletes a Privilege object, and release storage space
      --    taken by the object.
      --  Input:  Privilege   Object to be deallocated.
      --  Output: None.
      --=============================================================
      procedure Destroy(Privilege : in out Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --    Set a Privilege object to a single Privilege level, and
      --    reset all other privilege levels.
      --  Input:  Privilege            Object to be set.
      --          Privilege_Level      Value to set with.
      --  Output: None.
      --=============================================================
      procedure Set(Privilege       : in Privilege_Vector_Object;
                    Privilege_Level : in Privilege_Vector_Value);
 
      --=============================================================
      --  Procedure: Copy
      --  Description:
      --     Copies the given Privilege to a second Privilege.
      --  Input:  Source_Privilege         Object to copy from.
      --  Output: Destination_Privilege    Object to copy to.
      --=============================================================
      procedure Copy(Source_Privilege      : in Privilege_Vector_Object;
                     Destination_Privilege : in out Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Add
      --  Description:
      --     Adds the new Privilege Value to the existing set contained
      --     in the Privilege object.
      --  Input:  Privilege         Object holding existing privileges.
      --          New_Privilege     Value to add to existing set.
      --  Output: Privilege         Object having new privilege added.
      --=============================================================
      procedure Add(Privilege     : in out Privilege_Vector_Object;
                    New_Privilege : in Privilege_Vector_Value);
 
      --=============================================================
      --  Procedure: Add
      --  Description:
      --     Adds the new Privileges to the existing set contained
      --     in the Privilege object.
      --  Input:  Privilege         Object holding existing privileges.
      --          New_Privileges    Values to add to existing set.
      --  Output: Privilege         Object having new privileges added.
      --=============================================================
      procedure Add(Privilege      : in out Privilege_Vector_Object;
                    New_Privileges : in Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --     Removes an old Privilege Value from existing set contained
      --     in the Privilege object.
      --  Input: Privilege         Object holding existing privileges.
      --         Old_Privilege     Value to be deleted from existing set.
      -- Output: Privilege         Object having a privilege deleted.
      --=============================================================
      procedure Remove(Privilege     : in out Privilege_Vector_Object;
                       Old_Privilege : in Privilege_Vector_Value);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --     Removes old Privilege Values from existing set contained
      --     in the Privilege object.
      --  Input: Privilege         Object holding existing privileges.
      --         Old_Privileges    Values to be deleted from existing set.
      -- Output: Privilege         Object having privileges deleted.
      --=============================================================
      procedure Remove(Privilege      : in out Privilege_Vector_Object;
                       Old_Privileges : in Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Is_In_Set
      --  Description:
      --     Determines whether a Privilege Value is in a privilege set
      --     contained in the Privilege object.
      --  Input:  Privilege         Object holding existing privileges.
      --          Privilege_Subset  Value to be checked.
      --  Output: True/False.
      --=============================================================
      function Is_In_Set(Privilege        : Privilege_Vector_Object;
                         Privilege_Subset : Privilege_Vector_Value)
                         return Boolean;
 
      --=============================================================
      --  Procedure: Is_In_Set
      --  Description:
      --     Determines whether a Privilege subset is in a privilege set
      --     contained in the Privilege object.
      --  Input:  Privilege         Object holding existing privileges.
      --          Privilege_Subset  Values to be checked.
      --=============================================================
      function Is_In_Set(Privilege        : Privilege_Vector_Object;
                         Privilege_Subset : Privilege_Vector_Object)
                         return Boolean;
 
      --=============================================================
      --  Function: String_Of
      --  Description:
      --     Converts the given Privilege object into a string.
      --     The converted privileges are comma-delimited.
      --  Input:  Privilege         Object to be converted.
      --  Output: Text              Comma-delimited representation.
      --=============================================================
      function String_Of(Privilege : Privilege_Vector_Object)
                         return String;
 
      --=============================================================
      --  Function: Privilege_Of
      --  Description:
      --     Converts a given string into a Privilege object.  The
      --     privileges in the string must be delimited with comma.
      --     This routine returns a dynamically allocated object,
      --     which may be freed using Privilege.Destroy().
      --  Input:  Privilege_Vector_String    Comma-delimited list.
      --  Output: Privilege                  Resulting Object.
      --=============================================================
      function Privilege_Of(Privilege_Vector_String : String)
                            return Privilege_Vector_Object;
 
      --=============================================================
      --  Function: Is_Equal
      --  Description:
      --     Returns True if the left Privilege is equal to the right
      --     Privilege.
      --  Input:  Left     Object for comparison.
      --          Right    Object for comparison.
      --  Output: True/False.
      --=============================================================
      function Is_Equal(Left  : Privilege_Vector_Object;
                        Right : Privilege_Vector_Object) return Boolean;

   private
      type Privilege_Vector_Object is new Privilege_Vector_Object_Type;

   end Privilege;

 
   --================================================================
   --
   -- Sub-Package Specification of Access Control List (ACL) Object
   --
   --================================================================
   package ACL is
 
      type    ACL_Object         is private;
      subtype ACL_Entry_Criteria is ACL_Entry_Criteria_Type;
      type    ACL_Entry_Object   is private;
      type    ACL_Remove_Method  is (Remove_Single, Remove_All);
      subtype ACL_Tag_Object     is ACL_Tag_Object_Type;
      type    Group_ID           is new Natural;
      type    UGO_Tag            is (User, Group, Other);
  
 
      --=============================================================
      --  Procedure: Create
      --  Description:
      --      Creates a new Access Control List.  Must be called
      --      before other ACL routines are called.
      --  Input:   None.
      --  Output:  ACL      ACL object.
      --=============================================================
      procedure Create(ACL : in out ACL_Object);
 
      --=============================================================
      --  Procedure: Create_Entry
      --  Description:
      --    Creates and adds a new ACL Entry to the Access Control
      --    List.
      --  Input:   ACL            Descriptor of given ACL
      --  Output:  ACL_Entry      Descriptor of new ACL entry.
      --=============================================================
      procedure Create_Entry(ACL       : in out ACL_Object;
                             ACL_Entry : in out ACL_Entry_Object);
 
      --=============================================================
      --  Procedure: Destroy
      --  Description:
      --    Destroys the given Access Control List.  Releases the
      --    working storage taken by ACL object.
      --  Input:   ACL         Descriptor of an ACL.
      --  Output:  None.
      --=============================================================
      procedure Destroy(ACL : in out ACL_Object);
 
      --=============================================================
      --  Procedure: Destroy_Entry
      --  Description:
      --    Removes the given Access Control List Entry from the ACL,
      --      and releases working storage taken by ACL entry.
      --  Input:   ACL_Entry      Descriptor of an ACL entry.
      --  Output:  None.
      --=============================================================
      procedure Destroy_Entry(ACL_Entry : in ACL_Entry_Object);
 
      --=============================================================
      --  Procedure: Copy
      --  Description:
      --    Copies an Access Control List to another ACL.
      --  Input:   Source_ACL         Descriptor of source ACL.
      --  Output:  Destination_ACL    Descriptor of destination ACL.
      --=============================================================
      procedure Copy(Source_ACL      : in ACL_Object;
                     Destination_ACL : in out ACL_Object);
 
      --=============================================================
      --  Procedure: Copy_Entry
      --  Description:
      --    Copies an Access Control List Entry to another entry.
      --  Input:   Source_Entry        Descriptor of source entry.
      --  Output:  Destination_Entry   Descriptor of destination entry.
      --=============================================================
      procedure Copy_Entry(Source_Entry      : in ACL_Entry_Object;
                           Destination_Entry : in out ACL_Entry_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the actual number of ACL entries in an ACL.
      --  Input:   ACL                  Descriptor of ACL.
      --  Output:  Number_of_Entries    Actual number of ACL entries.
      --=============================================================
      procedure Get(ACL               : in ACL_Object;
                    Number_Of_Entries : out Natural);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the next Access Control List Entry from the
      --    given Access Control List.
      --  Input:   ACL                Descriptor of ACL.
      --  Output:  ACL_Ent            Descriptor of next Entry in ACL.
      --           No_More_Entries    Whether end of data reached
      --=============================================================
      procedure Get(ACL             : in ACL_Object;
                    ACL_Entry       : in out ACL_Entry_Object;
                    No_More_Entries : out Boolean);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the Permissions associated with the given User
      --    ID from the given Access Control List.  The End_of_Data
      --    exception will be raised if the search for User ID fails.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL                   Descriptor of ACL.
      --           User                  User ID.
      --  Output:  User_Permissions      Permissions associated with
      --                                 User ID.
      --=============================================================
     procedure Get(ACL              : in ACL_Object;
                   User             : in User_ID;
                   User_Permissions : out Permissions);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the Permissions associated with the given Group
      --    ID from the given Access Control List.  The End_of_Data
      --    exception will be raised if the search for Group ID
      --    fails.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL                  Descriptor of ACL.
      --           Group                Group ID.
      --  Output:  Group_Permissions    Permissions associated with
      --                                Group ID.
      --=============================================================
      procedure Get(ACL               : in ACL_Object;
                    Group             : in Group_ID;
                    Group_Permissions : out Permissions);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the Basic Permissions from the given Access
      --    Control List for either the owning user, the owning
      --    group or the world (other).  The End_of_Data
      --    exception will be raised if the search for Group ID
      --    fails.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL      Descriptor of ACL.
      --           UGO      Specifies the owing user, owning group,
      --                    or Other (world).
      --  Output:  UGO_Permissions   Basic Permissions associated
      --                             with UGO.
      --=============================================================
      procedure Get(ACL             : in ACL_Object;
                    UGO             : in UGO_Tag;
                    UGO_Permissions : out Permissions);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the Permissions associated with the given ACL
      --    entry.
      --  Input:   ACL_Entry          Descriptor of given ACL entry.
      --  Output:  User_or_Group_Permissions
      --                              Permissions associated with
      --                              ACL Entry.
      --=============================================================
      procedure Get(ACL_Entry                 : in ACL_Entry_Object;
                    User_OR_Group_Permissions : out Permissions);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --    Returns the Tag type and value associated with the
      --    given ACL entry.
      --  Input:   ACL_Entry      Descriptor of given ACL entry.
      --  Output:  Tag_Type       Tag type associated with entry
      --           Tag_Value      Tag value of entry
      --=============================================================
      procedure Get(ACL_Entry : in ACL_Entry_Object;
                    Tag_Type  : out ACL_Tag_Object;
                    Tag_Value : out Natural);
 
      --=============================================================
      --  Procedure: Get_Mask
      --  Description:
      --    Returns the current maximum permissions associated with
      --    the given Access Control List.  This is the tag value
      --    field in the Mask_Obj entry of the ACL. The End_of_Data
      --    exception will be raised if there is no Mask_Obj entry.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL        Descriptor of ACL.
      --  Output:  ACL_Mask   Tag value associated with Mask_Obj entry
      --=============================================================
      procedure Get_Mask(ACL : in ACL_Object; ACL_Mask : out Mask);
 
      --=============================================================
      --  Procedure: Clear
      --  Description:
      --    Deletes all entries in the given ACL, and allows full
      --    access.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL         Descriptor of ACL.
      --  Output:  None.
      --=============================================================
      procedure Clear(ACL : in out ACL_Object);
 
      --=============================================================
      --  Procedure: Set_Mask
      --  Description:
      --      Sets the Access Control List mask for the given ACL,
      --      by setting the Mask_Obj entry of the ACL.  If the ACL
      --      does not contain a Mask_Obj entry, this procedure will
      --      add one.
      --  Input:   ACL         Descriptor of ACL.
      --  Output:  None.
      --=============================================================
      procedure Set_Mask(ACL : in ACL_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Permissions associated with the given ACL
      --      entry.
      --  Input:   ACL_Entry       Descriptor of given ACL entry.
      --           User_or_Group_Permissions
      --                           Permissions associated with
      --                           ACL Entry.
      --  Output:  None.
      --=============================================================
      procedure Set(ACL_Entry                 : in ACL_Entry_Object;
                    User_OR_Group_Permissions : in Permissions);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Tag type and value associated with the
      --      given ACL entry.
      --  Input:   ACL_Entry      Descriptor of given ACL entry.
      --           Tag_Type       Tag type associated with entry
      --           Tag_Value      Tag value of entry
      --  Output:  None.
      --=============================================================
      procedure Set(ACL_Entry : in ACL_Entry_Object;
                    Tag_Type  : in ACL_Tag_Object;
                    Tag_Value : in Natural);
 
      --=============================================================
      --  Procedure: Add
      --  Description:
      --      Adds the given Permissions to the existing ones
      --      associated with the given ACL entry.
      --  Input:   ACL_Entry         Descriptor of given ACL entry.
      --           ACL_Permissions   Permissions to be added.
      --  Output:  None.
      --=============================================================
      procedure Add(ACL_Entry       : in ACL_Entry_Object;
                    ACL_Permissions : in Permissions);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --    Deletes one or more entries from the given Access
      --    Control List which match the entry criteria.  If the
      --    Remove_Mode is Remove_All, all entries matching the
      --    criteria will be removed.  If the Remove_Mode is
      --    Remove_Single, the first entry matching the criteria will
      --    be removed. End-of-Data exception will be raised if no
      --    entry matching the criteria is found.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL                  Descriptor of given ACL.
      --           ACL_Entry_Criteria   Used to determined which
      --                                ACL entries to be deleted.
      --           Remove_Mode          Specifies removing a single
      --                                or all matching entries.
      --  Output:  None.
      --=============================================================
      procedure Remove(ACL         : in ACL_Object;
                       Criteria    : in ACL_Entry_Criteria;
                       Remove_Mode : in ACL_Remove_Method := Remove_Single);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --    Removes ACL_Permissions from the given ACL entry.
      --    Any permissions in the ACL entry not specified in
      --    ACL_Permissions remain in the entry after this call.
      --  Input:   ACL_Entry         Descriptor of given ACL entry.
      --           ACL_Permissions   Permissions to be deleted.
      --  Output:  None.
      --=============================================================
      procedure Remove(ACL_Entry       : in ACL_Entry_Object;
                       ACL_Permissions : in Permissions);
 
      --=============================================================
      --  Procedure: Rewind
      --  Description:
      --    Reset the given Access Control List to its logical
      --    beginning.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL_Entry         Descriptor of given ACL entry.
      --           ACL_Permissions   Permissions to be deleted.
      --  Output:  None.
      --=============================================================
      procedure Rewind(ACL : in ACL_Object);
 
      --=============================================================
      --  Function: String_Of
      --  Description:
      --    Converts the given Access Control List into a text package
      --    in contiguous memory.
      --  Input:   ACL         Descriptor of ACL to be converted.
      --  Output:  Text        Buffer holding converted text package.
      --=============================================================
      function String_Of(ACL : in ACL_Object) return String;
 
      --=============================================================
      --  Function: ACL_Of
      --  Description:
      --    Converts the text package representing an Access Control
      --    List into an ACL object.  Must use ACL.Destroy() to
      --    release storage space.
      --  Input:   ACL_String     Text representation of ACL.
      --  Output:  ACL            Object converted from ACL_String.
      --=============================================================
      function ACL_Of(ACL_String : String) return ACL_Object;
 
      --=============================================================
      --  Procedure: Validate
      --  Description:
      --    Checks the given Access Control List for validity, and
      --    returns wheter the ACL is valid.  If ACL is not valid,
      --    the returned ACL entry indicates the error condition.
      --    Upon duplicate-entry condition, returns an ACL entry for
      --    which one or more duplicates exist elsewhere in the ACL 
      --    Returns a Null ACL entry upon other errors.
      --  Input:   ACL            Descriptor of given ACL.
      --  Output:  Is_Valid       Result of validity check
      --           ACL_Entry      Descriptor of an ACL entry.
      --=============================================================
      procedure Validate(ACL       : in ACL_Object;
                         Is_Valid  : out Boolean;
                         ACL_Entry : in out ACL_Entry_Object);
 
      --=============================================================
      --  Function: Has_Permission
      --  Description:
      --    Returns whether the user has the specified permissions
      --    for the given Access Control List.  The End_of_Data
      --    exception will be raised if the search for User ID fails
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL                   Descriptor of ACL.
      --           User                  User ID.
      --           User_Permissions      Permissions associated with
      --                                 User ID.
      --  Output:  True/False
      --=============================================================
      function Has_Permission(ACL              : ACL_Object;
                              User             : User_ID;
                              User_Permissions : Permissions)
                              return Boolean;
 
      --=============================================================
      --  Function: Has_Permission
      --  Description:
      --    Returns whether the group has the specified permissions
      --    for the given Access Control List.  The End_of_Data
      --    exception will be raised if the search for Group ID fails
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   ACL                  Descriptor of ACL.
      --           Group                Group ID.
      --           Group_Permissions    Permissions associated with
      --                                Group ID.
      --  Output:  True/False
      --=============================================================
      function Has_Permission(ACL               : ACL_Object;
                              Group             : Group_ID;
                              Group_Permissions : Permissions)
                              return Boolean;
 
      --=============================================================
      --  Function:  Is_Equal
      --  Description:
      --    Performs Equality check between 2 entries of a Access
      --    Control List.  Returns True if the left entry has the
      --    same Tag Type, Tag Qualifier and Permissions as the
      --    right ACL.
      --  Input:   Left            ACL entry for comparison
      --           Right           ACL entry for comparison
      --  Output:  True/False
      --=============================================================
      function Is_Equal(Left  : ACL_Entry_Object;
                        Right : ACL_Entry_Object) return Boolean;
 
      --=============================================================
      --  Function:  Is_Equal
      --  Description:
      --    Performs Equality check between 2 Access Control Lists.
      --    Returns True if the left ACL has the same number of entries
      --    and the same entries as the right ACL, and True otherwise.
      --    Also returns True if both ACL's have zero entries.
      --    The ACL entry final position will be modified from its 
      --    original position.
      --  Input:   Left            ACL for comparison
      --           Right           ACL for comparison
      --  Output:  True/False
      --=============================================================
      function Is_Equal(Left  : ACL_Object;
                        Right : ACL_Object) return Boolean;
 
   private
      type ACL_Object       is new ACL_Object_Type;
      type ACL_Entry_Object is new ACL_Entry_Object_Type;
 
   end ACL;
 
   --===============================================
   --
   -- Sub-Package Specification of Clearance Object
   --
   --===============================================
   package Clearance is
 
      type    Clearance_Object        is private;
 
      --=============================================================
      --  Procedure: Create
      --  Description:
      --    Create a Clearance object which has the proper number of
      --      compartment words as defined by the site dependent setup
      --      files.
      --  Input:  None.
      --  Output: Clearance   New object.
      --=============================================================
      procedure Create(Clearance : in out Clearance_Object);
 
      --=============================================================
      --  Procedure: Destroy
      --  Description:
      --    Returns a previously allocated Clearance object to the free
      --      space pool.
      --  Input:  Clearance   Object to be deallocated.
      --  Output: None.
      --=============================================================
      procedure Destroy(Clearance : in out Clearance_Object);
 
      --=============================================================
      --  Procedure: Copy
      --  Description:
      --    Copies the source object to the destination  object
      --  Input:  Source_Clearance          Object to copy from.
      --  Output: Destination_Clearance     Object to copy to.
      --=============================================================
      procedure Copy(Source_Clearance      : in Clearance_Object;
                     Destination_Clearance : in out Clearance_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the given Clearance to the specified clearance level.
      --  Input:  Clearance           Object to set.
      --          Clearance_Level     Text representing the clearance.
      --  Output: Clearance           Updated object.
      --=============================================================
      procedure Set(Clearance       : in out Clearance_Object;
                    Clearance_Level : in Label_Value);
 
      --=============================================================
      --  Function: String_Of
      --  Description:
      --    Converts the given Clearance into a string.  An empty
      --    string is returned if the Clearance object contains
      --    compartments that are undefined or cannot be combined.
      --  Input:  Clearance       Object to convert from.
      --  Output: Text            Text representation of object.
      --=============================================================
      function String_Of(Clearance : Clearance_Object) return String;
 
      --=============================================================
      --  Function: Clearance_Of
      --  Description:
      --    Converts the given string into a Clearance object.  The
      --      string must not be terminated by a newline.  The routine
      --      returns a dynamically allocated Clearance object, which
      --      may be freed using Clearance.Destroy().  A null object is
      --      returned if the conversion cannot be made.
      --  Input:   Clearance_String     Text representation of object.
      --  Output:  Clearance            Object converted from text.
      --=============================================================
      function Clearance_Of(Clearance_String : String)
                            return Clearance_Object;
 
      --=============================================================
      --  Function: Compare
      --  Description:
      --    Compares the two given Clearance Labels and returns a
      --    value representing their relationship.
      --  Input:   Clearance1         Object for comparison.
      --  Output:  Clearance2         Object for comparison.
      --
      --  Revision History:
      --      08/03/94  R.Venkatraman - Created.
      --=============================================================
      function Compare(Clearance1 : Clearance_Object;
                       Clearance2 : Clearance_Object)
                       return Comparison_Result;

      --=============================================================
      --  Function: ">"
      --  Description:
      --      Returns whether the given Left Clearance dominates
      --      the Right Clearance.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominant / Not dominant.
      --=============================================================
      function ">" (Left  : Clearance_Object;
                    Right : Clearance_Object) return Boolean;
 
      --=============================================================
      --  Function: "<"
      --  Description:
      --      Returns whether the given Left Clearance is dominated by
      --      the Right Clearance.
      --  Input:  Left            Object for comparison.
      --          Right           Object for comparison.
      --  Output: True/False      Dominated / Not dominated.
      --=============================================================
      function "<" (Left  : Clearance_Object;
                    Right : Clearance_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal
      --  Description:
      --     Returns whether the Left Clearance is equal to the Right
      --     one.
      --  Input:  Left               Object for comparison.
      --          Right              Object for comparison.
      --  Output: True/False         Equal/Unequal.
      --=============================================================
      function Is_Equal(Left  : Clearance_Object;
                        Right : Clearance_Object) return Boolean;
 
      --=============================================================
      --  Function: Is_Equal_Value
      --  Description:
      --     Returns whether the given Clearance is equal to the given
      --     value.
      --  Input:  Clearance         Object for comparison.
      --          Clearance_Level   Text representing the clearance for
      --                            comparing with given Object.
      --  Output: True/False        Equal/Unequal.
      --=============================================================
      function Is_Equal_Value(Clearance       : Clearance_Object;
                              Clearance_Level : Label_Value)
                              return Boolean;
 
      --=============================================================
      --  Function: Is_In_Range
      --  Description:
      --      Returns whether the given Clearance is within the given
      --      Clearance range, inclusive.
      --  Input:  Clearance          Object for comparison.
      --          Clearance_Bracket  Record containing the High and Low
      --                             values.
      --  Output: True/False         In range/Out of range.
      --=============================================================
      function Is_In_Range(Clearance     : Clearance_Object;
                           Label_Bracket : Label_Range)
                           return Boolean;

   private
      type Clearance_Object is new Clearance_Object_Type;
   
   end Clearance;
  

   --===============================================
   --
   -- Sub-Package Specification of Directory Object
   --
   --===============================================
   package Directory is
      type    Directory_Object        is private;
      
      --=============================================================
      --  Function: Object_Of
      --  Description:
      --      Gets the Directory Object associated with the given
      --      directory name.
      --  Input:   Directory_Name     Given directory name.
      --  Output:  Directory_Object   Object for directory name.
      --=============================================================
      function Object_Of(Directory_Name : Pathname)
                         return Directory_Object;
 
      --=============================================================
      --  Function: Pathname_Of
      --  Description:
      --      Gets the pathname associated with the given
      --      Directory object.
      --  Input:   Directory      Given directory object.
      --  Output:  Pathname       Pathname of object.
      --=============================================================
      function Pathname_Of(Directory : Directory_Object) return String;
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Sensitivity Label associated with the given
      --      Directory Object.
      --  Input:   Dir      Given directory object.
      --  Output:  SLabel   Sensitivity Label Object.
      --=============================================================
      procedure Get(Directory : in Directory_Object;
                    SLabel    : in out CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Information Label associated with the given
      --      Directory Object.
      --  Input:   Dir      Given directory object.
      --  Output:  ILabel   Information Label Object.
      --=============================================================
      procedure Get(Directory : in Directory_Object;
                    ILabel    : in out CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Access Control List (ACL) associated with the
      --      given Directory Object.
      --  Input:   Dir   Given directory object.
      --  Output:  ACL   ACL Object.
      --=============================================================
      procedure Get(Directory : in Directory_Object; 
                    ACL       : in out CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Sensitivity Label associated with the given
      --      Directory Object using the given Sensitivity Label
      --      object.
      --  Input:   Dir      Given directory object.
      --           SLabel   Sensitivity Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(Directory : in Directory_Object;
                    SLabel    : in CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Information Label associated with the given
      --      Directory Object, using the given Information Label
      --      object.
      --  Input:   Dir      Given directory object.
      --           ILabel   Information Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(Directory : in Directory_Object;
                    ILabel    : in CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Access Control List (ACL) associated with the
      --      given Directory Object, using the given ACL object.
      --  Input:   Dir   Given directory object.
      --           ACL   ACL Object.
      --  Output:  None.
      --=============================================================
      procedure Set(Directory : in Directory_Object; 
                    ACL       : in CMW.ACL.ACL_Object);

   private
      type Directory_Object is record
         Directory_Name : Pathname(1 .. 256) := (others => ' ');
      end record;

   end Directory;
 
 
   --===========================================================
   --
   -- Sub-Package Specification of Multi-Level Directory Object
   --
   --===========================================================
   package MLD is
 
      type MLD_Object      is private;
      type MLD_Open_Method is (Search_All_Dirs, 
                               Search_Specified_Level);
 
      --=============================================================
      --  Function: Object_Of
      --  Description:
      --     Gets the MLD Object associated with the given
      --     MLD name.  The given name must be terminated by one or
      --     more blanks.
      --  Input:   MLD_Name     Blank-terminated MLD name.
      --  Output:  MLD_Object   Object for MLD name.
      --=============================================================
      function Object_Of(MLD_Name : Pathname) return MLD_Object;
 
      --=============================================================
      --  Function: Pathname_Of
      --  Description:
      --      Gets the pathname associated with the given
      --      MLD object.
      --  Input:   MLD_Obj      Given MLD object.
      --  Output:  Pathname     Pathname of object.
      --=============================================================
      function Pathname_Of(MLD : MLD_Object) return String;
 
      --=============================================================
      --  Procedure: Create
      --  Description:
      --      Converts a given directory object to an MLD object.
      --  Input:  Dir          Directory object.
      --  Output: MLD          MLD object.
      --=============================================================
      procedure Create(Directory : in CMW.Directory.Directory_Object; 
                       MLD       : out MLD_Object);
 
      --=============================================================
      --  Procedure: Remove_MLD
      --  Description:
      --      Converts a Multi-Level Directory to an ordinary
      --   directory.
      --  Input:   MLD          MLD object.
      --  Output:  None.
      --=============================================================
      procedure Remove_MLD(MLD : in MLD_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Sensitivity Label associated with the given
      --      MLD Object.
      --  Input:   MLD      Given MLD object.
      --  Output:  SLabel   Sensitivity Label Object.
      --=============================================================
      procedure Get(MLD    : in MLD_Object; 
                    SLabel : in out CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Information Label associated with the given
      --      MLD Object.
      --  Input:   MLD      Given MLD object.
      --  Output:  ILabel   Information Label Object.
      --=============================================================
      procedure Get(MLD    : in MLD_Object; 
                    ILabel : in out CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Access Control List (ACL) associated with the
      --      given MLD Object.
      --  Input:   MLD   Given MLD object.
      --  Output:  ACL   ACL Object.
      --=============================================================
      procedure Get(MLD : in MLD_Object; 
                    ACL : in out CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Sensitivity Label associated with the given
      --      MLD Object using the given Sensitivity Label object.
      --  Input:   MLD      Given MLD object.
      --           SLabel   Sensitivity Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(MLD    : in MLD_Object; 
                    SLabel : in CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Information Label associated with the given
      --      MLD Object, using the given Information Label object.
      --  Input:   MLD      Given MLD object.
      --           ILabel   Information Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(MLD    : in MLD_Object; 
                    ILabel : in CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Access Control List (ACL) associated with the
      --      given MLD Object, using the given ACL object.
      --  Input:   MLD      Given MLD object.
      --           ACL      ACL Object.
      --  Output:  None.
      --=============================================================
      procedure Set(MLD : in MLD_Object; ACL : in CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Open
      --  Description:
      --      Opens the given Multi-Level Directory for reading.  If
      --      Method is Search_Specified_Level and SLabel is not
      --      specified, the current process' security level will be
      --      used.
      --  Input:   MLD         The given MLD object.
      --           Method      How to search for the MLD object.
      --           SLabel      To be matched during the search.
      --  Output:  None.
      --=============================================================
      procedure Open(MLD    : in out MLD_Object;
                     Method : in MLD_Open_Method := Search_ALL_Dirs;
                     SLabel : in CMW.SLabel.SLabel_Object 
                              := CMW.SLabel.Null_SLabel_Object);
 
      --=============================================================
      --  Procedure: Close
      --  Description:
      --      Closes the Multi-Level Directory opened for reading, and
      --      frees internal space used
      --  Input:   MLD      The opened MLD object.
      --  Output:  None.
      --=============================================================
      procedure Close(MLD : in MLD_Object);
 
      --=============================================================
      --  Procedure: Read
      --  Description:
      --      Reads and returns the next directory entry name from
      --      the opened Multi Level Directory.
      --  Input:   MLD            Opened MLD object.
      --  Output:  Entry_Name     The next entry name.
      --=============================================================
      procedure Read(MLD : in MLD_Object; Entry_Name : out Pathname);
 
      --=============================================================
      --  Procedure: Read
      --  Description:
      --      Reads and returns the next directory entry name from
      --      the opened Multi Level Directory.  Also returns the
      --        directory name containing the entry name.
      --  Input:   MLD                        Opened MLD object.
      --  Output:  Entry_Name                 The next entry name.
      --           Diversion_Directory_Name   Directory name containing
      --                                      the entry name.
      --=============================================================
      procedure Read(MLD                      : in MLD_Object;
                     Entry_Name               : out Pathname;
                     Diversion_Directory_Name : out Pathname);
 
      --=============================================================
      --  Procedure: Read
      --  Description:
      --      Returns the subdirectory name of an opened
      --      Multi Level Directory which matches the given
      --      Sensitivity level.  An empty string will be returned
      --      if MLD is not a multi-level directory or there is no
      --      subdirectory matching SLabel.
      --  Input:   MLD         Opened MLD object.
      --           SLabel      Sensitivity level used for searching
      --                       Subdirectory Name.
      --  Output:  Diversion_Directory_Name    Directory name matching
      --                                       the given SLabel.
      --=============================================================
      procedure Read
         (MLD                      : in MLD_Object;
          SLabel                   : in CMW.SLabel.SLabel_Object;
          Diversion_Directory_Name : out Pathname);
 
      --=============================================================
      --  Procedure: Rewind
      --  Description:
      --      Resets the position of the traversal to the beginning
      --     of the opened Multi-Level Directory.
      --  Input:   MLD         The opened MLD object.
      --  Output:  None.
      --=============================================================
      procedure Rewind(MLD : in MLD_Object);
 
      --=============================================================
      --  Function: Is_MLD
      --  Description:
      --      Determines whether the specified directory is a
      --      Multi-Level Directory.
      --  Input:   DirName            Specified directory name.
      --  Output:  True/False
      --=============================================================
      function Is_MLD(DirName : Pathname) return Boolean;
   
   private
      type MLD_Object is record
         MLD_Name       : Pathname(1 .. 256) := (others => ' ');
         MLD_Pointer    : MLD_Pointer_Type := null;
      end record;
   
   end MLD;
 
 
   --==================================================
   --
   -- Sub-Package Specification of File Object
   --
   --==================================================
   package File is
      type    File_Object             is private;

      --=============================================================
      --  Function: Object_Of
      --  Description:
      --      Gets the File Object associated with the given
      --      file name.
      --  Input:   File_Name     Given file name.
      --  Output:  File_Object   Object for file name.
      --=============================================================
      function Object_Of(File_Name : Pathname) return File_Object;
 
      --=============================================================
      --  Function: Pathname_Of
      --  Description:
      --      Gets the pathname associated with the given
      --      File object.
      --  Input:   File         Given directory object.
      --  Output:  Pathname     Pathname of object.
      --=============================================================
      function Pathname_Of(File : File_Object) return String;
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Sensitivity Label associated with the given
      --      File Object.
      --  Input:   File      Given file object.
      --  Output:  SLabel    Sensitivity Label Object.
      --=============================================================
      procedure Get(File   : in File_Object;
                    SLabel : in out CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Information Label associated with the given
      --      File Object.
      --  Input:   File      Given file object.
      --  Output:  ILabel    Information Label Object.
      --=============================================================
      procedure Get(File   : in File_Object;
                    ILabel : in out CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets one of the privilege sets for a File Object.
      --  Input:   File            Given file object.
      --           Privilege_Set   Type of privilege to retrieve.
      --  Output:  Privileges      Object containing Privilege set
      --                           for File.
      --=============================================================
      procedure Get
         (File          : in File_Object;
          Privilege_Set : in Privilege.File_Privilege_Set;
          Privileges    : in out 
                          CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Access Control List (ACL) associated with the
      --      given File Object.
      --  Input:   File      Given file object.
      --  Output:  ACL       ACL Object.
      --=============================================================
      procedure Get(File : in File_Object; 
                    ACL  : in out CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Sensitivity Label associated with the given
      --      File Object using the given Sensitivity Label
      --      object.
      --  Input:   File         Given file object.
      --           SLabel       Sensitivity Label Object.
      --=============================================================
      procedure Set(File   : in File_Object; 
                    SLabel : in CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Information Label associated with the given
      --      File Object, using the given Information Label
      --      object.
      --  Input:   File         Given File object.
      --           ILabel       Information Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(File   : in File_Object; 
                    ILabel : in CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets a privilege set for a File Object.
      --  Input:   File               Given file object.
      --           Privilege_Set      Type of privilege to retrieve.
      --  Output:  Privileges         Object containing Privilege set
      --                              for File.
      --=============================================================
      procedure Set
         (File          : in File_Object;
          Privilege_Set : in Privilege.File_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Access Control List (ACL) associated with the
      --      given File Object, using the given ACL object.
      --  Input:   File      Given File object.
      --           ACL       ACL Object.
      --  Output:  None.
      --=============================================================
      procedure Set(File : in File_Object; 
                    ACL  : in CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Add
      --  Description:
      --     Adds the privileges to the existing privilege Set
      --     associated with the given File.
      --  Input:  File              Given file
      --          Privilege_Set     Type of privilege set to add.
      --          Privileges        Object holding set of privileges.
      --  Output: None.
      --=============================================================
      procedure Add
         (File          : in File_Object;
          Privilege_Set : in Privilege.File_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --     Removes the privileges from the existing privilege Set
      --     associated with the given File.
      --  Input:  File              Given file
      --          Privilege_Set     Type of privilege set to remove.
      --          Privileges        Object holding set of privileges.
      --  Output: None.
      --=============================================================
      procedure Remove
         (File          : in File_Object;
          Privilege_Set : in Privilege.File_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);

   private

      type File_Object is record
         File_Name      : Pathname(1 .. 256) := (others => ' ');
      end record;

   end File;
 
 
   --==================================================
   --
   -- Sub-Package Specification of Device Object
   --
   --==================================================
   package Device is
      type    Device_Object           is private;

      --=============================================================
      --  Function: Object_Of
      --  Description:
      --      Gets the Device Object associated with the given
      --      Device name.
      --  Input:   Device            Given Device name.
      --  Output:  Device_Object     Object for Device name.
      --=============================================================
      function Object_Of(Device : Pathname) return Device_Object;
 
      --=============================================================
      --  Function: Pathname_Of
      --  Description:
      --      Gets the pathname associated with the given
      --      Device object.
      --  Input:   Device       Given Device object.
      --  Output:  Pathname     Pathname of object.
      --=============================================================
      function Pathname_Of(Device : Device_Object) return String;
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Sensitivity Label associated with the given
      --      Device Object.
      --  Input:   Device      Given Device object.
      --  Output:  SLabel      Sensitivity Label Object.
      --=============================================================
      procedure Get(Device : in Device_Object;
                    SLabel : in out CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Information Label associated with the given
      --      Device Object.
      --  Input:   Device      Given Device object.
      --  Output:  ILabel      Information Label Object.
      --=============================================================
      procedure Get(Device : in Device_Object;
                    ILabel : in out CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --      Gets the Access Control List (ACL) associated with the
      --      given Device Object.
      --  Input:   Device      Given Device object.
      --  Output:  ACL         ACL Object.
      --=============================================================
      procedure Get(Device : in Device_Object; 
                    ACL    : in out CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Sensitivity Label associated with the given
      --      Device Object using the given Sensitivity Label
      --      object.
      --  Input:   Device      Given Device object.
      --           SLabel      Sensitivity Label Object.
      --  Output:  None.
      --=============================================================
      procedure Set(Device : in Device_Object;
                    SLabel : in CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Information Label associated with the given
      --      Device Object, using the given Information Label
      --      object.
      --  Input:   Device      Given Device object.
      --           ILabel      Information Label Object.
      --=============================================================
      procedure Set(Device : in Device_Object;
                    ILabel : in CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --      Sets the Access Control List (ACL) associated with the
      --      given Device Object, using the given ACL object.
      --  Input:   Device      Given Device object.
      --           ACL         ACL Object.
      --  Output:  None.
      --=============================================================
      procedure Set(Device : in Device_Object; 
                    ACL    : in CMW.ACL.ACL_Object);
 
      --=============================================================
      --  Procedure: Stop_IO
      --  Description:
      --      Stops further I/O to the given Device object.
      --  Input:   Device      Given Device object.
      --  Output:  None.
      --=============================================================
      procedure Stop_IO(Device : in Device_Object);

   private
      type Device_Object is record
         Device_Name : Pathname(1 .. 256) := (others => ' ');
      end record;
   
   end Device;
   
   
   --=====================================================
   --
   -- Sub-Package Specification of Current_Process Object
   --
   --=====================================================
   package Current_Process is

      --=============================================================
      --  Procedure: Init_Privileges
      --  Description:
      --     Removes from the process' effective privileges all but a
      --     subset of the user's base privileges.
      --  Input:  None.
      --  Output: None.
      --=============================================================
      procedure Init_Privileges;
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the clearance label of the current process based on
      --     the given Clearance.
      --  Input:  Clearance      Label used to set the current process.
      --  Output: None.
      --=============================================================
      procedure Set(Clearance : in CMW.Clearance.Clearance_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the Sensitivity label of the current process based
      --     on the given SLabel.
      --  Input:  SLabel      Label used to set the current process.
      --  Output: None.
      --=============================================================
      procedure Set(SLabel : in CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the Information label of the current process based
      --     on the given ILabel.
      --  Input:  ILabel      Label used to set the current process.
      --  Output: None.
      --=============================================================
      procedure Set(ILabel : in CMW.ILabel.ILabel_Object);
 
      --=============================================================
      --  Procedure: Set
      --  Description:
      --     Sets the maximum privilege, base privilege, or
      --     effective privilege of the current process based
      --     on the given Privilege object.
      --  Input:  Privilege_Set     Type of privilege set.
      --          Privileges        Set of privileges.
      --  Output: None.
      --=============================================================
      procedure Set
         (Privilege_Set : in CMW.Privilege.Process_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --     Gets the clearance label of the current process.
      --  Input:  Clearance      Object to store the retrieved label.
      --  Output: Clearance      Object holding the retrieved label.
      --=============================================================
      procedure Get(Clearance : in out CMW.Clearance.Clearance_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --     Gets the Sensitivity label of the current process.
      --  Input:  Sensitivity      Object to store the retrieved label.
      --  Output: Sensitivity      Object holding the retrieved label.
      --=============================================================
      procedure Get(SLabel : in out CMW.SLabel.SLabel_Object);
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --     Gets the Information label of the current process.
      --  Input:  Information      Object to store the retrieved label.
      --  Output: Information      Object holding the retrieved label.
      --=============================================================
      procedure Get(ILabel : in out CMW.ILabel.ILabel_Object);
 
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --     Gets the maximum privilege, base privilege, or
      --     effective privilege of the current process.
      --  Input:  Privilege_Set     Type of privilege set to get.
      --  Output: Privileges        Object holding set of privileges.
      --=============================================================
      procedure Get
         (Privilege_Set : in CMW.Privilege.Process_Privilege_Set;
          Privileges    : in out 
                          CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Add
      --  Description:
      --     Adds the maximum privilege, base privilege, or
      --     effective privilege set to the current process.
      --  Input:  Privilege_Set     Type of privilege set to add.
      --          Privileges        Object holding set of privileges.
      --  Output: None.
      --=============================================================
      procedure Add
         (Privilege_Set : in CMW.Privilege.Process_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);
 
      --=============================================================
      --  Procedure: Remove
      --  Description:
      --     Removes the maximum privilege, base privilege, or
      --     effective privilege set from the current process.
      --  Input:  Privilege_Set     Type of privilege set to remove.
      --          Privileges        Object holding set of privileges.
      --  Output: None.
      --=============================================================
      procedure Remove
         (Privilege_Set : in CMW.Privilege.Process_Privilege_Set;
          Privileges    : in CMW.Privilege.Privilege_Vector_Object);

   end Current_Process;
 
 
 
   --============================================================
   --
   -- Sub-Package Specification of Command_Authorizations Object
   --
   --============================================================
   package Command_Authorizations_DB is

      subtype Authorization_Name         is String;
      type Authorization_List            is
              array(Natural range <>) of Authorization_Name(1 .. 256);
      type Command_Authorization_Request is (Widest_Authorization,
                                             Total_Authorizations);
 
      --=============================================================
      --  Procedure: Open
      --  Description:
      --     Opens the Command Authorizations database for subsequent
      --     operations.  This must be the first call before other
      --     calls on Command Authorizations.
      --  Input:  None.
      --  Output: None.
      --=============================================================
      procedure Open;
 
      --=============================================================
      --  Procedure: Close
      --  Description:
      --     Closes the Command Authorizations database for further
      --     operations.  This must be the last call after other calls
      --     on Command Authorizations.
      --  Input:  None.
      --  Output: None.
      --=============================================================
      procedure Close;
 
      --=============================================================
      --  Procedure: Rewind
      --  Description:
      --     Rewinds the Command Authorizations database to its logical
      --     beginning.
      --  Input:  None.
      --  Output: None.
      --=============================================================
      procedure Rewind;
 
      --=============================================================
      --  Procedure: Get
      --  Description:
      --     Gets the specified information about the Command
      --     Authorizations database.
      --  Input:  Type_Of_Request       Type of information to get.
      --  Output: Authorization_Value   Requested information.
      --=============================================================
      procedure Get
         (Type_Of_Request     : in Command_Authorization_Request;
          Authorization_Value : out Natural);
 
      --=============================================================
      --  Procedure: Implies_Authorization
      --  Description:
      --     Returns whether the given command authorization is implied
      --     by the given authorization vector.
      --  Input:  Authorization_Name   Name to check for.
      --          Authorization_Vec    Object to check against.
      --  Output: True/False
      --=============================================================
      function Implies_Authorization
         (Authorization_Name : String;
          Authorization_Vec  : CMW.Privilege.Privilege_Vector_Object)
          return Boolean;
 
      --=============================================================
      --  Procedure: Has_Authorization
      --  Description:
      --     Returns whether the current user has the given
      --     authorization.
      --  Input:  Authorization_Name         Name to check for.
      --  Output: True/False.
      --=============================================================
      function Has_Authorization(Authorization_Name : in String)
                                 return Boolean;
 
      --=============================================================
      --  Procedure: Write
      --  Description:
      --     Writes the given authorizations for the given user into
      --     the Command Authorizations database.
      --  Input:  Authorization_Name            Name to check for.
      --  Output: True/False.
      --=============================================================
      procedure Write(UserName       : in String;
                      Authorizations : in Authorization_List;
                      List_Length    : in Natural);

   end Command_Authorizations_DB;

 
   --============================================
   --
   --  Sub-package Specification of Passwords_DB
   --
   --============================================
   package Passwords_DB is
 
      subtype Protected_Password_Entry is 
         Protected_Password_Entry_Type;

      --================================================================
      --  Procedure: Open
      --  Description: Opens the Protected Passwords database.
      --  Input:  None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Protected Passwords database.
      --  Input:  None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Protected Passwords database to its
      --     logical beginning.
      --  Input:  None.
      --  Output: None. 
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the Protected Passwords 
      --     database.
      --  Input:  None.
      --  Output: The next password entry.
      --================================================================
      procedure Read (Password_Entry : out Protected_Password_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with given User ID from the
      --     Protected Passwords database.
      --  Input:  The User ID.
      --  Output: The password entry.
      --================================================================
      procedure Read(ID             : in User_ID;
                     Password_Entry : in out Protected_Password_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from the
      --     Protected Passwords database.
      --  Input:  The user name.
      --  Output: The password entry.
      --================================================================
      procedure Read(Name           : in String;
                     Password_Entry : in out Protected_Password_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the
      --     Protected Passwords database.
      --  Input:  The user name and the password entry.
      --  Output: None.
      --================================================================
      procedure Write (Name           : in String;
                       Password_Entry : in Protected_Password_Entry);

   end Passwords_DB;


   --===========================================
   --
   --  Sub-package Specification of Defaults_DB
   --
   --=========================================== 
   package Defaults_DB is

      subtype Defaults_Entry is Defaults_Entry_Type;
 
      --================================================================
      --  Procedure: Open
      --  Description: Opens the Defaults database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;
 
      --================================================================
      --  Procedure: Close
      --  Description: Closes the Defaults database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Defaults database to its logical
      --     beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the Defaults database.
      --  Input: None.
      --  Output: The default entry.
      --================================================================
      procedure Read (Default_Entry : out Defaults_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from the 
      --     Defaults database.
      --  Input: The user name.
      --  Output: The default entry.
      --================================================================
      procedure Read (Name          : in String;
                      Default_Entry : out Defaults_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the
      --     Defaults database.
      --  Input: The user name.
      --  Output: The default entry.
      --================================================================
      procedure Write (Name          : in String;
                       Default_Entry : in Defaults_Entry);

   end Defaults_DB;
 

   --==========================================
   --
   --  Sub-package Specification of Devices_DB
   --
   --==========================================
   package Devices_DB is

      subtype Devices_Entry is Devices_Entry_Type;

      --================================================================
      --  Procedure: Open
      --  Description: Opens the Device Assignment database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Device Assignment database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Device Assignment database to its
      --     logical beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the Device Assignment
      --     database.
      --  Input: None.
      --  Output: The device assignment entry.
      --================================================================
      procedure Read (Device_Entry : out Devices_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from the
      --     Device Assignment database.
      --  Input: The device name.
      --  Output: The device assignment entry.
      --================================================================ 
      procedure Read (Name         : in String;
                      Device_Entry : out Devices_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the Device
      --     Assignment database.
      --  Input: The device name and the device assignment entry.
      --  Output: None.
      --================================================================
      procedure Write (Name         : in String;
                       Device_Entry : in Devices_Entry);

   end Devices_DB;
 

   --===============================================
   --
   --  Sub-package Specification of File_Control_DB
   --
   --===============================================
   package File_Control_DB is
 
      subtype File_Control_Entry is File_Control_Entry_Type;

      --================================================================
      --  Procedure: Open
      --  Description: Opens the File Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the File Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the File Control database to its logical
      --     beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the File Control
      --     database.
      --  Input: None.
      --  Output: The file control entry.
      --================================================================
      procedure Read (File_Entry : in out File_Control_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from
      --     the File Control database.
      --  Input: The filename.
      --  Output: The file control entry.
      --================================================================
      procedure Read (Name       : in String;
                      File_Entry : out File_Control_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the File
      --     Control database.
      --  Input: The filename and the entry to the file control 
      --     database.
      --  Output: None.
      --================================================================
      procedure Write (Name       : in String;
                       File_Entry : in File_Control_Entry);

   end File_Control_DB;
 

   --===================================================
   --
   --  Sub-package Specification of Terminal_Control_DB
   --
   --===================================================
   package Terminal_Control_DB is

      subtype Terminal_Control_Entry is Terminal_Control_Entry_Type;

      --================================================================
      --  Procedure: Open
      --  Description: Opens the Terminal Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Terminal Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Terminal Control database to its
      --     logical beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;
 
      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the Terminal Control
      --     database.
      --  Input: None.
      --  Output: The terminal control entry.
      --================================================================
      procedure Read (Terminal_Entry : out Terminal_Control_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from the
      --     Terminal Control database.
      --  Input: The terminal name.
      --  Output: The terminal control entry.
      --================================================================
      procedure Read (Name           : in String;
                      Terminal_Entry : out Terminal_Control_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the
      --     Terminal Control database.
      --  Input: The terminal name and the terminal control entry.
      --  Output: None.
      --================================================================
      procedure Write (Name           : in String;
                       Terminal_Entry : in Terminal_Control_Entry);

   end Terminal_Control_DB;
 

   --==================================================
   --
   --  Sub-package Specification of Printer_Control_DB
   --
   --==================================================
   package Printer_Control_DB is

      subtype Printer_Control_Entry is Printer_Control_Entry_Type;

      --================================================================
      --  Procedure: Open
      --  Description: Opens the Printer Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Printer Control database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Printer Control database to its
      --     logical beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;
      
      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry from the Printer Control
      --     database.
      --  Input: None.
      --  Output: The printer control entry.
      --================================================================
      procedure Read (Printer_Entry : out Printer_Control_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name from the
      --     Printer Control database.
      --  Input: The printer name.
      --  Output: The printer control entry.
      --================================================================
      procedure Read (Name          : in String;
                      Printer_Entry : out Printer_Control_Entry);

      --================================================================
      --  Procedure: Write
      --  Description: Writes an entry with the given name to the 
      --     Printer Control database.
      --  Input: The printer name and the printer control entry.
      --  Output: None.
      --================================================================
      procedure Write (Name          : in String;
                       Printer_Entry : in Printer_Control_Entry);

   end Printer_Control_DB;
 

   --==================================================
   --
   --  Sub-package Specification of Security_Policy_DB
   --
   --==================================================
   package Security_Policy_DB is
 
      subtype Security_Policy_IR       is String;
      subtype Security_Policy_Settings is Security_Policy_Settings_Type;
      type    Security_Policy_Mode     is (Read_Only, Read_Write);

      --================================================================
      --  Procedure: Open
      --  Description: Opens the Security Policy database.
      --  Input: The name of the security policy database, the
      --     mode to access the database, and the number of I/O
      --     buffers for the cache.
      --  Output: None.
      --================================================================
      procedure Open (DB_Name           : in String;
                      Access_Mode       : in Security_Policy_Mode;
                      Number_Of_Buffers : in Integer);

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Security Policy database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Close;

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Security Policy database to its
      --     logical beginning.
      --  Input: The name of the security policy database and the
      --     mode to access the database.
      --  Output: None.
      --================================================================
      procedure Rewind (DB_Name     : in String;
                        Access_Mode : in Security_Policy_Mode);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Security Policy database configuration.
      --  Input: None.
      --  Output: The security policy configuration.
      --================================================================
      procedure Get 
         (Policy_Configuration : in out Security_Policy_Settings);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the tag associated with the given internal
      --     representation (IR).
      --  Input: The given IR.
      --  Output: The tag object associated with the given IR.
      --================================================================ 
      procedure Read (IR_In   : in Security_Policy_IR;
                      Tag_Out : out Tag_Object);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the internal representation (IR) associated
      --     with the given tag.
      --  Input: The given tag object.
      --  Output: the IR associated with the given tag.
      --================================================================
      procedure Read (Tag_In : in Tag_Object;
                      IR_Out : out Security_Policy_IR);

      --================================================================
      --  Procedure: Write
      --  Description: Writes a new tag for the given IR into the
      --     Security Policy database.
      --  Input: The internal representation and its size.
      --  Output: The tag object.
      --================================================================
      procedure Write(IR  : in Security_Policy_IR;
                      Tag : out Tag_Object);

      --================================================================
      --  Procedure: Remove
      --  Description: Removes the given tag from the Security Policy
      --     database.
      --  Input: The given tag object.
      --  Output: None.
      --================================================================
      procedure Remove(Tag : in Tag_Object);

   end Security_Policy_DB;
 

   --==================================================
   --
   --  Sub-package Specification of TNet_Interfaces_DB
   --
   --==================================================
   package TNet_Interfaces_DB is

      subtype TNET_Interfaces_Entry is TNET_Interfaces_Entry_Type;
       
      --================================================================
      --  Procedure: Open
      --  Description: Opens the Trusted Network Interfaces database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Trusted Network Interfaces database.
      --  Input: None.
      --  Output: None.
       --================================================================
      procedure Close(Interfaces_Entry : in out TNet_Interfaces_Entry);

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Trusted Network Interfaces database
      --     to its logical beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind
         (Interfaces_Entry : in out TNet_Interfaces_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry in the Trusted Network
      --     Interfaces database.
      --  Input: None.
      --  Output: The next entry in the trusted network interfaces
      --     database.
      --================================================================
      procedure Read (Interfaces_Entry : in out TNet_Interfaces_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given name in the
      --     Trusted Network Interfaces database.
      --  Input: None.
      --  Output: The entry with the given name in the trusted
      --     network interfaces database.
      --================================================================
      procedure Read (Interface_Name   : in String;
                      Interfaces_Entry : in out TNet_Interfaces_Entry);

   end TNet_Interfaces_DB;
 

   --====================================================
   --
   --  Sub-package Specification of TNet_Remote_Hosts_DB
   --
   --====================================================
   package TNet_Remote_Hosts_DB is

      subtype TNET_Remote_Hosts_Entry is TNET_Remote_Hosts_Entry_Type;
     
      --================================================================
      --  Procedure: Open
      --  Description: Opens the Trusted Network Remote Hosts database.
      --  Input: None.
      --  Output: The remote hosts entry.
      --================================================================
      procedure Open(Remote_Hosts_Entry : out TNet_Remote_Hosts_Entry);

      --================================================================
      --  Procedure: Close
      --  Description: Closes the Trusted Network Remote Hosts database
      --  Input: The remote hosts entry.
      --  Output: None.
      --================================================================
      procedure Close
         (Remote_Hosts_Entry : in out TNet_Remote_Hosts_Entry);

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Trusted Network Remote Hosts database
      --     to the logical beginning.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Set_Local
      --  Description: Sets Remote Hosts lookup to local only.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Set_Local;

      --================================================================
      --  Function: Is_Local
      --  Description: Returns whether Remote Hosts lookup is local.
      --  Input: None.
      --  Output: None.
      --================================================================
      function Is_Local return Boolean;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the next entry in the Trusted Network
      --     Remote Hosts database.  Supports multiple reads prior
      --     to closing the database.
      --  Input: None.
      --  Output: The next entry in the trusted network remote
      --     hosts database.
      --================================================================
      procedure Read
         (Remote_Hosts_Entry : in out TNet_Remote_Hosts_Entry);

      --================================================================
      --  Procedure: Read
      --  Description: Reads the entry with the given hostname in the
      --     Trusted Network Remote Hosts database.
      --  Input: None.
      --  Output: The entry with the given hostname in the trusted
      --     network remote hosts database.
      --================================================================
      procedure Read (HostName : in String;
                      Info     : in out TNet_Remote_Hosts_Entry);

   end TNet_Remote_Hosts_DB;
 

   --==============================================
   --
   --  Sub-package Specification of TNet_Config_DB
   --
   --==============================================
   package TNet_Config_DB is

      subtype TNET_Config_Entry is TNET_Config_Entry_Type;
     
      --================================================================
      --  Procedure: Open
      --  Description: Opens the Trusted Network Configuration database
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Open;

      --================================================================
      --  Procedure: Close
      --  Description: Frees the configuration entry and any other 
      --     memory allocated in the Trusted Network Configuration
      --     database.
      --  Input: The configuration entry as returned by the Get
      --     procedure below.
      --  Output: None.
      --================================================================
      procedure Close(Config_Entry : in out TNet_Config_Entry);

      --================================================================
      --  Procedure: Rewind
      --  Description: Rewinds the Trusted Network Configuration
      --     database.
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Rewind;

      --================================================================
      --  Procedure: Read
      --  Description: Reads the configuration entry from the Trusted 
      --     Network Configuration database.
      --  Input: None.
      --  Output: The configuration entry.
      --================================================================
      procedure Read(Config_Entry : out TNet_Config_Entry);

   end TNet_Config_DB;
 
 
   --=============================================
   --
   --  Sub-package Specification of Shared_Memory
   --
   --=============================================
   package Shared_Memory is

      type Shared_Memory_Object is private;

      --================================================================
      --  Function: Object_Of
      --  Description: Returns the Shared Memory Object associated with
      --     the given shared memory ID.
      --  Input: The shared memory ID number.
      --  Output: The shared memory object.
      --================================================================
      function Object_Of 
         (Shared_Memory_ID : in Natural) return Shared_Memory_Object;

      --================================================================
      --  Function: ID_Of
      --  Description: Returns the Shared Memory ID associated with the
      --     given shared memory object.
      --  Input: The shared memory object.
      --  Output: The shared memory ID number.
      --================================================================
      function ID_Of
         (Shared_Memory : in Shared_Memory_Object) return Natural;

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Sensitivity label associated with the
      --     given shared memory object.
      --  Input: The shared memory object.
      --  Output: The sensitivity label associated with the shared
      --     memory object.
      --================================================================
      procedure Get (Shared_Memory : in Shared_Memory_Object;
                     SLabel        : in out CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Information label associated with the
      --     given shared memory object.
      --  Input: The shared memory object.
      --  Output: The information label associated with the shared
      --     memory object.
      --================================================================
      procedure Get (Shared_Memory : in Shared_Memory_Object;
                     ILabel        : in out CMW.ILabel.ILabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the ACL associated with the given shared
      --     memory object.
      --  Input: The shared memory object.
      --  Output: The access control list object associated with the
      --     shared memory object.
      --================================================================
      procedure Get (Shared_Memory : in Shared_Memory_Object;
                     ACL           : in out CMW.ACL.ACL_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Sensitivity label associated with the
      --     given shared memory object.
      --  Input: The shared memory object and its sensitivity label.
      --  Output: None.
      --================================================================
      procedure Set (Shared_Memory : in Shared_Memory_Object;
                     SLabel        : in out CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Information label associated with the
      --     given shared memory object.
      --  Input: The shared memory object and its information label.
      --  Output: None.
      --================================================================
      procedure Set (Shared_Memory : in Shared_Memory_Object;
                     ILabel        : in out CMW.ILabel.ILabel_Object);
    
      --================================================================
      --  Procedure: Set
      --  Description: Sets the ACL associated with the given shared
      --     memory object.
      --  Input: The shared memory object and its access control list
      --     object.
      --  Output: None
      --================================================================
      procedure Set (Shared_Memory : in Shared_Memory_Object;
                     ACL           : in out CMW.ACL.ACL_Object);

   private
      type Shared_Memory_Object is record
         Shared_Memory_Id : Natural;
      end record;

   end Shared_Memory;
 

   --=========================================
   --
   --  Sub-package Specification of Semaphore
   --
   --=========================================
   package Semaphore is

      type    Semaphore_Object        is private;

      --================================================================
      --  Function: Object_Of
      --  Description: Returns the Semaphore Object associated with the
      --     given semaphore ID.
      --  Input: The semaphore ID number.
      --  Output: The semaphore object.
      --================================================================
      function Object_Of
         (Semaphore_ID : in Natural) return Semaphore_Object;

      --================================================================
      --  Function: ID_Of
      --  Description: Returns the Semaphore_ID associated with the
      --     given semaphore object.
      --  Input: The semaphore object.
      --  Output: The semaphore ID number.
      --================================================================
      function ID_Of
         (Semaphore : in Semaphore_Object) return Natural;

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Sensitivity label associated with the
      --     given semaphore object.
      --  Input: The semaphore object.
      --  Output: The sensitivity label associated with the given
      --     semaphore object.
      --================================================================
      procedure Get (Semaphore : in Semaphore_Object;
                     SLabel    : in out CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Information label associated with the
      --     given semaphore object.
      --  Input: The semaphore object.
      --  Output: The information label associated with the given
      --     semaphore object.
      --================================================================
      procedure Get (Semaphore : in Semaphore_Object;
                     ILabel    : in out CMW.ILabel.ILabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the ACL associated with the given semaphore
      --     object.
      --  Input: The semaphore object.
      --  Output: The access control list object associated with the
      --     semaphore object.
      --================================================================
      procedure Get (Semaphore : in Semaphore_Object;
                     ACL       : in out CMW.ACL.ACL_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Sensitivity label associated with the
      --     given semaphore object.
      --  Input: The semaphore object and its sensitivity label.
      --  Output: None.
      --================================================================
      procedure Set (Semaphore : in Semaphore_Object;
                     SLabel    : in CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Information label associated with the
      --     given semaphore object.
      --  Input: The semaphore object and its information label.
      --  Output: None.
      --================================================================
      procedure Set (Semaphore : in Semaphore_Object;
                     ILabel    : in CMW.ILabel.ILabel_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the ACL associated with the given semaphore
      --     object.
      --  Input: The semaphore object and its access control list object
      --  Output: None.
      --================================================================
      procedure Set (Semaphore : in Semaphore_Object;
                     ACL       : in CMW.ACL.ACL_Object);

   private
      type Semaphore_Object is record
         Semaphore_Id   : Natural;
      end record;

   end Semaphore;
 

   --=======================================
   --
   --  Sub-package Specification of Message
   --
   --=======================================
   package Message is

      type    Message_Object          is private;

      --================================================================
      --  Function: Object_Of
      --  Description: Returns the Message Object associated with the
      --     given message ID.
      --  Input: The message ID number.
      --  Output: The message object.
      --================================================================
      function Object_Of
         (Message_ID : in Natural) return Message_Object;

      --================================================================
      --  Function: ID_Of
      --  Description: Returns the Message_ID associated with the given
      --     message object.
      --  Input: The message object.
      --  Output: The message ID number.
      --================================================================
      function ID_Of
         (Message : in Message_Object) return Natural;

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Sensitivity label associated with the
      --     given message object.
      --  Input: The message object.
      --  Output: The sensitivity label associated with the given
      --     message object.
      --================================================================
      procedure Get (Message : in Message_Object;
                     SLabel  : in out CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the Information label associated with the
      --      given message object.
      --  Input: The message object.
      --  Output: The information label associated with the given
      --     message object.
      --================================================================
      procedure Get (Message : in Message_Object;
                     ILabel  : in out CMW.ILabel.ILabel_Object);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the ACL associated with the given message
      --     object.
      --  Input: The message object.
      --  Output: The access control list associated with the given
      --     message object.
      --================================================================
      procedure Get (Message : in Message_Object;
                     ACL     : in out CMW.ACL.ACL_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Sensitivity label associated with the
      --     given message object.
      --  Input: The message object and its sensitivity label.
      --  Output: None.
      --================================================================
      procedure Set (Message : in Message_Object;
                     SLabel  : in CMW.SLabel.SLabel_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the Information label associated with the
      --     given message object.
      --  Input: The message object and its information label.
      --  Output: None.
      --================================================================
      procedure Set (Message : in Message_Object;
                     ILabel  : in CMW.ILabel.ILabel_Object);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the ACL associated with the given message
      --     object.
      --  Input: The message object and its access control list.
      --  Output: None
      --================================================================
      procedure Set (Message : in Message_Object; 
                     ACL     : in CMW.ACL.ACL_Object);

   private

      type Message_Object is record
         Message_Id     : Natural;
      end record;

   end Message;
 

   --====================================
   --
   --  Sub-package Specification of User
   --
   --====================================
   package User is
      
      type ID_Type is (Login_UID,
                       Starting_RUID,
                       Starting_EUID,
                       Starting_RGID,
                       Starting_EGID);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the ID number for the current user and given
      --     ID type.
      --  Input: The ID type.
      --  Output: The current user's ID number.
      --================================================================ 
      procedure Get(ID_Category : in ID_Type;
                    ID          : out Natural);
 
   end User;
 

   --=====================================
   --
   --  Sub-package Specification of Audit
   --
   --=====================================
   package Audit is
 
      subtype String_128       is String (1 .. 128);
      type    DEC_Integer_Ptrs is access Integer;
      subtype GID_Pointers     is GID_Pointers_Type;
      subtype Masks            is Mask;
      subtype Flags            is Integer;
      --
      subtype User_IDs         is User_ID_Type;
      subtype Process_IDs      is Process_ID_Type;
      subtype Group_IDs        is Group_ID_Type;
      --
      subtype Modes            is Mode_Type;
      subtype Data_Pointers    is Data_Pointer_Type;
 
      --
      -- User-specified audit request options.
      --
      type  Transfer_Request is
               (SYSTEM_MASK,    -- system audit mask
                TRUSTED_MASK,   -- trusted audit mask
                PROCESS_MASK,   -- process audit mask
                SITE_MASK,      -- site-defined events that are logged
                HABITAT_EVENT,  -- habitat/system call names & mask bits
                UPDATE_EVENTS); -- update audit mask / audcntl flags

      type  Assign_Request is
               (PROCESS_CONTROL, -- audit control flags of current process
                AUDIT_SWITCH,    -- system audit switch
                AUDIT_STYLE,     -- system auditing style
                PAID,            -- not supported
                AUDIT_BITS);     -- not supported

      type  Query_Request is
               (NUMBER_SITE,  -- number of site events
                AUDIT_SIZE);  -- base size of an audit data buffer


      --================================================================
      --================================================================

      Resolution_Error : exception;
         --  This exception is raised when an audit request is
         --  not defined.

      --================================================================
      --================================================================


      --================================================================
      --================================================================
      --  Procedure: Activate
      --  Description: Activates the auditing function of CMW.
      --  Raises: CMW_Error  --  Activate failed.
      --  Input:  None.
      --  Output: None.
      --================================================================
      procedure Activate;

      --================================================================
      --  Procedure: Deactivate
      --  Description: Deactivates the auditing function of CMW.
      --  Raises: CMW_Error  --  Deactivate failed.
      --  Input:  None.
      --  Output: None.
      --================================================================
      procedure Deactivate;

      --================================================================
      --  Function: Is_Activated
      --  Description: Returns whether the auditing function of CMW has
      --               been activated.
      --  Raises: CMW_Error  --  Is_Activated failed.
      --  Input:  None.
      --  Output: The Boolean result.
      --================================================================
      function Is_Activated return Boolean;

      --================================================================
      --  Procedure: Flush
      --  Description: Flush the contents of the audit buffer.
      --  Raises: CMW_Error  --  Flush failed.
      --  Input:  None.
      --  Output: None.
      --================================================================
      procedure Flush;

      --================================================================
      --  Procedure: Get
      --  Description: Gets a specified value that corresponds to the
      --               given Assign_Request type.
      --  Raises: CMW_Error  --  Get failed.
      --  Input: A Assign_Request type.
      --  Output: The flag value that corresponds to the Assign_Request
      --          type.
      --================================================================
      procedure Get (Option : in Assign_Request;
                     Flags  : out Integer);

      --================================================================
      --  Procedure: Get
      --  Description: Gets a specified value that corresponds to the
      --               given Query_Request type.
      --  Raises: CMW_Error  --  Get failed.
      --          Resolution_Error  --  Request denied.
      --  Input: A Query_Request type.
      --  Output: The specified value that corresponds to the Query_Request
      --          type.
      --================================================================
      procedure Get (Option   : in Query_Request;
                     Quantity : out Integer);

      --================================================================
      --  Procedure: Get
      --  Description: Gets the mask/flag contents of the specified
      --               buffer that corresponds to the given Transfer
      --               Request option.
      --  Raises: CMW_Error  --  Get failed.
      --          Resolution_Error  --  Request denied.
      --  Input: An Transfer_Request option.
      --  Output: The mask/flag value.
      --================================================================
      procedure Get (Option     : in Transfer_Request;
                     Flags      : in Integer;
                     Buffer     : in out String;
                     Buf_Length : in out Integer;
                     Value      : out Integer);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the given specified value that corresponds
      --               to the given Assign_Request type.
      --  Raises: CMW_Error  --  Set failed.
      --  Input: The Assign_Request type and the corresponding value.
      --  Output: None.
      --================================================================
      procedure Set (Option : in Assign_Request;
                     Flags  : in Integer);

      --================================================================
      --  Procedure: Set
      --  Description: Sets the mask/flag contents of the specified
      --               buffer that corresponds to the given Transfer
      --               Request type.
      --  Raises: CMW_Error  --  Set failed.
      --  Input: The DEC CMW option, user or process IDs, any required 
      --         inputs including a buffer and its size, and the value
      --         to be set.
      --  Output: None.
      --================================================================
      procedure Set (Option     : in Transfer_Request;
                     Flags      : in Integer;
                     Buffer     : in out String;
                     Buf_Length : in out Integer;
                     Value      : out Integer);
  

      ------------------------------------------------------------------
      --
      -- User-specified kinds of data for argument list data.
      type Tokens is (String_Value, 
                      Integer_Pointer, 
                      Integer_Value,
                      GID_Pointer, 
                      Privilege_Mask, 
                      User_ID, 
                      Process_ID, 
                      Group_ID,
                      Mode_Value, 
                      Access_Control_List, 
                      Sensitivity_Label,
                      Information_Label, 
                      Data_Pointer);
 
      type Audit_Data (Kind : Tokens) is record
         case Kind is
            when String_Value =>
               String_Value        : String_128;
            when Integer_Pointer =>
               Integer_Pointer     : DEC_Integer_Ptrs;
            when Integer_Value =>
               Integer_Value       : Integer;
            when GID_Pointer =>
               GID_Pointer         : GID_Pointers;
            when Privilege_Mask =>
               Privilege_Mask      : Mask;
            when User_ID =>
               User_ID             : User_IDs;
            when Process_ID =>
               Process_ID          : Process_IDs;
            when Group_ID =>
               Group_ID            : Group_IDs;
            when Mode_Value =>
               Mode_Value          : Modes;
            when Access_Control_List =>
               Access_Control_List : CMW.ACL.ACL_Object;
            when Sensitivity_Label =>
               Sensitivity_Label   : CMW.SLabel.SLabel_Object;
            when Information_Label =>
               Information_Label   : CMW.ILabel.ILabel_Object;
            when Data_Pointer =>
               Data_Pointer        : Data_Pointers;
         end case;
      end record;
      --
      ------------------------------------------------------------------


      --================================================================
      --  Procedure: Write
      --  Description: Write the audit data for the given event to the
      --               audit stream.
      --  Raises: CMW_Error  --  Write failed.
      --  Input: The given event, kind of audit data, and a data 
      --         structure in which to write the audit data.
      --  Output: None.
      --================================================================
      procedure Write (Event : in Event_Option_Type;
                       Data  : in Audit_Data);
      --
   end Audit;
 

   --===================================
   --
   --  Sub-package Specification of TCB
   --
   --===================================
   package TCB is

      type TCB_States is (In_Trusted_Path,
                          Out_of_Trusted_Path,
                          Security_On,
                          Security_Off);

      --================================================================
      --  Procedure: Init
      --  Description: Initializes the Trusted Computing Base (TCB).
      --  Input: None.
      --  Output: None.
      --================================================================
      procedure Init;

      --================================================================
      --  Procedure: Set
      --  Description: Sets the TCB State.
      --  Input: The TCB state.
      --  Output: None.
      --================================================================
      procedure Set(TCB_State : in TCB_States);

      --================================================================
      --  Procedure: Is_Initialized
      --  Description: Returns whether the TCB has been initialized.
      --  Input: None.
      --  Output: The Boolean result.
      --================================================================
      function Is_Initialized return Boolean;

      --================================================================
      --  Procedure: System_In_Trusted_Path
      --  Description: Returns whether the system is currently in the
      --     trusted path.
      --  Input: None.
      --  Output: The Boolean result.
      --================================================================
      function System_In_Trusted_Path return Boolean;

      --================================================================
      --  Procedure: Security_Is_On
      --  Description: Returns whether system security has been 
      --     activated.
      --  Input: None.
      --  Output: None.
      --================================================================
      function Security_Is_On return Boolean;

   end TCB;
 
   --====================================
   --
   --  Sub-package Specification of Disk
   --
   --====================================
   package Disk is

      subtype FileSystem_Types is Natural;
      subtype Mount_Attributes is Mount_Attributes_Type;
      subtype Mount_Flags      is Natural;
 
      --================================================================
      --  Procedure: Label_Mount
      --  Description: Mounts an untagged filesystem as labeled.
      --  Input: The source path of a block special file, the 
      --     destination path of the directory to be mounted on, the
      --     mount flags, the vendor-specific filesystem type number,
      --     and the security tags.
      --  Output: None.
      --================================================================
      procedure Label_Mount(Source          : in Pathname;
                            Destination     : in Pathname;
                            Flags           : in Mount_Flags;
                            FileSystem_Type : in FileSystem_Types;
                            TagS            : in Mount_Attributes);
 
      --================================================================
      --  Function: Is_Tagged
      --  Description: Returns whether the current filesystem is
      --     security tagged.
      --  Input:  None.
      --  Output: The Boolean result.
      --================================================================
      function Is_Tagged return Boolean;

   end Disk;
 
 
   --=============================
   --
   --  Specification of Meta-APIs
   --
   --=============================

 
   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given Directory.
   --     Must call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(Directory : CMW.Directory.Directory_Object) 
      return CMW.SLabel.SLabel_Object;

   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given File.  Must
   --     call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(File : CMW.File.File_Object) 
      return CMW.SLabel.SLabel_Object;

   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given Device.  Must
   --     call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(Device : CMW.Device.Device_Object) 
      return CMW.SLabel.SLabel_Object;
      
   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given MLD.  Must
   --     call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(MLD : CMW.MLD.MLD_Object) 
      return CMW.SLabel.SLabel_Object;
       
   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given Shared_Memory.
   --     Must call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of
      (Shared_Memory : CMW.Shared_Memory.Shared_Memory_Object)
      return CMW.SLabel.SLabel_Object;
       
   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given Semaphore.
   --     Must call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(Semaphore : CMW.Semaphore.Semaphore_Object)
      return CMW.SLabel.SLabel_Object;
       
   --================================================================
   --  Function: SLabel_Of
   --  Description:
   --     Returns the Sensitivity Label for the given Message.  Must
   --     call SLabel.Destroy() to release storage space when
   --     Sensitivity Label is no longer needed.
   --================================================================
   function SLabel_Of(Message : CMW.Message.Message_Object) 
      return CMW.SLabel.SLabel_Object;
 
   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given Directory.  Must
   --     call ILabel.Destroy() to release storage space when
   --     Information Label is no longer needed.
   --================================================================
   function ILabel_Of(Directory : CMW.Directory.Directory_Object) 
      return CMW.ILabel.ILabel_Object;
       
   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given File.  Must call
   --     ILabel.Destroy() to release storage space when Information
   --     Label is no longer needed.
   --================================================================
   function ILabel_Of(File : CMW.File.File_Object) 
      return CMW.ILabel.ILabel_Object;

   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given Device.  Must
   --     call ILabel.Destroy() to release storage space when
   --     Information Label is no longer needed.
   --================================================================
   function ILabel_Of(Device : CMW.Device.Device_Object) 
      return CMW.ILabel.ILabel_Object;
      
   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given MLD.  Must call
   --     ILabel.Destroy() to release storage space when Information
   --     Label is no longer needed.
   --================================================================
   function ILabel_Of
      (MLD : CMW.MLD.MLD_Object) return CMW.ILabel.ILabel_Object;
     
   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given Shared Memory.
   --     Must call ILabel.Destroy() to release storage space when
   --     Information Label is no longer needed.
   --================================================================
   function ILabel_Of
      (Shared_Memory : CMW.Shared_Memory.Shared_Memory_Object)
      return CMW.ILabel.ILabel_Object;

   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given Semaphore.
   --     Must call ILabel.Destroy() to release storage space when
   --     Information Label is no longer needed.
   --================================================================
   function ILabel_Of(Semaphore : CMW.Semaphore.Semaphore_Object)
      return CMW.ILabel.ILabel_Object;
      
   --================================================================
   --  Function: ILabel_Of
   --  Description:
   --     Returns the Information Label of the given Message.  Must
   --     call ILabel.Destroy() to release storage space when 
   --     Information Label is no longer needed.
   --================================================================
   function ILabel_Of(Message : CMW.Message.Message_Object) 
      return CMW.ILabel.ILabel_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given Directory.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(Directory : CMW.Directory.Directory_Object) 
      return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given File.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(File : CMW.File.File_Object) 
      return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given Device.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(Device : CMW.Device.Device_Object) 
      return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given MLD.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(MLD : CMW.MLD.MLD_Object) return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given Shared_Memory.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of
      (Shared_Memory : CMW.Shared_Memory.Shared_Memory_Object)
       return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given Semaphore.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(Semaphore : CMW.Semaphore.Semaphore_Object) 
      return CMW.ACL.ACL_Object;
 
   --=============================================================
   --  Function: ACL_Of
   --  Description:
   --     Returns the Access Control List for the given Message.
   --     Must call ACL.Destroy() to release storage space when
   --     Access Control List is no longer needed.
   --============================================================= 
   function ACL_Of(Message : CMW.Message.Message_Object) 
      return CMW.ACL.ACL_Object;
 
  
   --=============================================================
   --  Function: Has_Privilege
   --  Description:
   --     Returns whether the given File has the given Privilege.
   --============================================================= 
   function Has_Privilege
      (File          : CMW.File.File_Object;
       Privilege_Set : Privilege.File_Privilege_Set;
       Privilege     : CMW.Privilege.Privilege_Vector_Object)
       return Boolean;
 
   --=============================================================
   --  Function: Has_Privilege
   --  Description:
   --     Returns whether the current process has the given Privilege.
   --============================================================= 
   function Has_Privilege
      (Privilege_Set : Privilege.Process_Privilege_Set;
       Privilege     : CMW.Privilege.Privilege_Vector_Object)
       return Boolean;
 
   --=============================================================
   --  Function: Get_Error_Code
   --  Description:
   --    Returns an error code which is set by the last routine
   --    call.  Since this error code is overridden by the next
   --    routine call, the user may want to save it for later use.
   --=============================================================
   function Get_Error_Code return Integer;
 
   --=============================================================
   --  Function: Length_Of
   --  Description:
   --    Returns the number of characters of the given string
   --    stripped of trailing blanks.
   --=============================================================
   function Length_Of(A_String : in String) return Natural;
 
   --=============================================================
   --  Function: Is_Allowed
   --  Description:
   --    Performs bit-wise comparison of 2 permissions.  Returns
   --    True if at each bit position, the Reference bit is 1 or
   --    the Check bit is 0.  Immediately returns False if any bit
   --    fails the above criteria.
   --=============================================================
   function Is_Allowed(Reference : Permissions;
                       Check     : Permissions) return Boolean;
        
end CMW;
