aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-04 20:49:35 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-04 20:49:35 +0000
commited4272a244d2770c42ffdb22c80cb4245fbcf538 (patch)
tree5e43c11209a67431bec2e49b2e82da64ab1f0fd0 /src/transport/gnunet-service-transport_neighbours.h
parentb766cf70853e0732c0785648acd74c6958fea5a7 (diff)
downloadgnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.tar.gz
gnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.zip
implementing blacklist
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.h')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h68
1 files changed, 63 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index c627e7e2f..914134ac5 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file transport/gnunet-service-transport_neighbours.h 22 * @file transport/gnunet-service-transport_neighbours.h
23 * @brief plugin management API 23 * @brief neighbour management API
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H 26#ifndef GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H
@@ -30,51 +30,93 @@
30#include "gnunet_transport_service.h" 30#include "gnunet_transport_service.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32 32
33// TODO:
34// - have a way to access the currently 'connected' session
35// (for sending and to notice disconnect of it!)
36// - have a way to access/update bandwidth/quota information per peer
37// (for CostReport/TrafficReport callbacks)
38
39
33 40
34/** 41/**
42 * Initialize the neighbours subsystem.
35 * 43 *
44 * @param cls closure for callbacks
45 * @param connect_cb function to call if we connect to a peer
46 * @param disconnect_cb function to call if we disconnect from a peer
36 */ 47 */
37void 48void
38GST_neighbours_start (void *cls, 49GST_neighbours_start (void *cls,
39 GNUNET_TRANSPORT_NotifyConnect connect_cb, 50 GNUNET_TRANSPORT_NotifyConnect connect_cb,
40 GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb); 51 GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb);
41 52
53
42/** 54/**
43 * 55 * Cleanup the neighbours subsystem.
44 */ 56 */
45void 57void
46GST_neighbours_stop (void); 58GST_neighbours_stop (void);
47 59
60
48/** 61/**
62 * Try to create a connection to the given target (eventually).
49 * 63 *
64 * @param target peer to try to connect to
50 */ 65 */
51void 66void
52GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target); 67GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target);
53 68
69
54/** 70/**
55 * 71 * Test if we're connected to the given peer.
72 *
73 * @param target peer to test
74 * @return GNUNET_YES if we are connected, GNUNET_NO if not
56 */ 75 */
57int 76int
58GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target); 77GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target);
59 78
79
60/** 80/**
81 * If we have an active connection to the given target, it must be shutdown.
61 * 82 *
83 * @param target peer to disconnect from
62 */ 84 */
63void 85void
64GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target); 86GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target);
65 87
66 88
89/**
90 * Function called for each connected neighbour.
91 *
92 * @param cls closure
93 * @param neighbour identity of the neighbour
94 */
67typedef void (*GST_NeighbourIterator)(void *cls, 95typedef void (*GST_NeighbourIterator)(void *cls,
68 const struct GNUNET_PeerIdentity *neighbour); 96 const struct GNUNET_PeerIdentity *neighbour);
69 97
70 98
99/**
100 * Iterate over all connected neighbours.
101 *
102 * @param cb function to call
103 * @param cb_cls closure for cb
104 */
71void 105void
72GST_neighbours_iterate (GST_NeighbourIterator cb, 106GST_neighbours_iterate (GST_NeighbourIterator cb,
73 void *cb_cls); 107 void *cb_cls);
74 108
75 109
76/** 110/**
111 * We have received a PONG. Update lifeness of the neighbour.
77 * 112 *
113 * @param sender peer sending the PONG
114 * @param hdr the PONG message (presumably)
115 * @param plugin_name name of transport that delivered the PONG
116 * @param sender_address address of the other peer, NULL if other peer
117 * connected to us
118 * @param sender_address_len number of bytes in sender_address
119 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
78 */ 120 */
79int 121int
80GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender, 122GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender,
@@ -83,8 +125,17 @@ GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender,
83 const void *sender_address, 125 const void *sender_address,
84 size_t sender_address_len); 126 size_t sender_address_len);
85 127
128
86/** 129/**
130 * We have received a CONNECT. Set the peer to connected.
87 * 131 *
132 * @param sender peer sending the PONG
133 * @param hdr the PONG message (presumably)
134 * @param plugin_name name of transport that delivered the PONG
135 * @param sender_address address of the other peer, NULL if other peer
136 * connected to us
137 * @param sender_address_len number of bytes in sender_address
138 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
88 */ 139 */
89int 140int
90GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender, 141GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender,
@@ -93,8 +144,17 @@ GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender,
93 const void *sender_address, 144 const void *sender_address,
94 size_t sender_address_len); 145 size_t sender_address_len);
95 146
147
96/** 148/**
149 * We have received a DISCONNECT. Set the peer to disconnected.
97 * 150 *
151 * @param sender peer sending the PONG
152 * @param hdr the PONG message (presumably)
153 * @param plugin_name name of transport that delivered the PONG
154 * @param sender_address address of the other peer, NULL if other peer
155 * connected to us
156 * @param sender_address_len number of bytes in sender_address
157 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
98 */ 158 */
99int 159int
100GST_neighbours_handle_disconnect (const struct GNUNET_PeerIdentity *sender, 160GST_neighbours_handle_disconnect (const struct GNUNET_PeerIdentity *sender,
@@ -104,7 +164,5 @@ GST_neighbours_handle_disconnect (const struct GNUNET_PeerIdentity *sender,
104 size_t sender_address_len); 164 size_t sender_address_len);
105 165
106 166
107
108
109#endif 167#endif
110/* end of file gnunet-service-transport_neighbours.h */ 168/* end of file gnunet-service-transport_neighbours.h */