1 | #ifndef __ABAC_DEFINES_H__ |
---|
2 | #define __ABAC_DEFINES_H__ |
---|
3 | |
---|
4 | /* to enable the use of asprintf */ |
---|
5 | #ifndef _GNU_SOURCE |
---|
6 | #define _GNU_SOURCE |
---|
7 | #include <stdio.h> |
---|
8 | #endif /* _GNU_SOURCE */ |
---|
9 | |
---|
10 | struct _abac_chunk_t { |
---|
11 | unsigned char *ptr; |
---|
12 | int len; |
---|
13 | }; |
---|
14 | |
---|
15 | typedef struct _abac_pl_t abac_pl_t; |
---|
16 | |
---|
17 | typedef struct _abac_context_t abac_context_t; |
---|
18 | typedef struct _abac_chunk_t abac_chunk_t; |
---|
19 | |
---|
20 | typedef struct _abac_aspect_t abac_aspect_t; |
---|
21 | typedef struct _abac_attribute_t abac_attribute_t; |
---|
22 | typedef struct _abac_id_t abac_id_t; |
---|
23 | |
---|
24 | typedef struct _abac_condition_t abac_condition_t; |
---|
25 | typedef struct _abac_term_t abac_term_t; |
---|
26 | typedef struct _abac_item_t abac_item_t; |
---|
27 | typedef struct _abac_param_list_t abac_param_list_t; |
---|
28 | typedef struct _abac_key_t abac_key_t; |
---|
29 | |
---|
30 | typedef struct _abac_id_credential_t abac_id_credential_t; |
---|
31 | typedef struct _abac_credential_t abac_credential_t; |
---|
32 | |
---|
33 | #define USE(evalue) ((getenv(evalue)!=NULL)?1:0) |
---|
34 | |
---|
35 | /* for abac_pl_yy */ |
---|
36 | #define ABAC_YY_INVALID_HEAD -1 |
---|
37 | |
---|
38 | /* |
---|
39 | * Error codes for loading certificates. |
---|
40 | */ |
---|
41 | #define ABAC_CERT_SUCCESS 0 // certificate loaded, all is well |
---|
42 | #define ABAC_CERT_INVALID -1 // invalid format; also file not found |
---|
43 | #define ABAC_CERT_BAD_SIG -2 // invalid signature |
---|
44 | #define ABAC_CERT_MISSING_ISSUER -3 // missing ID cert that issued the attribute cert |
---|
45 | #define ABAC_CERT_BAD_CN -4 // ID cert is not matching CN=principal format |
---|
46 | #define ABAC_CERT_BAD_YAP -5 // failed to insert into prolog engine |
---|
47 | #define ABAC_CERT_EXISTS 1 // ID already exists (does not default to a failure) |
---|
48 | |
---|
49 | #define ABAC_ID_SUCCESS 0 |
---|
50 | #define ABAC_ID_GENERATE_INVALID_CN -1 |
---|
51 | #define ABAC_ID_GENERATE_INVALID_VALIDITY -2 |
---|
52 | |
---|
53 | #define ABAC_ATTRIBUTE_SUCCESS 0 |
---|
54 | #define ABAC_ATTRIBUTE_INVALID_ROLE -1 |
---|
55 | #define ABAC_ATTRIBUTE_INVALID_VALIDITY -2 |
---|
56 | #define ABAC_ATTRIBUTE_ISSUER_NOKEY -3 |
---|
57 | #define ABAC_ATTRIBUTE_FAIL -4 |
---|
58 | |
---|
59 | #define ABAC_TERM_SUCCESS 0 |
---|
60 | #define ABAC_TERM_FAIL -1 |
---|
61 | |
---|
62 | #define ABAC_VERIFIER_UNKNOWN_CONTEXT -1 |
---|
63 | |
---|
64 | |
---|
65 | typedef enum _itemtype_t { |
---|
66 | e_ITEM_MIN = 1, |
---|
67 | e_ITEM_MAX = 2, |
---|
68 | e_ITEM_TARGET = 3 |
---|
69 | } abac_itemtype_t; |
---|
70 | |
---|
71 | typedef enum _termtype { |
---|
72 | e_TERM_INTEGER = 1, |
---|
73 | e_TERM_URN = 2, |
---|
74 | e_TERM_FLOAT = 3, |
---|
75 | e_TERM_BOOLEAN = 4, |
---|
76 | e_TERM_STRING = 5, |
---|
77 | e_TERM_TIME = 6, |
---|
78 | e_TERM_PRINCIPAL = 7, |
---|
79 | e_TERM_ANONYMOUS = 8, |
---|
80 | e_TERM_THIS = 9 |
---|
81 | } abac_termtype_t; |
---|
82 | |
---|
83 | typedef enum _idtype_t { |
---|
84 | e_KEYID = 1, |
---|
85 | } abac_idtype_t; |
---|
86 | |
---|
87 | typedef enum _aspecttype_t { |
---|
88 | e_ASPECTTYPE_NULL = 0, |
---|
89 | e_ASPECTTYPE_ROLE = 1, |
---|
90 | e_ASPECTTYPE_OSET = 2, |
---|
91 | e_ASPECTTYPE_INTERSECTING = 3 |
---|
92 | } abac_aspecttype_t; |
---|
93 | |
---|
94 | #endif /* __ABAC_DEFINES_H__ */ |
---|