summaryrefslogtreecommitdiff
path: root/ot_accesslist.h
diff options
context:
space:
mode:
Diffstat (limited to 'ot_accesslist.h')
-rw-r--r--ot_accesslist.h52
1 files changed, 31 insertions, 21 deletions
diff --git a/ot_accesslist.h b/ot_accesslist.h
index b38b91a..0a7488e 100644
--- a/ot_accesslist.h
+++ b/ot_accesslist.h
@@ -6,26 +6,37 @@
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( ); 17void accesslist_init(void);
16void accesslist_deinit( ); 18void accesslist_deinit(void);
17int accesslist_hashisvalid( ot_hash hash ); 19int accesslist_hashisvalid(ot_hash hash);
20void accesslist_cleanup(void);
18 21
19extern char *g_accesslist_filename; 22extern char *g_accesslist_filename;
23#ifdef WANT_DYNAMIC_ACCESSLIST
24extern char *g_accesslist_pipe_add;
25extern char *g_accesslist_pipe_delete;
26#endif
20 27
21#else 28#else
22#define accesslist_init( accesslist_filename ) 29#ifdef WANT_DYNAMIC_ACCESSLIST
23#define accesslist_deinit( ) 30#error WANT_DYNAMIC_ACCESSLIST needs either WANT_ACCESSLIST_BLACK or WANT_ACCESSLIST_WHITE
24#define accesslist_hashisvalid( hash ) 1 31#endif
32
33#define accesslist_init(accesslist_filename)
34#define accesslist_deinit()
35#define accesslist_hashisvalid(hash) 1
25#endif 36#endif
26 37
27/* 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 */
28int address_in_net( const ot_ip6 address, const ot_net *net ); 39int address_in_net(const ot_ip6 address, const ot_net *net);
29 40
30/* 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;
31 returns NULL 42 returns NULL
@@ -36,18 +47,17 @@ int address_in_net( const ot_ip6 address, const ot_net *net );
36 returns pointer to new member in vector for success 47 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 48 member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping
38*/ 49*/
39void *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);
40 51
41/* 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;
42 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
43 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
44*/ 55*/
45void *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);
46
47 57
48#ifdef WANT_IP_FROM_PROXY 58#ifdef WANT_IP_FROM_PROXY
49int proxylist_add_network( const ot_net *proxy, const ot_net *net ); 59int proxylist_add_network(const ot_net *proxy, const ot_net *net);
50int 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 */);
51#endif 61#endif
52 62
53#ifdef WANT_FULLLOG_NETWORKS 63#ifdef WANT_FULLLOG_NETWORKS
@@ -61,10 +71,10 @@ struct ot_log {
61}; 71};
62extern ot_log *g_logchain_first, *g_logchain_last; 72extern ot_log *g_logchain_first, *g_logchain_last;
63 73
64void loglist_add_network( const ot_net *net ); 74void loglist_add_network(const ot_net *net);
65void loglist_reset( ); 75void loglist_reset();
66int loglist_check_address( const ot_ip6 address ); 76int loglist_check_address(const ot_ip6 address);
67#endif 77#endif
68 78
69typedef enum { 79typedef enum {
70 OT_PERMISSION_MAY_FULLSCRAPE = 0x1, 80 OT_PERMISSION_MAY_FULLSCRAPE = 0x1,
@@ -73,7 +83,7 @@ typedef enum {
73 OT_PERMISSION_MAY_PROXY = 0x8 83 OT_PERMISSION_MAY_PROXY = 0x8
74} ot_permissions; 84} ot_permissions;
75 85
76int accesslist_blessip( ot_ip6 ip, ot_permissions permissions ); 86int accesslist_bless_net(ot_net *net, ot_permissions permissions);
77int accesslist_isblessed( ot_ip6 ip, ot_permissions permissions ); 87int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions);
78 88
79#endif 89#endif