/*------------------------------------------------------------------------
** 
** PROLOG
**
** COMPONENT NAME:  ent.access
**
** FILE ID:  dce/aclmanager/apply.idl
**
** ORIGINS:  This code is new function for DSS.  It is IBM Original code.
**
** (C) COPYRIGHT International Business Machines Corp. 1996
** All Rights Reserved
** Licensed Material - Property of IBM
**
** US Government User Restricted Rights - Use, duplication or disclosure 
** restricted by GSA ADP Schedule Contract with IBM Corp.
**
** END PROLOG
**
**------------------------------------------------------------------------
**
** CHANGE HISTORY
**
** MARK  DEF/FEA  YYMMMDD RELEASE  WHO  DESCRIPTION
** -----------------------------------------------------------------------
**       D27529   95Dec01 ls.r40ep JMR  Initial code drop.
**
** END HISTORY
**
**------------------------------------------------------------------------
*/
[
    uuid(572f5d00-c761-11ce-8b50-10005a7b953d),
    version(1.0)
]
interface apply
{
   import  "dce/aclbase.idl";
   import  "dce/utctypes.idl";

/*------------------------------------------------------------------------
**
** #define's
**
**------------------------------------------------------------------------
*/
   /*
   ** Tolerance values for DSS_AccessDenied errors.
   */
   const unsigned32 APPLY_TOLERANCE_LOW  = 0;
   const unsigned32 APPLY_TOLERANCE_MED  = 1;
   const unsigned32 APPLY_TOLERANCE_HIGH = 2;

   /* 
   ** acl manipulate actions
   */
   const unsigned32 ENTRY_RENAME_USER          = 1;
   const unsigned32 ENTRY_RENAME_GROUP         = 2;
   const unsigned32 ENTRY_CREATE               = 3;
   const unsigned32 ENTRY_DELETE               = 4;
   const unsigned32 ENTRY_MODIFY_ADD           = 5;
   const unsigned32 ENTRY_MODIFY_ADD_OR_CREATE = 6;
   const unsigned32 ENTRY_MODIFY_DELETE        = 7;
   const unsigned32 ENTRY_REPLACE              = 8;
   const unsigned32 ENTRY_REPLACE_OR_CREATE    = 9;


/*------------------------------------------------------------------------
**
** typedef's
**
**------------------------------------------------------------------------
*/
   typedef [switch_type(boolean)] union
   {
      [case (TRUE)]  sec_id_t         local;
      [case (FALSE)] sec_id_foreign_t foreign;
   } id_union_t;

   typedef struct id_to_replace_t
   {
      boolean fOldIsLocal;
      [switch_is(fOldIsLocal)] id_union_t old_id;

      boolean fNewIsLocal;
      [switch_is(fNewIsLocal)] id_union_t new_id;
   } id_to_replace_t;

   typedef [switch_type(unsigned32)] union
   {
      [case (ENTRY_RENAME_USER)]  id_to_replace_t user;
      [case (ENTRY_RENAME_GROUP)] id_to_replace_t group;
      [default]                   sec_acl_entry_t sec_acl;
   } target_t;

   typedef struct ent_entry_to_manipulate_t
   {
      unsigned32 action;
      [switch_is(action)] target_t target;
   } ent_entry_to_manipulate_t;

   typedef [ptr] ent_entry_to_manipulate_t *ent_entry_to_manipulate_p_t;

   typedef struct ent_entries_to_manipulate_t
   {
      unsigned32 num_entries_to_change;
      [size_is(num_entries_to_change)] 
                 ent_entry_to_manipulate_t entries_to_change_list[];
   } ent_entries_to_manipulate_t;

   typedef struct error_entry_t
   {
      [string,ptr] char  *resource_name;
      error_status_t  error_code;
   } error_entry_t;

   typedef struct dssacl_objdata_t
   {
      uuid_t     owner_id;
      uuid_t     group_id;
      unsigned32 ref_count;
      utc_t      created;
      utc_t      modified;
      unsigned32 modified_count;
   } dssacl_objdata_t;


/*------------------------------------------------------------------------
**
** RPC's
**
**------------------------------------------------------------------------
*/
   void ent_acl_replace_apply(
      [ in]       handle_t        handle,
      [string,in] unsigned char  *resource_name,
      [ in]       sec_acl_type_t  sec_acl_type,
      [ in]       sec_acl_list_t *acl_to_apply,
      [ in]       unsigned32      tolerance,
      [ in]       unsigned32      recursion,
      [ in]       unsigned32      max_errors,
      [out,size_is(max_errors)] 
                  error_entry_t   error_buffer[],
      [out]       unsigned32     *num_errors,
      [out]       error_status_t *status);


   void ent_acl_manipulate_apply(
      [ in]       handle_t                     handle,
      [string,in] unsigned char               *resource_name,
      [ in]       sec_acl_type_t               sec_acl_type,
      [ in]       ent_entries_to_manipulate_t *entries_to_change,
      [ in]       unsigned32                   tolerance,
      [ in]       unsigned32                   recursion,
      [ in]       unsigned32                   max_errors,
      [out,size_is(max_errors)] 
                  error_entry_t                error_buffer[],
      [out]       unsigned32                  *num_errors,
      [out]       error_status_t              *status);


   void net_access_apply(
      [ in]       handle_t                     handle,
      [string,in] unsigned char               *resource_name,
      [out]       error_entry_t                error_buffer[1],
      [out]       error_status_t              *status);


   void aclimp_replace_acl(
      [ in]       handle_t        handle,
      [string,in] unsigned char  *pszPath,
      [ in]       sec_acl_list_t *obj_acl,
      [ in,ptr]   sec_acl_list_t *io_acl,
      [ in,ptr]   sec_acl_list_t *ic_acl,
      [out]       error_status_t *pStatus);


   void dss_get_acl_objdata(
      [in]        handle_t          handle,
      [string,in] unsigned char    *pszPath,
      [out]       dssacl_objdata_t *pACLData,
      [out]       error_status_t   *pStatus);
}
