source:
libabac/abac.c
@
e10abf8
Last change on this file since e10abf8 was 2e9455f, checked in by , 12 years ago | |
---|---|
|
|
File size: 1.1 KB |
Rev | Line | |
---|---|---|
[2e9455f] | 1 | /** |
2 | ** abac.c | |
3 | ** original abac.c using prolog | |
4 | **/ | |
[8bd77b5] | 5 | |
6 | #include <assert.h> | |
7 | #include <err.h> | |
8 | #include <glob.h> | |
9 | ||
10 | #include <chunk.h> | |
11 | ||
12 | #include "abac_util.h" | |
13 | #include "abac_verifier.h" | |
14 | ||
15 | static int debug=0; | |
16 | ||
[2e9455f] | 17 | /**************************************************************************/ |
[8bd77b5] | 18 | /** |
19 | * Init the library. | |
20 | */ | |
21 | void libabac_init(void) { | |
[97a6a36] | 22 | |
[2e9455f] | 23 | DEBUG_PRINTF("libabac_init, calling init\n"); |
[8bd77b5] | 24 | void libabac_deinit(void); |
25 | static int has_been_init = 0; | |
26 | ||
[2e9455f] | 27 | // called every time a verifier session is created, so only do it once |
[8bd77b5] | 28 | if (!has_been_init) { |
29 | abac_verifier_init(); | |
30 | atexit(libabac_deinit); | |
31 | has_been_init = 1; | |
[b8a6fd2a] | 32 | } else { |
[2e9455f] | 33 | DEBUG_PRINTF("libabac_init, can only be called once\n"); |
[8bd77b5] | 34 | } |
35 | } | |
36 | ||
37 | /** | |
38 | * Deinit the library. | |
39 | */ | |
40 | void libabac_deinit(void) { | |
[2e9455f] | 41 | static int has_been_deinit = 0; |
42 | DEBUG_PRINTF("libabac_deinit, calling take down (%d)\n", has_been_deinit); | |
[e3c7769] | 43 | if(!has_been_deinit) { |
44 | abac_verifier_deinit(); | |
45 | has_been_deinit = 1; | |
46 | } else { | |
[2e9455f] | 47 | DEBUG_PRINTF("libabac_deinit, can only be called once\n"); |
[5110d42] | 48 | } |
[d037f54] | 49 | } |
[2efdff5] | 50 |
Note: See TracBrowser
for help on using the repository browser.