(root)/
acl-2.3.1/
include/
acl.h
       1  /*
       2    File: sys/acl.h
       3  
       4    (C) 1999 Andreas Gruenbacher, <a.gruenbacher@computer.org>
       5  
       6    This program is free software; you can redistribute it and/or
       7    modify it under the terms of the GNU Lesser General Public
       8    License as published by the Free Software Foundation; either
       9    version 2.1 of the License, or (at your option) any later version.
      10  
      11    This program is distributed in the hope that it will be useful,
      12    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   the GNU
      14    Lesser General Public License for more details.
      15  
      16    You should have received a copy of the GNU Lesser General Public
      17    License along with this library; if not, write to the Free Software
      18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
      19  */
      20  
      21  #ifndef __SYS_ACL_H
      22  #define __SYS_ACL_H
      23  
      24  #include <sys/types.h>
      25  
      26  #ifdef __cplusplus
      27  extern "C" {
      28  #endif
      29  
      30  /*=== Data types ===*/
      31  
      32  struct __acl_ext;
      33  struct __acl_entry_ext;
      34  struct __acl_permset_ext;
      35  
      36  typedef unsigned int		acl_type_t;
      37  typedef int			acl_tag_t;
      38  typedef unsigned int		acl_perm_t;
      39  
      40  typedef struct __acl_ext	*acl_t;
      41  typedef struct __acl_entry_ext	*acl_entry_t;
      42  typedef struct __acl_permset_ext *acl_permset_t;
      43  
      44  /*=== Constants ===*/
      45  
      46  /* 23.2.2 acl_perm_t values */
      47  
      48  #define ACL_READ		(0x04)
      49  #define ACL_WRITE		(0x02)
      50  #define ACL_EXECUTE		(0x01)
      51  
      52  /* 23.2.5 acl_tag_t values */
      53  
      54  #define ACL_UNDEFINED_TAG	(0x00)
      55  #define ACL_USER_OBJ		(0x01)
      56  #define ACL_USER		(0x02)
      57  #define ACL_GROUP_OBJ		(0x04)
      58  #define ACL_GROUP		(0x08)
      59  #define ACL_MASK		(0x10)
      60  #define ACL_OTHER		(0x20)
      61  
      62  /* 23.3.6 acl_type_t values */
      63  
      64  #define ACL_TYPE_ACCESS		(0x8000)
      65  #define ACL_TYPE_DEFAULT	(0x4000)
      66  
      67  /* 23.2.7 ACL qualifier constants */
      68  
      69  #define ACL_UNDEFINED_ID	((id_t)-1)
      70  
      71  /* 23.2.8 ACL Entry Constants */
      72  
      73  #define ACL_FIRST_ENTRY		0
      74  #define ACL_NEXT_ENTRY		1
      75  
      76  /*=== ACL manipulation ===*/
      77  
      78  EXPORT acl_t acl_init(int count);
      79  EXPORT acl_t acl_dup(acl_t acl);
      80  EXPORT int acl_free(void *obj_p);
      81  EXPORT int acl_valid(acl_t acl);
      82  
      83  /*=== Entry manipulation ===*/
      84  
      85  EXPORT int
      86  acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d);
      87  EXPORT int acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p);
      88  EXPORT int acl_delete_entry(acl_t acl, acl_entry_t entry_d);
      89  EXPORT int acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p);
      90  
      91  /* Manipulate ACL entry permissions */
      92  
      93  EXPORT int acl_add_perm(acl_permset_t permset_d, acl_perm_t perm);
      94  EXPORT int acl_calc_mask(acl_t *acl_p);
      95  EXPORT int acl_clear_perms(acl_permset_t permset_d);
      96  EXPORT int acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm);
      97  EXPORT int acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p);
      98  EXPORT int acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d);
      99  
     100  /* Manipulate ACL entry tag type and qualifier */
     101  
     102  EXPORT void * acl_get_qualifier(acl_entry_t entry_d);
     103  EXPORT int acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p);
     104  EXPORT int acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p);
     105  EXPORT int acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type);
     106  
     107  /*=== Format translation ===*/
     108  
     109  EXPORT ssize_t acl_copy_ext(void *buf_p, acl_t acl, ssize_t size);
     110  EXPORT acl_t acl_copy_int(const void *buf_p);
     111  EXPORT acl_t acl_from_text(const char *buf_p);
     112  EXPORT ssize_t acl_size(acl_t acl);
     113  EXPORT char *acl_to_text(acl_t acl, ssize_t *len_p);
     114  
     115  /*=== Object manipulation ===*/
     116  
     117  EXPORT int acl_delete_def_file(const char *path_p);
     118  EXPORT acl_t acl_get_fd(int fd);
     119  EXPORT acl_t acl_get_file(const char *path_p, acl_type_t type);
     120  EXPORT int acl_set_fd(int fd, acl_t acl);
     121  EXPORT int acl_set_file(const char *path_p, acl_type_t type, acl_t acl);
     122  
     123  #ifdef __cplusplus
     124  }
     125  #endif
     126  
     127  #endif  /* __SYS_ACL_H */
     128