Tizen 2.0 Release
[framework/base/acl.git] / setfacl / sequence.h
1 /*
2   File: sequence.h
3   (Linux Access Control List Management)
4
5   Copyright (C) 1999 by Andreas Gruenbacher
6   <a.gruenbacher@computer.org>
7         
8   This program is free software; you can redistribute it and/or
9   modify it under the terms of the GNU Lesser General Public
10   License as published by the Free Software Foundation; either
11   version 2.1 of the License, or (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public
19   License along with this library; if not, write to the Free Software
20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23
24 #ifndef __SEQUENCE_H
25 #define __SEQUENCE_H
26
27
28 #include <sys/acl.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35
36 typedef unsigned int cmd_tag_t;
37
38 struct cmd_obj {
39         cmd_tag_t               c_cmd;
40         acl_type_t              c_type;
41         acl_tag_t               c_tag;
42         uid_t                   c_id;
43         mode_t                  c_perm;
44         struct cmd_obj          *c_next;
45 };
46
47 typedef struct cmd_obj *cmd_t;
48
49 struct seq_obj {
50         cmd_t                   s_first;
51         cmd_t                   s_last;
52 };
53
54 typedef struct seq_obj *seq_t;
55
56 /* command types */
57 #define CMD_ENTRY_REPLACE       (0)
58 #define CMD_REMOVE_ENTRY        (3)
59 #define CMD_REMOVE_EXTENDED_ACL (4)
60 #define CMD_REMOVE_ACL          (5)
61
62 /* constants for permission specifiers */
63 #define CMD_PERM_READ           (4)
64 #define CMD_PERM_WRITE          (2)
65 #define CMD_PERM_EXECUTE        (1)
66 #define CMD_PERM_COND_EXECUTE   (8)
67
68 /* iteration over command sequence */
69 #define SEQ_FIRST_CMD           (0)
70 #define SEQ_NEXT_CMD            (1)
71
72 /* command sequence manipulation */
73
74 cmd_t
75 cmd_init(
76         void);
77 void
78 cmd_free(
79         cmd_t cmd);
80 seq_t
81 seq_init(
82         void);
83 int
84 seq_free(
85         seq_t seq);
86 int
87 seq_empty(
88         seq_t seq);
89 int
90 seq_append(
91         seq_t seq,
92         cmd_t cmd);
93 int
94 seq_append_cmd(
95         seq_t seq,
96         cmd_tag_t cmd,
97         acl_type_t type);
98 int
99 seq_get_cmd(
100         seq_t seq,
101         int which,
102         cmd_t *cmd);
103 int
104 seq_delete_cmd(
105         seq_t seq,
106         cmd_t cmd);
107
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113
114 #endif  /* __SEQUENCE_H */
115