diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-21 12:27:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-21 12:27:29 +0000 |
commit | 3926d80e05c1145d84f807224e6cb30eee4c1b40 (patch) | |
tree | 9fc6544cfef2f157d2b7badaa9ebb105037e2bbb /src/include | |
parent | bfd71264204549e472ea6a3bebd710a8a21a9f1c (diff) | |
download | gnunet-3926d80e05c1145d84f807224e6cb30eee4c1b40.tar.gz gnunet-3926d80e05c1145d84f807224e6cb30eee4c1b40.zip |
blacklisting API implementation
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_protocols.h | 28 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 30 |
2 files changed, 48 insertions, 10 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 0925a1909..5451f53d9 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -185,43 +185,55 @@ extern "C" | |||
185 | */ | 185 | */ |
186 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY 30 | 186 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY 30 |
187 | 187 | ||
188 | /** | ||
189 | * Change in blacklisting status of a peer. | ||
190 | */ | ||
191 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST 31 | ||
192 | |||
193 | /** | ||
194 | * Request to transport to notify us about any blacklisting status | ||
195 | * changes on this connection (and to immediately send all | ||
196 | * active blacklist entries). | ||
197 | */ | ||
198 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_NOTIFY 32 | ||
199 | |||
188 | 200 | ||
189 | /** | 201 | /** |
190 | * Request addition of a HELLO | 202 | * Request addition of a HELLO |
191 | */ | 203 | */ |
192 | #define GNUNET_MESSAGE_TYPE_PEERINFO_ADD 32 | 204 | #define GNUNET_MESSAGE_TYPE_PEERINFO_ADD 36 |
193 | 205 | ||
194 | /** | 206 | /** |
195 | * Request update and listing of a peer. | 207 | * Request update and listing of a peer. |
196 | */ | 208 | */ |
197 | #define GNUNET_MESSAGE_TYPE_PEERINFO_GET 33 | 209 | #define GNUNET_MESSAGE_TYPE_PEERINFO_GET 37 |
198 | 210 | ||
199 | /** | 211 | /** |
200 | * Request update and listing of all peers. | 212 | * Request update and listing of all peers. |
201 | */ | 213 | */ |
202 | #define GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL 34 | 214 | #define GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL 38 |
203 | 215 | ||
204 | /** | 216 | /** |
205 | * Information about one of the peers. | 217 | * Information about one of the peers. |
206 | */ | 218 | */ |
207 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO 35 | 219 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO 39 |
208 | 220 | ||
209 | /** | 221 | /** |
210 | * End of information about other peers. | 222 | * End of information about other peers. |
211 | */ | 223 | */ |
212 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END 36 | 224 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END 40 |
213 | 225 | ||
214 | /** | 226 | /** |
215 | * Start notifying this client about all changes to | 227 | * Start notifying this client about all changes to |
216 | * the known peers until it disconnects. | 228 | * the known peers until it disconnects. |
217 | */ | 229 | */ |
218 | #define GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY 37 | 230 | #define GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY 41 |
219 | 231 | ||
220 | 232 | ||
221 | /** | 233 | /** |
222 | * Welcome message between TCP transports. | 234 | * Welcome message between TCP transports. |
223 | */ | 235 | */ |
224 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME 40 | 236 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME 60 |
225 | 237 | ||
226 | /** | 238 | /** |
227 | * Welcome message between TCP transports. | 239 | * Welcome message between TCP transports. |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 10b7e8f89..0d378cbd3 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -294,6 +294,11 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, | |||
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | /** | ||
298 | * Handle for blacklisting requests. | ||
299 | */ | ||
300 | struct GNUNET_TRANSPORT_BlacklistRequest; | ||
301 | |||
297 | 302 | ||
298 | /** | 303 | /** |
299 | * Blacklist a peer for a given period of time. All connections | 304 | * Blacklist a peer for a given period of time. All connections |
@@ -307,12 +312,33 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, | |||
307 | * @param peer identity of peer to blacklist | 312 | * @param peer identity of peer to blacklist |
308 | * @param duration how long to blacklist, use GNUNET_TIME_UNIT_ZERO to | 313 | * @param duration how long to blacklist, use GNUNET_TIME_UNIT_ZERO to |
309 | * re-enable connections | 314 | * re-enable connections |
315 | * @param timeout when should this operation (trying to establish the | ||
316 | * blacklisting time out) | ||
317 | * @param cont continuation to call once the request has been processed | ||
318 | * @param cont_cls closure for cont | ||
319 | * @return NULL on error, otherwise handle for cancellation | ||
310 | */ | 320 | */ |
311 | void | 321 | struct GNUNET_TRANSPORT_BlacklistRequest * |
312 | GNUNET_TRANSPORT_blacklist (struct GNUNET_SCHEDULER_Handle *sched, | 322 | GNUNET_TRANSPORT_blacklist (struct GNUNET_SCHEDULER_Handle *sched, |
313 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 323 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
314 | const struct GNUNET_PeerIdentity *peer, | 324 | const struct GNUNET_PeerIdentity *peer, |
315 | struct GNUNET_TIME_Relative duration); | 325 | struct GNUNET_TIME_Relative duration, |
326 | struct GNUNET_TIME_Relative timeout, | ||
327 | GNUNET_SCHEDULER_Task cont, | ||
328 | void *cont_cls); | ||
329 | |||
330 | |||
331 | /** | ||
332 | * Abort transmitting the blacklist request. Note that this function | ||
333 | * is NOT for removing a peer from the blacklist (for that, call | ||
334 | * GNUNET_TRANSPORT_blacklist with a duration of zero). This function | ||
335 | * is only for aborting the transmission of a blacklist request | ||
336 | * (i.e. because of shutdown). | ||
337 | * | ||
338 | * @param br handle of the request that is to be cancelled | ||
339 | */ | ||
340 | void | ||
341 | GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_BlacklistRequest * br); | ||
316 | 342 | ||
317 | 343 | ||
318 | /** | 344 | /** |