diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-12 16:17:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-12 16:17:10 +0000 |
commit | b10f26ae8caab6299b94f00a319a6424be57a386 (patch) | |
tree | 5764c07a2a61a8e2fb8f0a94c885942b5fb028a5 /src/transport/gnunet-service-transport_neighbours.h | |
parent | 54811540b75f59ca8dd54f96d6fe9f8f3743011d (diff) | |
download | gnunet-b10f26ae8caab6299b94f00a319a6424be57a386.tar.gz gnunet-b10f26ae8caab6299b94f00a319a6424be57a386.zip |
-be stricter during handshake, close sessions with broken interactions aggressively
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.h')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.h | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h index 9ba1918c3..f58a74faf 100644 --- a/src/transport/gnunet-service-transport_neighbours.h +++ b/src/transport/gnunet-service-transport_neighbours.h | |||
@@ -48,7 +48,7 @@ | |||
48 | */ | 48 | */ |
49 | void | 49 | void |
50 | GST_neighbours_start (void *cls, | 50 | GST_neighbours_start (void *cls, |
51 | NotifyConnect connect_cb, | 51 | NotifyConnect connect_cb, |
52 | GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb, | 52 | GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb, |
53 | GNUNET_TRANSPORT_PeerIterateCallback peer_address_cb, | 53 | GNUNET_TRANSPORT_PeerIterateCallback peer_address_cb, |
54 | unsigned int max_fds); | 54 | unsigned int max_fds); |
@@ -74,7 +74,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target); | |||
74 | * Test if we're connected to the given peer. | 74 | * Test if we're connected to the given peer. |
75 | * | 75 | * |
76 | * @param target peer to test | 76 | * @param target peer to test |
77 | * @return GNUNET_YES if we are connected, GNUNET_NO if not | 77 | * @return #GNUNET_YES if we are connected, #GNUNET_NO if not |
78 | */ | 78 | */ |
79 | int | 79 | int |
80 | GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target); | 80 | GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target); |
@@ -84,7 +84,7 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target); | |||
84 | * Function called after the transmission is done. | 84 | * Function called after the transmission is done. |
85 | * | 85 | * |
86 | * @param cls closure | 86 | * @param cls closure |
87 | * @param success GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected | 87 | * @param success #GNUNET_OK on success, #GNUNET_NO on failure, #GNUNET_SYSERR if we're not connected |
88 | */ | 88 | */ |
89 | typedef void (*GST_NeighbourSendContinuation) (void *cls, int success, | 89 | typedef void (*GST_NeighbourSendContinuation) (void *cls, int success, |
90 | size_t bytes_payload, | 90 | size_t bytes_payload, |
@@ -96,10 +96,10 @@ typedef void (*GST_NeighbourSendContinuation) (void *cls, int success, | |||
96 | * | 96 | * |
97 | * @param target destination | 97 | * @param target destination |
98 | * @param msg message to send | 98 | * @param msg message to send |
99 | * @param msg_size number of bytes in msg | 99 | * @param msg_size number of bytes in @a msg |
100 | * @param timeout when to fail with timeout | 100 | * @param timeout when to fail with timeout |
101 | * @param cont function to call when done | 101 | * @param cont function to call when done |
102 | * @param cont_cls closure for 'cont' | 102 | * @param cont_cls closure for @a cont |
103 | */ | 103 | */ |
104 | void | 104 | void |
105 | GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, | 105 | GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, |
@@ -114,8 +114,8 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, | |||
114 | * | 114 | * |
115 | * @param sender sender of the message | 115 | * @param sender sender of the message |
116 | * @param size size of the message | 116 | * @param size size of the message |
117 | * @param do_forward set to GNUNET_YES if the message should be forwarded to clients | 117 | * @param do_forward set to #GNUNET_YES if the message should be forwarded to clients |
118 | * GNUNET_NO if the neighbour is not connected or violates the quota | 118 | * #GNUNET_NO if the neighbour is not connected or violates the quota |
119 | * @return how long to wait before reading more from this sender | 119 | * @return how long to wait before reading more from this sender |
120 | */ | 120 | */ |
121 | struct GNUNET_TIME_Relative | 121 | struct GNUNET_TIME_Relative |
@@ -185,7 +185,7 @@ typedef void (*GST_NeighbourIterator) (void *cls, | |||
185 | * Iterate over all connected neighbours. | 185 | * Iterate over all connected neighbours. |
186 | * | 186 | * |
187 | * @param cb function to call | 187 | * @param cb function to call |
188 | * @param cb_cls closure for cb | 188 | * @param cb_cls closure for @a cb |
189 | */ | 189 | */ |
190 | void | 190 | void |
191 | GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls); | 191 | GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls); |
@@ -196,7 +196,7 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls); | |||
196 | * | 196 | * |
197 | * @param peer identity of the peer where the session died | 197 | * @param peer identity of the peer where the session died |
198 | * @param session session that is gone | 198 | * @param session session that is gone |
199 | * @return GNUNET_YES if this was a session used, GNUNET_NO if | 199 | * @return #GNUNET_YES if this was a session used, #GNUNET_NO if |
200 | * this session was not in use | 200 | * this session was not in use |
201 | */ | 201 | */ |
202 | int | 202 | int |
@@ -206,25 +206,29 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, | |||
206 | 206 | ||
207 | void | 207 | void |
208 | GST_neighbours_notify_data_recv (const struct GNUNET_PeerIdentity *peer, | 208 | GST_neighbours_notify_data_recv (const struct GNUNET_PeerIdentity *peer, |
209 | const struct GNUNET_HELLO_Address *address, | 209 | const struct GNUNET_HELLO_Address *address, |
210 | struct Session *session, | 210 | struct Session *session, |
211 | const struct GNUNET_MessageHeader *message); | 211 | const struct GNUNET_MessageHeader *message); |
212 | |||
212 | 213 | ||
213 | void | 214 | void |
214 | GST_neighbours_notify_payload_recv (const struct GNUNET_PeerIdentity *peer, | 215 | GST_neighbours_notify_payload_recv (const struct GNUNET_PeerIdentity *peer, |
215 | const struct GNUNET_HELLO_Address *address, | 216 | const struct GNUNET_HELLO_Address *address, |
216 | struct Session *session, | 217 | struct Session *session, |
217 | const struct GNUNET_MessageHeader *message); | 218 | const struct GNUNET_MessageHeader *message); |
219 | |||
218 | 220 | ||
219 | void | 221 | void |
220 | GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer, | 222 | GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer, |
221 | size_t size); | 223 | size_t size); |
224 | |||
222 | 225 | ||
223 | void | 226 | void |
224 | GST_neighbours_notify_data_sent (const struct GNUNET_PeerIdentity *peer, | 227 | GST_neighbours_notify_data_sent (const struct GNUNET_PeerIdentity *peer, |
225 | const struct GNUNET_HELLO_Address *address, | 228 | const struct GNUNET_HELLO_Address *address, |
226 | struct Session *session, | 229 | struct Session *session, |
227 | size_t size); | 230 | size_t size); |
231 | |||
228 | 232 | ||
229 | /** | 233 | /** |
230 | * For an existing neighbour record, set the active connection to | 234 | * For an existing neighbour record, set the active connection to |
@@ -241,12 +245,12 @@ GST_neighbours_notify_data_sent (const struct GNUNET_PeerIdentity *peer, | |||
241 | */ | 245 | */ |
242 | void | 246 | void |
243 | GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | 247 | GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, |
244 | const struct GNUNET_HELLO_Address | 248 | const struct GNUNET_HELLO_Address *address, |
245 | *address, struct Session *session, | 249 | struct Session *session, |
246 | const struct GNUNET_ATS_Information *ats, | 250 | const struct GNUNET_ATS_Information *ats, |
247 | uint32_t ats_count, | 251 | uint32_t ats_count, |
248 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 252 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
249 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out); | 253 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out); |
250 | 254 | ||
251 | 255 | ||
252 | /** | 256 | /** |
@@ -258,8 +262,9 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
258 | * @param address address of the other peer, NULL if other peer | 262 | * @param address address of the other peer, NULL if other peer |
259 | * connected to us | 263 | * connected to us |
260 | * @param session session to use (or NULL) | 264 | * @param session session to use (or NULL) |
265 | * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error | ||
261 | */ | 266 | */ |
262 | void | 267 | int |
263 | GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | 268 | GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, |
264 | const struct GNUNET_PeerIdentity *peer, | 269 | const struct GNUNET_PeerIdentity *peer, |
265 | const struct GNUNET_HELLO_Address *address, | 270 | const struct GNUNET_HELLO_Address *address, |
@@ -275,8 +280,9 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
275 | * @param address address of the other peer, NULL if other peer | 280 | * @param address address of the other peer, NULL if other peer |
276 | * connected to us | 281 | * connected to us |
277 | * @param session session to use (or NULL) | 282 | * @param session session to use (or NULL) |
283 | * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error | ||
278 | */ | 284 | */ |
279 | void | 285 | int |
280 | GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | 286 | GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, |
281 | const struct GNUNET_PeerIdentity *peer, | 287 | const struct GNUNET_PeerIdentity *peer, |
282 | const struct GNUNET_HELLO_Address *address, | 288 | const struct GNUNET_HELLO_Address *address, |
@@ -285,15 +291,17 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
285 | 291 | ||
286 | /** | 292 | /** |
287 | * We received a 'SESSION_ACK' message from the other peer. | 293 | * We received a 'SESSION_ACK' message from the other peer. |
288 | * FIXME: describe what this means! | 294 | * If we sent a 'CONNECT_ACK' last, this means we are now |
295 | * connected. Otherwise, do nothing. | ||
289 | * | 296 | * |
290 | * @param message possibly a 'struct SessionConnectMessage' (check format) | 297 | * @param message possibly a 'struct SessionConnectMessage' (check format) |
291 | * @param peer identity of the peer to switch the address for | 298 | * @param peer identity of the peer to switch the address for |
292 | * @param address address of the other peer, NULL if other peer | 299 | * @param address address of the other peer, NULL if other peer |
293 | * connected to us | 300 | * connected to us |
294 | * @param session session to use (or NULL) | 301 | * @param session session to use (or NULL) |
302 | * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error | ||
295 | */ | 303 | */ |
296 | void | 304 | int |
297 | GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | 305 | GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, |
298 | const struct GNUNET_PeerIdentity *peer, | 306 | const struct GNUNET_PeerIdentity *peer, |
299 | const struct GNUNET_HELLO_Address *address, | 307 | const struct GNUNET_HELLO_Address *address, |