diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-04 20:49:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-04 20:49:35 +0000 |
commit | ed4272a244d2770c42ffdb22c80cb4245fbcf538 (patch) | |
tree | 5e43c11209a67431bec2e49b2e82da64ab1f0fd0 /src/transport/gnunet-service-transport_blacklist.h | |
parent | b766cf70853e0732c0785648acd74c6958fea5a7 (diff) | |
download | gnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.tar.gz gnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.zip |
implementing blacklist
Diffstat (limited to 'src/transport/gnunet-service-transport_blacklist.h')
-rw-r--r-- | src/transport/gnunet-service-transport_blacklist.h | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.h b/src/transport/gnunet-service-transport_blacklist.h index 1d10846ea..03f059d81 100644 --- a/src/transport/gnunet-service-transport_blacklist.h +++ b/src/transport/gnunet-service-transport_blacklist.h | |||
@@ -30,37 +30,52 @@ | |||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Start blacklist subsystem. | ||
33 | * | 34 | * |
35 | * @param server server used to accept clients from | ||
34 | */ | 36 | */ |
35 | void | 37 | void |
36 | GST_blacklist_start (void); | 38 | GST_blacklist_start (struct GNUNET_SERVER_Handle *server); |
37 | 39 | ||
38 | 40 | ||
39 | /** | 41 | /** |
40 | * | 42 | * Stop blacklist subsystem. |
41 | */ | 43 | */ |
42 | void | 44 | void |
43 | GST_blacklist_stop (void); | 45 | GST_blacklist_stop (void); |
44 | 46 | ||
45 | 47 | ||
46 | /** | 48 | /** |
49 | * Initialize a blacklisting client. We got a blacklist-init | ||
50 | * message from this client, add him to the list of clients | ||
51 | * to query for blacklisting. | ||
47 | * | 52 | * |
53 | * @param cls unused | ||
54 | * @param client the client | ||
55 | * @param message the blacklist-init message that was sent | ||
48 | */ | 56 | */ |
49 | void | 57 | void |
50 | GST_blacklist_handle_init (void *cls, | 58 | GST_blacklist_handle_init (void *cls, |
51 | const struct GNUNET_SERVER_Client *client, | 59 | struct GNUNET_SERVER_Client *client, |
52 | const struct GNUNET_MessageHeader *message); | 60 | const struct GNUNET_MessageHeader *message); |
53 | 61 | ||
54 | /** | 62 | /** |
63 | * A blacklisting client has sent us reply. Process it. | ||
55 | * | 64 | * |
65 | * @param cls unused | ||
66 | * @param client the client | ||
67 | * @param message the blacklist-init message that was sent | ||
56 | */ | 68 | */ |
57 | void | 69 | void |
58 | GST_blacklist_handle_reply (void *cls, | 70 | GST_blacklist_handle_reply (void *cls, |
59 | const struct GNUNET_SERVER_Client *client, | 71 | struct GNUNET_SERVER_Client *client, |
60 | const struct GNUNET_MessageHeader *message); | 72 | const struct GNUNET_MessageHeader *message); |
61 | 73 | ||
62 | /** | 74 | /** |
63 | * | 75 | * Add the given peer to the blacklist (for the given transport). |
76 | * | ||
77 | * @param peer peer to blacklist | ||
78 | * @param transport_name transport to blacklist for this peer, NULL for all | ||
64 | */ | 79 | */ |
65 | void | 80 | void |
66 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | 81 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, |
@@ -68,11 +83,31 @@ GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | |||
68 | 83 | ||
69 | 84 | ||
70 | /** | 85 | /** |
86 | * Continuation called from a blacklist test. | ||
87 | * | ||
88 | * @param cls closure | ||
89 | * @param peer identity of peer that was tested | ||
90 | * @param result GNUNET_OK if the connection is allowed, | ||
91 | * GNUNET_NO if not | ||
92 | */ | ||
93 | typedef void (*GST_BlacklistTestContinuation)(void *cls, | ||
94 | const struct GNUNET_PeerIdentity *peer, | ||
95 | int result); | ||
96 | |||
97 | |||
98 | /** | ||
99 | * Test if a peer/transport combination is blacklisted. | ||
71 | * | 100 | * |
101 | * @param peer the identity of the peer to test | ||
102 | * @param transport_name name of the transport to test, never NULL | ||
103 | * @param cont function to call with result | ||
104 | * @param cont_cls closure for 'cont' | ||
72 | */ | 105 | */ |
73 | int | 106 | void |
74 | GST_blacklist_test (const struct GNUNET_PeerIdentity *peer, | 107 | GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, |
75 | const char *transport_name); | 108 | const char *transport_name, |
109 | GST_BlacklistTestContinuation cont, | ||
110 | void *cont_cls); | ||
76 | 111 | ||
77 | 112 | ||
78 | 113 | ||