diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2018-09-10 12:00:18 +0200 |
---|---|---|
committer | Jose Bollo <jose.bollo@iot.bzh> | 2018-09-10 12:00:18 +0200 |
commit | 11654afcb5753a54a033db12e1ed4a19b3f7c86e (patch) | |
tree | 0d493c80584392eec2c5dc0f1c1c68c9057cf043 /src/cyn.h |
Initial commit
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/cyn.h')
-rw-r--r-- | src/cyn.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/cyn.h b/src/cyn.h new file mode 100644 index 0000000..0a061c2 --- /dev/null +++ b/src/cyn.h @@ -0,0 +1,113 @@ + +#pragma once + +#define DENY 0 +#define ALLOW 1 +#define ASK 2 +#define DEFAULT DENY + +extern +int +cyn_init( +); + +/** enter critical recoverable section */ +extern +int +cyn_enter( + const void *magic +); + +/** leave critical recoverable section */ +extern +int +cyn_leave( + const void *magic, + bool commit +); + +extern +int +cyn_set( + const char *client, + const char *session, + const char *user, + const char *permission, + uint32_t value +); + +extern +int +cyn_drop( + const char *client, + const char *session, + const char *user, + const char *permission +); + +extern +int +cyn_test( + const char *client, + const char *session, + const char *user, + const char *permission, + uint32_t *value +); + +extern +void +cyn_list( + void *closure, + void (*callback)( + void *closure, + const char *client, + const char *session, + const char *user, + const char *permission, + uint32_t value), + const char *client, + const char *session, + const char *user, + const char *permission +); + +extern +int +cyn_check_async( + void (*check_cb)(void *closure, uint32_t value), + void *closure, + const char *client, + const char *session, + const char *user, + const char *permission +); + +extern +int +cyn_enter_async( + void (*enter_cb)(void *closure), + void *closure +); + +extern +int +cyn_enter_async_cancel( + void (*enter_cb)(void *closure), + void *closure +); + +extern +int +cyn_on_change_add( + void (*on_change_cb)(void *closure), + void *closure +); + +extern +int +cyn_on_change_remove( + void (*on_change_cb)(void *closure), + void *closure +); + |