2 This file is part of GNUnet.
3 Copyright (C) 2010,2011 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file transport/gnunet-service-transport_blacklist.h
23 * @brief blacklisting API
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_TRANSPORT_BLACKLIST_H
27 #define GNUNET_SERVICE_TRANSPORT_BLACKLIST_H
29 #include "gnunet_statistics_service.h"
30 #include "gnunet_util_lib.h"
33 * Start blacklist subsystem.
35 * @param server server used to accept clients from
36 * @param cfg configuration handle
37 * @param my_id my peer id
40 GST_blacklist_start (struct GNUNET_SERVER_Handle *server,
41 const struct GNUNET_CONFIGURATION_Handle *cfg,
42 const struct GNUNET_PeerIdentity *my_id);
46 * Stop blacklist subsystem.
49 GST_blacklist_stop (void);
53 * Initialize a blacklisting client. We got a blacklist-init
54 * message from this client, add him to the list of clients
55 * to query for blacklisting.
58 * @param client the client
59 * @param message the blacklist-init message that was sent
62 GST_blacklist_handle_init (void *cls,
63 struct GNUNET_SERVER_Client *client,
64 const struct GNUNET_MessageHeader *message);
68 * A blacklisting client has sent us reply. Process it.
71 * @param client the client
72 * @param message the blacklist-init message that was sent
75 GST_blacklist_handle_reply (void *cls,
76 struct GNUNET_SERVER_Client *client,
77 const struct GNUNET_MessageHeader *message);
81 * Add the given peer to the blacklist (for the given transport).
83 * @param peer peer to blacklist
84 * @param transport_name transport to blacklist for this peer, NULL for all
87 GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
88 const char *transport_name);
92 * Handle to an active blacklist check.
94 struct GST_BlacklistCheck;
98 * Continuation called from a blacklist test.
101 * @param peer identity of peer that was tested
102 * @param result #GNUNET_OK if the connection is allowed,
106 (*GST_BlacklistTestContinuation) (void *cls,
107 const struct GNUNET_PeerIdentity *peer,
112 * Test if a peer/transport combination is blacklisted.
114 * @param peer the identity of the peer to test
115 * @param transport_name name of the transport to test, never NULL
116 * @param cont function to call with result
117 * @param cont_cls closure for @a cont
118 * @return handle to the blacklist check, NULL if the decision
119 * was made instantly and @a cont was already called
121 struct GST_BlacklistCheck *
122 GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
123 const char *transport_name,
124 GST_BlacklistTestContinuation cont, void *cont_cls);
128 * Cancel a blacklist check.
130 * @param bc check to cancel
133 GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc);
136 /* end of file gnunet-service-transport_blacklist.h */