#ifndef __ABAC_DEFINES_H__ #define __ABAC_DEFINES_H__ /* to enable the use of asprintf */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #include #endif /* _GNU_SOURCE */ struct _abac_chunk_t { unsigned char *ptr; int len; }; typedef struct _abac_pl_t abac_pl_t; typedef struct _abac_context_t abac_context_t; typedef struct _abac_chunk_t abac_chunk_t; typedef struct _abac_aspect_t abac_aspect_t; typedef struct _abac_attribute_t abac_attribute_t; typedef struct _abac_id_t abac_id_t; typedef struct _abac_condition_t abac_condition_t; typedef struct _abac_term_t abac_term_t; typedef struct _abac_item_t abac_item_t; typedef struct _abac_param_list_t abac_param_list_t; typedef struct _abac_key_t abac_key_t; typedef struct _abac_id_credential_t abac_id_credential_t; typedef struct _abac_credential_t abac_credential_t; #define USE(evalue) ((getenv(evalue)!=NULL)?1:0) /* for abac_pl_yy */ #define ABAC_YY_INVALID_HEAD -1 /* * Error codes for loading certificates. */ #define ABAC_CERT_SUCCESS 0 // certificate loaded, all is well #define ABAC_CERT_INVALID -1 // invalid format; also file not found #define ABAC_CERT_BAD_SIG -2 // invalid signature #define ABAC_CERT_MISSING_ISSUER -3 // missing ID cert that issued the attribute cert #define ABAC_CERT_BAD_CN -4 // ID cert is not matching CN=principal format #define ABAC_CERT_BAD_YAP -5 // failed to insert into prolog engine #define ABAC_CERT_EXISTS 1 // ID already exists (does not default to a failure) #define ABAC_ID_SUCCESS 0 #define ABAC_ID_GENERATE_INVALID_CN -1 #define ABAC_ID_GENERATE_INVALID_VALIDITY -2 #define ABAC_ATTRIBUTE_SUCCESS 0 #define ABAC_ATTRIBUTE_INVALID_ROLE -1 #define ABAC_ATTRIBUTE_INVALID_VALIDITY -2 #define ABAC_ATTRIBUTE_ISSUER_NOKEY -3 #define ABAC_ATTRIBUTE_FAIL -4 #define ABAC_TERM_SUCCESS 0 #define ABAC_TERM_FAIL -1 #define ABAC_VERIFIER_UNKNOWN_CONTEXT -1 typedef enum _itemtype_t { e_ITEM_MIN = 1, e_ITEM_MAX = 2, e_ITEM_TARGET = 3 } abac_itemtype_t; typedef enum _termtype { e_TERM_INTEGER = 1, e_TERM_URN = 2, e_TERM_FLOAT = 3, e_TERM_BOOLEAN = 4, e_TERM_STRING = 5, e_TERM_TIME = 6, e_TERM_PRINCIPAL = 7, e_TERM_ANONYMOUS = 8, e_TERM_THIS = 9 } abac_termtype_t; typedef enum _idtype_t { e_KEYID = 1, } abac_idtype_t; typedef enum _aspecttype_t { e_ASPECTTYPE_NULL = 0, e_ASPECTTYPE_ROLE = 1, e_ASPECTTYPE_OSET = 2, e_ASPECTTYPE_INTERSECTING = 3 } abac_aspecttype_t; #endif /* __ABAC_DEFINES_H__ */