36 #ifndef ARPA2_ACCESS_H
37 #define ARPA2_ACCESS_H
43 #include "arpa2/identity.h"
44 #include "arpa2/rules.h"
173 #define ACCESS_RIGHT(c) ( 1 << (c - 'A') )
237 #define ACCESS_ADMIN ACCESS_RIGHT('A')
238 #define ACCESS_SERVICE ACCESS_RIGHT('S')
239 #define ACCESS_CONFIG ACCESS_RIGHT('F')
240 #define ACCESS_OPERATE ACCESS_RIGHT('T')
241 #define ACCESS_DELETE ACCESS_RIGHT('D')
242 #define ACCESS_CREATE ACCESS_RIGHT('C')
243 #define ACCESS_EXECUTE ACCESS_RIGHT('X')
244 #define ACCESS_WRITE ACCESS_RIGHT('W')
245 #define ACCESS_READ ACCESS_RIGHT('R')
246 #define ACCESS_PROVE ACCESS_RIGHT('P')
247 #define ACCESS_KNOW ACCESS_RIGHT('K')
248 #define ACCESS_OWNER ACCESS_RIGHT('O')
249 #define ACCESS_VISITOR ACCESS_RIGHT('V')
251 #define ACCESS_FORBIDDEN 0
257 #define ACCESS_ADMIN_UP ( ACCESS_ADMIN | 0 )
258 #define ACCESS_SERVICE_UP ( ACCESS_SERVICE | ACCESS_ADMIN_UP )
259 #define ACCESS_CONFIG_UP ( ACCESS_CONFIG | ACCESS_SERVICE_UP )
260 #define ACCESS_OPERATE_UP ( ACCESS_OPERATE | ACCESS_CONFIG_UP )
261 #define ACCESS_DELETE_UP ( ACCESS_DELETE | ACCESS_OPERATE_UP )
262 #define ACCESS_CREATE_UP ( ACCESS_CREATE | ACCESS_DELETE_UP )
263 #define ACCESS_EXECUTE_UP ( ACCESS_EXECUTE | ACCESS_CREATE_UP )
264 #define ACCESS_WRITE_UP ( ACCESS_WRITE | ACCESS_EXECUTE_UP )
265 #define ACCESS_READ_UP ( ACCESS_READ | ACCESS_WRITE_UP )
266 #define ACCESS_PROVE_UP ( ACCESS_PROVE | ACCESS_READ_UP )
267 #define ACCESS_KNOW_UP ( ACCESS_KNOW | ACCESS_PROVE_UP )
268 #define ACCESS_OWNER_UP ( ACCESS_OWNER | ACCESS_KNOW_UP )
269 #define ACCESS_VISITOR_UP ( ACCESS_VISITOR | ACCESS_OWNER_UP )
275 #define ACCESS_ADMIN_DOWN ( ACCESS_ADMIN | ACCESS_SERVICE_DOWN )
276 #define ACCESS_SERVICE_DOWN ( ACCESS_SERVICE | ACCESS_CONFIG_DOWN )
277 #define ACCESS_CONFIG_DOWN ( ACCESS_CONFIG | ACCESS_OPERATE_DOWN )
278 #define ACCESS_OPERATE_DOWN ( ACCESS_OPERATE | ACCESS_DELETE_DOWN )
279 #define ACCESS_DELETE_DOWN ( ACCESS_DELETE | ACCESS_CREATE_DOWN )
280 #define ACCESS_CREATE_DOWN ( ACCESS_CREATE | ACCESS_EXECUTE_DOWN )
281 #define ACCESS_EXECUTE_DOWN ( ACCESS_EXECUTE | ACCESS_WRITE_DOWN )
282 #define ACCESS_WRITE_DOWN ( ACCESS_WRITE | ACCESS_READ_DOWN )
283 #define ACCESS_READ_DOWN ( ACCESS_READ | ACCESS_PROVE_DOWN )
284 #define ACCESS_PROVE_DOWN ( ACCESS_PROVE | ACCESS_KNOW_DOWN )
285 #define ACCESS_KNOW_DOWN ( ACCESS_KNOW | ACCESS_OWNER_DOWN )
286 #define ACCESS_OWNER_DOWN ( ACCESS_OWNER | ACCESS_VISITOR_DOWN )
287 #define ACCESS_VISITOR_DOWN ( ACCESS_VISITOR | 0 )
void access_format(const char *opt_fmtstr, access_rights rights, char *outstr)
Format Access Rights flags to a string.
const char * access_host2domain(const char *fqdn_hostname)
Lookup the realm for a fully qualified host name.
static void access_init(void)
Initialise the ARPA2 Access system.
Definition: access.h:358
static void access_fini(void)
Finalise the ARPA2 Access system.
Definition: access.h:367
bool access_parse(char *userstr, access_rights *accumulator)
Parse a string of Access Rights flags.
rules_flags access_rights
Access Rights in a bit mask.
Definition: access.h:162
rules_name access_name
Access Names represent instances of an Access Type.
Definition: access.h:151
rules_type access_type
Access Types are 128-bit "well-known service identities".
Definition: access.h:123
rules_domain access_domain
Access Domains are UTF-8 representations of a Fully Qualified Domain Name.
Definition: access.h:88
void rules_init(void)
Initialise the ARPA2 Rules system.
void rules_fini(void)
Finalise the ARPA2 Rules system.
uint32_t rules_flags
Flags in a bit mask.
Definition: rules.h:214
char * rules_domain
Rules Domains are UTF-8 representations of a Fully Qualified Domain Name.
Definition: rules.h:99
uint8_t rules_type[16]
Rules Types are 128-bit "well-known service identities".
Definition: rules.h:134
char * rules_name
Rules Names represent instances of a Rules Type.
Definition: rules.h:167