diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-21 08:21:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-21 08:21:19 +0000 |
commit | 92cb20c180e4190494ad837682b1a6fb1fdd1e01 (patch) | |
tree | 06d06b4be8e317103b8c9cefee26b6f22635f4d7 /src/include | |
parent | b8578fedf6a5553b25d3577664cd36eaaa1935b2 (diff) | |
download | gnunet-92cb20c180e4190494ad837682b1a6fb1fdd1e01.tar.gz gnunet-92cb20c180e4190494ad837682b1a6fb1fdd1e01.zip |
blacklisting API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_transport_service.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 1c32f10f1..10b7e8f89 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -294,6 +294,77 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, | |||
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | |||
298 | /** | ||
299 | * Blacklist a peer for a given period of time. All connections | ||
300 | * (inbound and outbound) to a peer that is blacklisted will be | ||
301 | * dropped (as soon as we learn who the connection is for). A second | ||
302 | * call to this function for the same peer overrides previous | ||
303 | * blacklisting requests. | ||
304 | * | ||
305 | * @param sched scheduler to use | ||
306 | * @param cfg configuration to use | ||
307 | * @param peer identity of peer to blacklist | ||
308 | * @param duration how long to blacklist, use GNUNET_TIME_UNIT_ZERO to | ||
309 | * re-enable connections | ||
310 | */ | ||
311 | void | ||
312 | GNUNET_TRANSPORT_blacklist (struct GNUNET_SCHEDULER_Handle *sched, | ||
313 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
314 | const struct GNUNET_PeerIdentity *peer, | ||
315 | struct GNUNET_TIME_Relative duration); | ||
316 | |||
317 | |||
318 | /** | ||
319 | * Handle for blacklist notifications. | ||
320 | */ | ||
321 | struct GNUNET_TRANSPORT_BlacklistNotification; | ||
322 | |||
323 | |||
324 | /** | ||
325 | * Signature of function called whenever the blacklist status of | ||
326 | * a peer changes. This includes changes to the duration of the | ||
327 | * blacklist status as well as the expiration of an existing | ||
328 | * blacklist status. | ||
329 | * | ||
330 | * @param cls closure | ||
331 | * @param peer identity of peer with the change | ||
332 | * @param until GNUNET_TIME_UNIT_ZERO_ABS if the peer is no | ||
333 | * longer blacklisted, otherwise the time at | ||
334 | * which the current blacklisting will expire | ||
335 | */ | ||
336 | typedef void (*GNUNET_TRANSPORT_BlacklistCallback)(void *cls, | ||
337 | const struct GNUNET_PeerIdentity *peer, | ||
338 | struct GNUNET_TIME_Absolute until); | ||
339 | |||
340 | |||
341 | /** | ||
342 | * Call a function whenever a peer's blacklisting status changes. | ||
343 | * | ||
344 | * @param sched scheduler to use | ||
345 | * @param cfg configuration to use | ||
346 | * @param bc function to call on status changes | ||
347 | * @param bc_cls closure for bc | ||
348 | * @return NULL on error, otherwise handle for cancellation | ||
349 | */ | ||
350 | struct GNUNET_TRANSPORT_BlacklistNotification * | ||
351 | GNUNET_TRANSPORT_blacklist_notify (struct GNUNET_SCHEDULER_Handle *sched, | ||
352 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
353 | GNUNET_TRANSPORT_BlacklistCallback bc, | ||
354 | void *bc_cls); | ||
355 | |||
356 | |||
357 | /** | ||
358 | * Stop calling the notification callback associated with | ||
359 | * the given blacklist notification. | ||
360 | * | ||
361 | * @param bn handle of the request that is to be cancelled | ||
362 | */ | ||
363 | void | ||
364 | GNUNET_TRANSPORT_blacklist_notify_cancel (struct GNUNET_TRANSPORT_BlacklistNotification * bn); | ||
365 | |||
366 | |||
367 | |||
297 | #if 0 /* keep Emacsens' auto-indent happy */ | 368 | #if 0 /* keep Emacsens' auto-indent happy */ |
298 | { | 369 | { |
299 | #endif | 370 | #endif |