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_ats_service.h"
31 #include "gnunet_util_lib.h"
34 * Start blacklist subsystem.
36 * @param server server used to accept clients from
37 * @param cfg configuration handle
38 * @param my_id my peer id
41 GST_blacklist_start (struct GNUNET_SERVER_Handle *server,
42 const struct GNUNET_CONFIGURATION_Handle *cfg,
43 const struct GNUNET_PeerIdentity *my_id);
47 * Stop blacklist subsystem.
50 GST_blacklist_stop (void);
54 * Initialize a blacklisting client. We got a blacklist-init
55 * message from this client, add him to the list of clients
56 * to query for blacklisting.
59 * @param client the client
60 * @param message the blacklist-init message that was sent
63 GST_blacklist_handle_init (void *cls,
64 struct GNUNET_SERVER_Client *client,
65 const struct GNUNET_MessageHeader *message);
69 * A blacklisting client has sent us reply. Process it.
72 * @param client the client
73 * @param message the blacklist-init message that was sent
76 GST_blacklist_handle_reply (void *cls,
77 struct GNUNET_SERVER_Client *client,
78 const struct GNUNET_MessageHeader *message);
82 * Add the given peer to the blacklist (for the given transport).
84 * @param peer peer to blacklist
85 * @param transport_name transport to blacklist for this peer, NULL for all
88 GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
89 const char *transport_name);
93 * Handle to an active blacklist check.
95 struct GST_BlacklistCheck;
99 * Continuation called from a blacklist test.
102 * @param peer identity of peer that was tested
103 * @param address address associated with the request
104 * @param session session associated with the request
105 * @param result #GNUNET_OK if the connection is allowed,
107 * #GNUNET_SYSERR if operation was aborted
110 (*GST_BlacklistTestContinuation) (void *cls,
111 const struct GNUNET_PeerIdentity *peer,
112 const struct GNUNET_HELLO_Address *address,
113 struct Session *session,
118 * Test if a peer/transport combination is blacklisted.
120 * @param peer the identity of the peer to test
121 * @param transport_name name of the transport to test, never NULL
122 * @param cont function to call with result
123 * @param cont_cls closure for @a cont
124 * @param address address to pass back to @a cont, can be NULL
125 * @param session session to pass back to @a cont, can be NULL
126 * @return handle to the blacklist check, NULL if the decision
127 * was made instantly and @a cont was already called
129 struct GST_BlacklistCheck *
130 GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
131 const char *transport_name,
132 GST_BlacklistTestContinuation cont,
134 const struct GNUNET_HELLO_Address *address,
135 struct Session *session);
139 * Abort blacklist if @a address and @a session match.
141 * @param address address used to abort matching checks
142 * @param session session used to abort matching checks
145 GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address,
146 struct Session *session);
151 * Cancel a blacklist check.
153 * @param bc check to cancel
156 GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc);
159 /* end of file gnunet-service-transport_blacklist.h */