summaryrefslogtreecommitdiff
path: root/ot_accesslist.h
diff options
context:
space:
mode:
Diffstat (limited to 'ot_accesslist.h')
-rw-r--r--ot_accesslist.h93
1 files changed, 0 insertions, 93 deletions
diff --git a/ot_accesslist.h b/ot_accesslist.h
deleted file mode 100644
index 0a8bf4c..0000000
--- a/ot_accesslist.h
+++ /dev/null
@@ -1,93 +0,0 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever.
3
4 $id$ */
5
6#ifndef OT_ACCESSLIST_H__
7#define OT_ACCESSLIST_H__
8
9#include "trackerlogic.h"
10
11#if defined(WANT_ACCESSLIST_BLACK) && defined(WANT_ACCESSLIST_WHITE)
12#error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive.
13#endif
14
15#if defined(WANT_ACCESSLIST_BLACK) || defined(WANT_ACCESSLIST_WHITE)
16#define WANT_ACCESSLIST
17void accesslist_init(void);
18void accesslist_deinit(void);
19int accesslist_hashisvalid(const ot_hash hash);
20void accesslist_cleanup(void);
21
22/* Scan buf for up to capacity info_hashes in hexadecimal notation, one per
23 line, and return how many were written to dest */
24size_t accesslist_parse_hashes(ot_hash *dest, size_t capacity, const char *buf, size_t len);
25
26extern const char *g_accesslist_filename;
27#ifdef WANT_DYNAMIC_ACCESSLIST
28extern const char *g_accesslist_pipe_add;
29extern const char *g_accesslist_pipe_delete;
30#endif
31
32#else
33#ifdef WANT_DYNAMIC_ACCESSLIST
34#error WANT_DYNAMIC_ACCESSLIST needs either WANT_ACCESSLIST_BLACK or WANT_ACCESSLIST_WHITE
35#endif
36
37#define accesslist_init(accesslist_filename)
38#define accesslist_deinit()
39#define accesslist_hashisvalid(hash) 1
40#endif
41
42/* Test if an address is subset of an ot_net, return value is considered a bool */
43int accesslist_address_in_net(const ot_ip6 address, const ot_net *net);
44
45/* Store a value into a vector of struct { ot_net net, uint8_t[x] value } member;
46 returns NULL
47 if member_size is too small, or
48 if one of the nets inside the vector are a subnet of _net_, or
49 if _net_ is a subnet of one of the nets inside the vector, or
50 if the vector could not be resized
51 returns pointer to new member in vector for success
52 member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping
53*/
54void *accesslist_set_value_for_net(const ot_net *net, ot_vector *vector, const void *value, const size_t member_size);
55
56/* Takes a vector filled with struct { ot_net net, uint8_t[x] value } member;
57 Returns pointer to _member_ associated with the net, or NULL if not found
58 member_size can be sizeof(ot_net) to reduce the lookup to a boolean mapping
59*/
60void *accesslist_get_value_for_net(const ot_ip6 address, const ot_vector *vector, const size_t member_size);
61
62#ifdef WANT_IP_FROM_PROXY
63int proxylist_add_network(const ot_net *proxy, const ot_net *net);
64int proxylist_check_network(const ot_ip6 *proxy, const ot_ip6 address /* can be NULL to only check proxy */);
65#endif
66
67#ifdef WANT_FULLLOG_NETWORKS
68typedef struct ot_log ot_log;
69struct ot_log {
70 ot_ip6 ip;
71 uint8_t *data;
72 size_t size;
73 ot_time time;
74 ot_log *next;
75};
76extern ot_log *g_logchain_first, *g_logchain_last;
77
78void loglist_add_network(const ot_net *net);
79void loglist_reset(void);
80int loglist_check_address(const ot_ip6 address);
81#endif
82
83typedef enum {
84 OT_PERMISSION_MAY_FULLSCRAPE = 0x1,
85 OT_PERMISSION_MAY_STAT = 0x2,
86 OT_PERMISSION_MAY_LIVESYNC = 0x4,
87 OT_PERMISSION_MAY_PROXY = 0x8
88} ot_permissions;
89
90int accesslist_bless_net(ot_net *net, ot_permissions permissions);
91int accesslist_is_blessed(ot_ip6 ip, ot_permissions permissions);
92
93#endif