diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-21 09:50:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-21 09:50:12 +0000 |
commit | a476f6ebdf69cd7b365ad7f079dcf0b8361a55cc (patch) | |
tree | e90682136c83e8ca3f2ca1bb66755b491fe6ef7c /src/transport/gnunet-service-transport_blacklist.c | |
parent | b6818796397f2a15992ce759a0005dc848e19e23 (diff) | |
download | gnunet-a476f6ebdf69cd7b365ad7f079dcf0b8361a55cc.tar.gz gnunet-a476f6ebdf69cd7b365ad7f079dcf0b8361a55cc.zip |
adding blacklisting code, untested
Diffstat (limited to 'src/transport/gnunet-service-transport_blacklist.c')
-rw-r--r-- | src/transport/gnunet-service-transport_blacklist.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 08ed2c9d2..10eda72b0 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -30,128 +30,6 @@ | |||
30 | #include "transport.h" | 30 | #include "transport.h" |
31 | #include "gnunet-service-transport_blacklist.h" | 31 | #include "gnunet-service-transport_blacklist.h" |
32 | 32 | ||
33 | |||
34 | /** | ||
35 | * Information kept for each blacklisted peer. | ||
36 | */ | ||
37 | struct BlacklistEntry | ||
38 | { | ||
39 | /** | ||
40 | * Identity of the peer being blacklisted by this entry. | ||
41 | * (also equivalent to the key) | ||
42 | */ | ||
43 | struct GNUNET_PeerIdentity peer; | ||
44 | |||
45 | /** | ||
46 | * Client responsible for this entry. | ||
47 | */ | ||
48 | struct GNUNET_SERVER_Client *client; | ||
49 | |||
50 | }; | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Information kept for each client registered to perform | ||
55 | * blacklisting. | ||
56 | */ | ||
57 | struct Blacklisters | ||
58 | { | ||
59 | /** | ||
60 | * This is a linked list. | ||
61 | */ | ||
62 | struct Blacklisters *next; | ||
63 | |||
64 | /** | ||
65 | * This is a linked list. | ||
66 | */ | ||
67 | struct Blacklisters *prev; | ||
68 | |||
69 | /** | ||
70 | * Client responsible for this entry. | ||
71 | */ | ||
72 | struct GNUNET_SERVER_Client *client; | ||
73 | |||
74 | }; | ||
75 | |||
76 | |||
77 | /** | ||
78 | * State of blacklist check to be performed for each | ||
79 | * connecting peer. | ||
80 | */ | ||
81 | struct BlacklistCheck | ||
82 | { | ||
83 | |||
84 | |||
85 | |||
86 | /** | ||
87 | * Identity of the peer being checked. | ||
88 | */ | ||
89 | struct GNUNET_PeerIdentity peer; | ||
90 | |||
91 | /** | ||
92 | * Clients we still need to ask. | ||
93 | */ | ||
94 | struct GNUNET_SERVER_Client *pending; | ||
95 | |||
96 | }; | ||
97 | |||
98 | |||
99 | |||
100 | /** | ||
101 | * Map of blacklisted peers (maps from peer identities | ||
102 | * to 'struct BlacklistEntry*' values). | ||
103 | */ | ||
104 | static struct GNUNET_CONTAINER_MultiHashMap *blacklist; | ||
105 | |||
106 | /** | ||
107 | * Head of DLL of blacklisting clients. | ||
108 | */ | ||
109 | static struct Blacklisters *bl_head; | ||
110 | |||
111 | /** | ||
112 | * Tail of DLL of blacklisting clients. | ||
113 | */ | ||
114 | static struct Blacklisters *bl_tail; | ||
115 | |||
116 | |||
117 | /** | ||
118 | * Free the entries in the blacklist hash map. | ||
119 | * | ||
120 | * @param cls closure, unused | ||
121 | * @param key current key code | ||
122 | * @param value value in the hash map | ||
123 | * @return GNUNET_YES (continue to iterate) | ||
124 | */ | ||
125 | static int | ||
126 | free_blacklist_entry (void *cls, | ||
127 | const GNUNET_HashCode *key, | ||
128 | void *value) | ||
129 | { | ||
130 | struct BlacklistEntry *be = value; | ||
131 | |||
132 | GNUNET_free (be); | ||
133 | return GNUNET_YES; | ||
134 | } | ||
135 | |||
136 | |||
137 | /** | ||
138 | * Task run when we are shutting down. Cleans up. | ||
139 | * | ||
140 | * @param cls closure (unused) | ||
141 | * @param tc scheduler context (unused) | ||
142 | */ | ||
143 | static void | ||
144 | shutdown_task (void *cls, | ||
145 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
146 | { | ||
147 | GNUNET_CONTAINER_multihashmap_iterate (blacklist, | ||
148 | &free_blacklist_entry, | ||
149 | NULL); | ||
150 | GNUNET_CONTAINER_multihashmap_destroy (blacklist); | ||
151 | blacklist = NULL; | ||
152 | } | ||
153 | |||
154 | |||
155 | /** | 33 | /** |
156 | * Handle a request to start a blacklist. | 34 | * Handle a request to start a blacklist. |
157 | * | 35 | * |