bozo: Introduce bnode_Wait()
[openafs.git] / src / libacl / acl.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11         Information Technology Center
12         Carnegie-Mellon University
13 */
14
15 #ifndef _ACL_
16 #define _ACL_
17
18
19 #include "afs/ptint.h"
20
21 #define ACL_VERSION "Version 1"
22
23 struct acl_accessEntry {
24     int id;                     /*internally-used ID of user or group */
25     int rights;                 /*mask */
26 };
27
28 /*
29 The above access list entry format is used in VICE
30 */
31
32
33 #define ACL_ACLVERSION  1       /*Identifies current format of access lists */
34
35 struct acl_accessList {
36     int size;                   /*size of this access list in bytes, including MySize itself */
37     int version;                /*to deal with upward compatibility ; <= ACL_ACLVERSION */
38     int total;
39     int positive;               /* number of positive entries */
40     int negative;               /* number of minus entries */
41     struct acl_accessEntry entries[1];  /* negative entries are stored backwards from end */
42 };
43
44 /*
45 Used in VICE. This is how acccess lists are stored on secondary storage.
46 */
47
48
49 #define ACL_MAXENTRIES  20
50
51 /*
52  * External access lists are just char *'s, with the following format:
53  *
54  * Begins with a decimal integer in format "%d\n%d\n" specifying the
55  * number of positive entries and negative entries that follow.  This is
56  * followed by the list of entries.  Each entry consists of a username or
57  * groupname followed by a decimal number representing the rights mask for
58  * that name.  Each entry in the list looks as if it had been produced by
59  * printf() using a format list of "%s\t%d\n".
60  *
61  * Note that the number of entries must be less than or equal to ACL_MAXENTRIES
62  */
63
64 /* This is temporary hack to get around changing the volume package for now */
65
66 typedef struct acl_accessList AL_AccessList;
67
68 extern int acl_NewACL(int nEntries, struct acl_accessList **acl);
69 extern int acl_FreeACL(struct acl_accessList **acl);
70 extern int acl_NewExternalACL(int nEntries, char **r);
71 extern int acl_FreeExternalACL(char **r);
72 extern int acl_Externalize(struct acl_accessList *acl, char **elist);
73 extern int acl_Internalize(char *elist, struct acl_accessList **acl);
74 extern int acl_Externalize_pr(int (*func)(idlist *ids, namelist *names), struct acl_accessList *acl, char **elist);
75 extern int acl_Internalize_pr(int (*func)(namelist *names, idlist *ids), char *elist, struct acl_accessList **acl);
76 extern int acl_Initialize(char *version);
77 #ifdef  _RXGEN_PTINT_
78 extern int acl_CheckRights(struct acl_accessList *acl, prlist *groups, int *rights);
79 extern int acl_IsAMember(afs_int32 aid, prlist *cps);
80 #endif
81
82 extern int acl_HtonACL(struct acl_accessList *);
83 extern int acl_NtohACL(struct acl_accessList *);
84
85 #endif