summaryrefslogtreecommitdiff
path: root/ot_accesslist.h
diff options
context:
space:
mode:
Diffstat (limited to 'ot_accesslist.h')
-rw-r--r--ot_accesslist.h47
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
15void accesslist_init( void ); 17void accesslist_init(void);
16void accesslist_deinit( void ); 18void accesslist_deinit(void);
17int accesslist_hashisvalid( ot_hash hash ); 19int accesslist_hashisvalid(ot_hash hash);
18void accesslist_cleanup( void ); 20void accesslist_cleanup(void);
19 21
20extern char *g_accesslist_filename; 22extern 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 */
37int address_in_net( const ot_ip6 address, const ot_net *net ); 39int 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*/
48void *set_value_for_net( const ot_net *net, ot_vector *vector, const void *value, const size_t member_size ); 50void *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*/
54void *get_value_for_net( const ot_ip6 address, const ot_vector *vector, const size_t member_size ); 56void *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
58int proxylist_add_network( const ot_net *proxy, const ot_net *net ); 59int proxylist_add_network(const ot_net *proxy, const ot_net *net);
59int proxylist_check_network( const ot_ip6 *proxy, const ot_ip6 address /* can be NULL to only check proxy */ ); 60int 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};
71extern ot_log *g_logchain_first, *g_logchain_last; 72extern ot_log *g_logchain_first, *g_logchain_last;
72 73
73void loglist_add_network( const ot_net *net ); 74void loglist_add_network(const ot_net *net);
74void loglist_reset( ); 75void loglist_reset();
75int loglist_check_address( const ot_ip6 address ); 76int loglist_check_address(const ot_ip6 address);
76#endif 77#endif
77 78
78typedef enum { 79typedef 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
85int accesslist_bless_net( ot_net *net, ot_permissions permissions ); 86int accesslist_bless_net(ot_net *net, ot_permissions permissions);
86int accesslist_is_blessed( ot_ip6 ip, ot_permissions permissions ); 87int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions);
87 88
88#endif 89#endif