diff options
| author | erdgeist <> | 2009-08-26 21:22:24 +0000 |
|---|---|---|
| committer | erdgeist <> | 2009-08-26 21:22:24 +0000 |
| commit | 20955311d12966b49b3cdf62217d7508af9a4e9a (patch) | |
| tree | d3767db625079de27e9f5059be98fdcf1ccbbc54 /ot_accesslist.h | |
| parent | c3a58d248b3c7f39979633376b92fd271464f864 (diff) | |
Introducing the concept of vectors of nets into opentracker
Diffstat (limited to 'ot_accesslist.h')
| -rw-r--r-- | ot_accesslist.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ot_accesslist.h b/ot_accesslist.h index 5954a4a..a1e4ad2 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h | |||
| @@ -24,6 +24,48 @@ extern char *g_accesslist_filename; | |||
| 24 | #define accesslist_hashisvalid( hash ) 1 | 24 | #define accesslist_hashisvalid( hash ) 1 |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | /* Test if an address is subset of an ot_net, return value is considered a bool */ | ||
| 28 | int address_in_net( const ot_ip6 address, const ot_net *net ); | ||
| 29 | |||
| 30 | /* Store a value into a vector of struct { ot_net net, uint8_t[x] value } member; | ||
| 31 | returns NULL | ||
| 32 | if member_size is too small, or | ||
| 33 | if one of the nets inside the vector are a subnet of _net_, or | ||
| 34 | if _net_ is a subnet of one of the nets inside the vector, or | ||
| 35 | if the vector could not be resized | ||
| 36 | returns pointer to new member in vector for success | ||
| 37 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping | ||
| 38 | */ | ||
| 39 | void *set_value_for_net( const ot_net *net, ot_vector *vector, const void *value, const size_t member_size ); | ||
| 40 | |||
| 41 | /* Takes a vector filled with struct { ot_net net, uint8_t[x] value } member; | ||
| 42 | Returns pointer to _member_ associated with the net, or NULL if not found | ||
| 43 | member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping | ||
| 44 | */ | ||
| 45 | void *get_value_for_net( const ot_ip6 address, const ot_vector *vector, const size_t member_size ); | ||
| 46 | |||
| 47 | |||
| 48 | #ifdef WANT_IP_FROM_PROXY | ||
| 49 | int proxylist_add_network( const ot_net *proxy, const ot_net *net ); | ||
| 50 | int proxylist_check_network( const ot_ip6 *proxy, const ot_ip6 address /* can be NULL to only check proxy */ ); | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #ifdef WANT_FULLLOG_NETWORKS | ||
| 54 | typedef struct ot_log ot_log; | ||
| 55 | struct ot_log { | ||
| 56 | ot_ip6 ip; | ||
| 57 | uint8_t *data; | ||
| 58 | size_t size; | ||
| 59 | ot_time time; | ||
| 60 | ot_log *next; | ||
| 61 | }; | ||
| 62 | extern ot_log *g_logchain_first, *g_logchain_last; | ||
| 63 | |||
| 64 | void loglist_add_network( const ot_net *net ); | ||
| 65 | void loglist_reset( ); | ||
| 66 | int loglist_check_address( const ot_ip6 address ); | ||
| 67 | #endif | ||
| 68 | |||
| 27 | typedef enum { | 69 | typedef enum { |
| 28 | OT_PERMISSION_MAY_FULLSCRAPE = 0x1, | 70 | OT_PERMISSION_MAY_FULLSCRAPE = 0x1, |
| 29 | OT_PERMISSION_MAY_STAT = 0x2, | 71 | OT_PERMISSION_MAY_STAT = 0x2, |
