diff options
Diffstat (limited to 'ot_accesslist.h')
-rw-r--r-- | ot_accesslist.h | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/ot_accesslist.h b/ot_accesslist.h index a988791..0a7488e 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h | |||
@@ -6,16 +6,18 @@ | |||
6 | #ifndef OT_ACCESSLIST_H__ | 6 | #ifndef OT_ACCESSLIST_H__ |
7 | #define OT_ACCESSLIST_H__ | 7 | #define OT_ACCESSLIST_H__ |
8 | 8 | ||
9 | #if defined ( WANT_ACCESSLIST_BLACK ) && defined ( WANT_ACCESSLIST_WHITE ) | 9 | #include "trackerlogic.h" |
10 | # error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive. | 10 | |
11 | #if defined(WANT_ACCESSLIST_BLACK) && defined(WANT_ACCESSLIST_WHITE) | ||
12 | #error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive. | ||
11 | #endif | 13 | #endif |
12 | 14 | ||
13 | #if defined ( WANT_ACCESSLIST_BLACK ) || defined (WANT_ACCESSLIST_WHITE ) | 15 | #if defined(WANT_ACCESSLIST_BLACK) || defined(WANT_ACCESSLIST_WHITE) |
14 | #define WANT_ACCESSLIST | 16 | #define WANT_ACCESSLIST |
15 | void accesslist_init( void ); | 17 | void accesslist_init(void); |
16 | void accesslist_deinit( void ); | 18 | void accesslist_deinit(void); |
17 | int accesslist_hashisvalid( ot_hash hash ); | 19 | int accesslist_hashisvalid(ot_hash hash); |
18 | void accesslist_cleanup( void ); | 20 | void accesslist_cleanup(void); |
19 | 21 | ||
20 | extern char *g_accesslist_filename; | 22 | extern char *g_accesslist_filename; |
21 | #ifdef WANT_DYNAMIC_ACCESSLIST | 23 | #ifdef WANT_DYNAMIC_ACCESSLIST |
@@ -25,16 +27,16 @@ extern char *g_accesslist_pipe_delete; | |||
25 | 27 | ||
26 | #else | 28 | #else |
27 | #ifdef WANT_DYNAMIC_ACCESSLIST | 29 | #ifdef WANT_DYNAMIC_ACCESSLIST |
28 | # error WANT_DYNAMIC_ACCESSLIST needs either WANT_ACCESSLIST_BLACK or WANT_ACCESSLIST_WHITE | 30 | #error WANT_DYNAMIC_ACCESSLIST needs either WANT_ACCESSLIST_BLACK or WANT_ACCESSLIST_WHITE |
29 | #endif | 31 | #endif |
30 | 32 | ||
31 | #define accesslist_init( accesslist_filename ) | 33 | #define accesslist_init(accesslist_filename) |
32 | #define accesslist_deinit( ) | 34 | #define accesslist_deinit() |
33 | #define accesslist_hashisvalid( hash ) 1 | 35 | #define accesslist_hashisvalid(hash) 1 |
34 | #endif | 36 | #endif |
35 | 37 | ||
36 | /* Test if an address is subset of an ot_net, return value is considered a bool */ | 38 | /* Test if an address is subset of an ot_net, return value is considered a bool */ |
37 | int address_in_net( const ot_ip6 address, const ot_net *net ); | 39 | int address_in_net(const ot_ip6 address, const ot_net *net); |
38 | 40 | ||
39 | /* Store a value into a vector of struct { ot_net net, uint8_t[x] value } member; | 41 | /* Store a value into a vector of struct { ot_net net, uint8_t[x] value } member; |
40 | returns NULL | 42 | returns NULL |
@@ -45,18 +47,17 @@ int address_in_net( const ot_ip6 address, const ot_net *net ); | |||
45 | returns pointer to new member in vector for success | 47 | returns pointer to new member in vector for success |
46 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping | 48 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping |
47 | */ | 49 | */ |
48 | void *set_value_for_net( const ot_net *net, ot_vector *vector, const void *value, const size_t member_size ); | 50 | void *set_value_for_net(const ot_net *net, ot_vector *vector, const void *value, const size_t member_size); |
49 | 51 | ||
50 | /* Takes a vector filled with struct { ot_net net, uint8_t[x] value } member; | 52 | /* Takes a vector filled with struct { ot_net net, uint8_t[x] value } member; |
51 | Returns pointer to _member_ associated with the net, or NULL if not found | 53 | Returns pointer to _member_ associated with the net, or NULL if not found |
52 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping | 54 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping |
53 | */ | 55 | */ |
54 | void *get_value_for_net( const ot_ip6 address, const ot_vector *vector, const size_t member_size ); | 56 | void *get_value_for_net(const ot_ip6 address, const ot_vector *vector, const size_t member_size); |
55 | |||
56 | 57 | ||
57 | #ifdef WANT_IP_FROM_PROXY | 58 | #ifdef WANT_IP_FROM_PROXY |
58 | int proxylist_add_network( const ot_net *proxy, const ot_net *net ); | 59 | int proxylist_add_network(const ot_net *proxy, const ot_net *net); |
59 | int proxylist_check_network( const ot_ip6 *proxy, const ot_ip6 address /* can be NULL to only check proxy */ ); | 60 | int proxylist_check_network(const ot_ip6 *proxy, const ot_ip6 address /* can be NULL to only check proxy */); |
60 | #endif | 61 | #endif |
61 | 62 | ||
62 | #ifdef WANT_FULLLOG_NETWORKS | 63 | #ifdef WANT_FULLLOG_NETWORKS |
@@ -70,10 +71,10 @@ struct ot_log { | |||
70 | }; | 71 | }; |
71 | extern ot_log *g_logchain_first, *g_logchain_last; | 72 | extern ot_log *g_logchain_first, *g_logchain_last; |
72 | 73 | ||
73 | void loglist_add_network( const ot_net *net ); | 74 | void loglist_add_network(const ot_net *net); |
74 | void loglist_reset( ); | 75 | void loglist_reset(); |
75 | int loglist_check_address( const ot_ip6 address ); | 76 | int loglist_check_address(const ot_ip6 address); |
76 | #endif | 77 | #endif |
77 | 78 | ||
78 | typedef enum { | 79 | typedef enum { |
79 | OT_PERMISSION_MAY_FULLSCRAPE = 0x1, | 80 | OT_PERMISSION_MAY_FULLSCRAPE = 0x1, |
@@ -82,7 +83,7 @@ typedef enum { | |||
82 | OT_PERMISSION_MAY_PROXY = 0x8 | 83 | OT_PERMISSION_MAY_PROXY = 0x8 |
83 | } ot_permissions; | 84 | } ot_permissions; |
84 | 85 | ||
85 | int accesslist_bless_net( ot_net *net, ot_permissions permissions ); | 86 | int accesslist_bless_net(ot_net *net, ot_permissions permissions); |
86 | int accesslist_is_blessed( ot_ip6 ip, ot_permissions permissions ); | 87 | int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions); |
87 | 88 | ||
88 | #endif | 89 | #endif |