aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-09 13:21:48 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-09 13:21:48 +0000
commitb9e7bbea6e7628e77fdbcfdd6832587a07d43658 (patch)
tree2b885562e701d3cc5c11ec07d2051b08ed4c05bf /src/transport
parentf0ac323a4bae4dd87c96bf6d2e9980ec9952df8b (diff)
downloadgnunet-b9e7bbea6e7628e77fdbcfdd6832587a07d43658.tar.gz
gnunet-b9e7bbea6e7628e77fdbcfdd6832587a07d43658.zip
misc train hacking
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport-new.c3
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c2
-rw-r--r--src/transport/gnunet-service-transport_clients.c2
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c37
-rw-r--r--src/transport/gnunet-service-transport_plugins.c1
-rw-r--r--src/transport/gnunet-service-transport_validation.c9
-rw-r--r--src/transport/gnunet-service-transport_validation.h2
-rw-r--r--src/transport/plugin_transport_udp.c15
8 files changed, 40 insertions, 31 deletions
diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c
index f4a39a1e6..4b1becacd 100644
--- a/src/transport/gnunet-service-transport-new.c
+++ b/src/transport/gnunet-service-transport-new.c
@@ -201,7 +201,8 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
201 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: 201 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT:
202 (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed, 202 (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed,
203 NULL); 203 NULL);
204 /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred 204 /* TODO: if 'session != NULL', and timestamp more recent than the
205 previous one, maybe notify ATS that this is now the preferred
205 * way to communicate with this peer (other peer switched transport) */ 206 * way to communicate with this peer (other peer switched transport) */
206 break; 207 break;
207 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: 208 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 36abbf85c..a73aa17c1 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -547,7 +547,7 @@ struct TestConnectionContext
547 * blacklisting client. 547 * blacklisting client.
548 * 548 *
549 * @param cls the 'struct TestConnectionContest' 549 * @param cls the 'struct TestConnectionContest'
550 * @param pid neighbour's identity 550 * @param neighbour neighbour's identity
551 * @param ats performance data 551 * @param ats performance data
552 * @param ats_count number of entries in ats (excluding 0-termination) 552 * @param ats_count number of entries in ats (excluding 0-termination)
553 */ 553 */
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 8676f335e..7e519a547 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -228,7 +228,7 @@ transmit_to_client_callback (void *cls, size_t size, void *buf)
228/** 228/**
229 * Queue the given message for transmission to the given client 229 * Queue the given message for transmission to the given client
230 * 230 *
231 * @param client target of the message 231 * @param tc target of the message
232 * @param msg message to transmit 232 * @param msg message to transmit
233 * @param may_drop GNUNET_YES if the message can be dropped 233 * @param may_drop GNUNET_YES if the message can be dropped
234 */ 234 */
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 9c6aaba67..6e3ee8a71 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -51,6 +51,32 @@
51 */ 51 */
52struct NeighbourMapEntry; 52struct NeighbourMapEntry;
53 53
54/**
55 * Message a peer sends to another to indicate its
56 * preference for communicating via a particular
57 * session (and the desire to establish a real
58 * connection).
59 */
60struct SessionConnectMessage
61{
62 /**
63 * Header of type 'GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT'
64 */
65 struct GNUNET_MessageHeader header;
66
67 /**
68 * Always zero.
69 */
70 uint32_t reserved GNUNET_PACKED;
71
72 /**
73 * Absolute time at the sender. Only the most recent connect
74 * message implies which session is preferred by the sender.
75 */
76 struct GNUNET_TIME_AbsoluteNBO timestamp;
77
78};
79
54 80
55/** 81/**
56 * For each neighbour we keep a list of messages 82 * For each neighbour we keep a list of messages
@@ -288,7 +314,7 @@ transmit_send_continuation (void *cls,
288 * Check the ready list for the given neighbour and if a plugin is 314 * Check the ready list for the given neighbour and if a plugin is
289 * ready for transmission (and if we have a message), do so! 315 * ready for transmission (and if we have a message), do so!
290 * 316 *
291 * @param neighbour target peer for which to transmit 317 * @param n target peer for which to transmit
292 */ 318 */
293static void 319static void
294try_transmission_to_peer (struct NeighbourMapEntry *n) 320try_transmission_to_peer (struct NeighbourMapEntry *n)
@@ -520,7 +546,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
520 *ats, uint32_t ats_count) 546 *ats, uint32_t ats_count)
521{ 547{
522 struct NeighbourMapEntry *n; 548 struct NeighbourMapEntry *n;
523 struct GNUNET_MessageHeader connect_msg; 549 struct SessionConnectMessage connect_msg;
524 550
525 GNUNET_assert (neighbours != NULL); 551 GNUNET_assert (neighbours != NULL);
526 552
@@ -555,8 +581,10 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
555 n->timeout_task = 581 n->timeout_task =
556 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 582 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
557 &neighbour_timeout_task, n); 583 &neighbour_timeout_task, n);
558 connect_msg.size = htons (sizeof (struct GNUNET_MessageHeader)); 584 connect_msg.header.size = htons (sizeof (struct SessionConnectMessage));
559 connect_msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); 585 connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
586 connect_msg.reserved = htonl (0);
587 connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
560 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), 588 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg),
561 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); 589 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL);
562} 590}
@@ -570,6 +598,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
570 * @param plugin_name name of the plugin 598 * @param plugin_name name of the plugin
571 * @param plugin_address binary address 599 * @param plugin_address binary address
572 * @param plugin_address_len length of address 600 * @param plugin_address_len length of address
601 * @param session session to use
573 * @param bandwidth available bandwidth 602 * @param bandwidth available bandwidth
574 * @param ats performance data for the address (as far as known) 603 * @param ats performance data for the address (as far as known)
575 * @param ats_count number of performance records in 'ats' 604 * @param ats_count number of performance records in 'ats'
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index 12ee231c4..52fcf661d 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -87,7 +87,6 @@ static struct TransportPlugin *plugins_tail;
87 * 87 *
88 * @param recv_cb function to call when data is received 88 * @param recv_cb function to call when data is received
89 * @param address_cb function to call when our public addresses changed 89 * @param address_cb function to call when our public addresses changed
90 * @param traffic_cb function to call for flow control
91 * @param session_end_cb function to call when a session was terminated 90 * @param session_end_cb function to call when a session was terminated
92 */ 91 */
93void 92void
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 56b4037b4..57fa86260 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -335,9 +335,6 @@ validation_entry_match (void *cls, const GNUNET_HashCode * key, void *value)
335 * @param public_key public key of the peer, NULL for unknown 335 * @param public_key public key of the peer, NULL for unknown
336 * @param neighbour which peer we care about 336 * @param neighbour which peer we care about
337 * @param tname name of the transport plugin 337 * @param tname name of the transport plugin
338 * @param session session to look for, NULL for 'any'; otherwise
339 * can be used for the service to "learn" this session ID
340 * if 'addr' matches
341 * @param addr binary address 338 * @param addr binary address
342 * @param addrlen length of addr 339 * @param addrlen length of addr
343 * @return validation entry matching the given specifications, NULL 340 * @return validation entry matching the given specifications, NULL
@@ -425,7 +422,7 @@ add_valid_address (void *cls, const char *tname,
425 * @param cls unused 422 * @param cls unused
426 * @param peer id of the peer, NULL for last call 423 * @param peer id of the peer, NULL for last call
427 * @param hello hello message for the peer (can be NULL) 424 * @param hello hello message for the peer (can be NULL)
428 * @param error message 425 * @param err_msg error message
429 */ 426 */
430static void 427static void
431process_peerinfo_hello (void *cls, const struct GNUNET_PeerIdentity *peer, 428process_peerinfo_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
@@ -1077,12 +1074,8 @@ iterate_addresses (void *cls, const GNUNET_HashCode * key, void *value)
1077 * Can either give a snapshot (synchronous API) or be continuous. 1074 * Can either give a snapshot (synchronous API) or be continuous.
1078 * 1075 *
1079 * @param target peer information is requested for 1076 * @param target peer information is requested for
1080 * @param snapshot_only GNUNET_YES to iterate over addresses once, GNUNET_NO to
1081 * continue to give information about addresses as it evolves
1082 * @param cb function to call; will not be called after this function returns 1077 * @param cb function to call; will not be called after this function returns
1083 * if snapshot_only is GNUNET_YES
1084 * @param cb_cls closure for 'cb' 1078 * @param cb_cls closure for 'cb'
1085 * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES
1086 */ 1079 */
1087void 1080void
1088GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, 1081GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h
index 1840c0919..06370161c 100644
--- a/src/transport/gnunet-service-transport_validation.h
+++ b/src/transport/gnunet-service-transport_validation.h
@@ -122,9 +122,7 @@ typedef void (*GST_ValidationAddressCallback) (void *cls,
122 * 122 *
123 * @param target peer information is requested for 123 * @param target peer information is requested for
124 * @param cb function to call; will not be called after this function returns 124 * @param cb function to call; will not be called after this function returns
125 * if snapshot_only is GNUNET_YES
126 * @param cb_cls closure for 'cb' 125 * @param cb_cls closure for 'cb'
127 * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES
128 */ 126 */
129void 127void
130GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, 128GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index cced16ffd..3a69273c5 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -335,19 +335,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
335 * Actually send out the message. 335 * Actually send out the message.
336 * 336 *
337 * @param plugin the plugin 337 * @param plugin the plugin
338 * @param send_handle which handle to send message on 338 * @param sa the address to send the message to
339 * @param target who should receive this message (ignored by UDP) 339 * @param msg message to transmit
340 * @param msgbuf one or more GNUNET_MessageHeader(s) strung together
341 * @param msgbuf_size the size of the msgbuf to send
342 * @param priority how important is the message (ignored by UDP)
343 * @param timeout when should we time out (give up) if we can not transmit?
344 * @param addr the addr to send the message to, needs to be a sockaddr for us
345 * @param addrlen the len of addr
346 * @param cont continuation to call once the message has
347 * been transmitted (or if the transport is ready
348 * for the next transmission call; or if the
349 * peer disconnected...)
350 * @param cont_cls closure for cont
351 * @return the number of bytes written 340 * @return the number of bytes written
352 */ 341 */
353static ssize_t 342static ssize_t