diff options
-rw-r--r-- | src/include/gnunet_transport_service.h | 50 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 35 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.h | 12 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 13 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.h | 17 |
5 files changed, 57 insertions, 70 deletions
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 5eab5c929..a2f1e07b7 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -45,53 +45,53 @@ extern "C" | |||
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Possible state of a neighbour. Initially, we are #S_NOT_CONNECTED. | 48 | * Possible state of a neighbour. Initially, we are #GNUNET_TRANSPORT_PS_NOT_CONNECTED. |
49 | * | 49 | * |
50 | * Then, there are two main paths. If we receive a CONNECT message, we | 50 | * Then, there are two main paths. If we receive a CONNECT message, we |
51 | * first run a check against the blacklist (#S_CONNECT_RECV_BLACKLIST_INBOUND). | 51 | * first run a check against the blacklist (#GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST_INBOUND). |
52 | * If this check is successful, we give the inbound address to ATS. | 52 | * If this check is successful, we give the inbound address to ATS. |
53 | * After the check we ask ATS for a suggestion (S_CONNECT_RECV_ATS). | 53 | * After the check we ask ATS for a suggestion (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). |
54 | * If ATS makes a suggestion, we ALSO give that suggestion to the blacklist | 54 | * If ATS makes a suggestion, we ALSO give that suggestion to the blacklist |
55 | * (#S_CONNECT_RECV_BLACKLIST). Once the blacklist approves the | 55 | * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST). Once the blacklist approves the |
56 | * address we got from ATS, we send our CONNECT_ACK and go to | 56 | * address we got from ATS, we send our CONNECT_ACK and go to |
57 | * #S_CONNECT_RECV_ACK. If we receive a SESSION_ACK, we go to | 57 | * #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK. If we receive a SESSION_ACK, we go to |
58 | * #S_CONNECTED (and notify everyone about the new connection). If the | 58 | * #GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection). |
59 | * operation times out, we go to #S_DISCONNECT. | 59 | * If the operation times out, we go to #GNUNET_TRANSPORT_PS_DISCONNECT. |
60 | * | 60 | * |
61 | * The other case is where we transmit a CONNECT message first. We | 61 | * The other case is where we transmit a CONNECT message first. We |
62 | * start with #S_INIT_ATS. If we get an address, we enter | 62 | * start with #GNUNET_TRANSPORT_PS_INIT_ATS. If we get an address, we enter |
63 | * #S_INIT_BLACKLIST and check the blacklist. If the blacklist is OK | 63 | * #GNUNET_TRANSPORT_PS_INIT_BLACKLIST and check the blacklist. If the blacklist is OK |
64 | * with the connection, we actually send the CONNECT message and go to | 64 | * with the connection, we actually send the CONNECT message and go to |
65 | * state S_CONNECT_SENT. Once we receive a CONNECT_ACK, we go to | 65 | * state #GNUNET_TRANSPORT_PS_CONNECT_SENT. Once we receive a CONNECT_ACK, we go to |
66 | * #S_CONNECTED (and notify everyone about the new connection and send | 66 | * #GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection and send |
67 | * back a SESSION_ACK). If the operation times out, we go to | 67 | * back a SESSION_ACK). If the operation times out, we go to |
68 | * #S_DISCONNECT. | 68 | * #GNUNET_TRANSPORT_PS_DISCONNECT. |
69 | * | 69 | * |
70 | * If the session is in trouble (i.e. transport-level disconnect or | 70 | * If the session is in trouble (i.e. transport-level disconnect or |
71 | * timeout), we go to #S_RECONNECT_ATS where we ask ATS for a new | 71 | * timeout), we go to #GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a new |
72 | * address (we don't notify anyone about the disconnect yet). Once we | 72 | * address (we don't notify anyone about the disconnect yet). Once we |
73 | * have a new address, we go to #S_RECONNECT_BLACKLIST to check the new | 73 | * have a new address, we go to #GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST to check the new |
74 | * address against the blacklist. If the blacklist approves, we enter | 74 | * address against the blacklist. If the blacklist approves, we enter |
75 | * #S_RECONNECT_SENT and send a CONNECT message. If we receive a | 75 | * #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a CONNECT message. If we receive a |
76 | * CONNECT_ACK, we go to #S_CONNECTED and nobody noticed that we had | 76 | * CONNECT_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED and nobody noticed that we had |
77 | * trouble; we also send a SESSION_ACK at this time just in case. If | 77 | * trouble; we also send a SESSION_ACK at this time just in case. If |
78 | * the operation times out, we go to S_DISCONNECT (and notify everyone | 78 | * the operation times out, we go to #GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone |
79 | * about the lost connection). | 79 | * about the lost connection). |
80 | * | 80 | * |
81 | * If ATS decides to switch addresses while we have a normal | 81 | * If ATS decides to switch addresses while we have a normal |
82 | * connection, we go to #S_CONNECTED_SWITCHING_BLACKLIST to check the | 82 | * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST to check the |
83 | * new address against the blacklist. If the blacklist approves, we | 83 | * new address against the blacklist. If the blacklist approves, we |
84 | * go to #S_CONNECTED_SWITCHING_CONNECT_SENT and send a | 84 | * go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT and send a |
85 | * SESSION_CONNECT. If we get a SESSION_ACK back, we switch the | 85 | * SESSION_CONNECT. If we get a SESSION_ACK back, we switch the |
86 | * primary connection to the suggested alternative from ATS, go back | 86 | * primary connection to the suggested alternative from ATS, go back |
87 | * to #S_CONNECTED and send a SESSION_ACK to the other peer just to be | 87 | * to #GNUNET_TRANSPORT_PS_CONNECTED and send a SESSION_ACK to the other peer just to be |
88 | * sure. If the operation times out (or the blacklist disapproves), | 88 | * sure. If the operation times out (or the blacklist disapproves), |
89 | * we go to #S_CONNECTED (and notify ATS that the given alternative | 89 | * we go to #GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given alternative |
90 | * address is "invalid"). | 90 | * address is "invalid"). |
91 | * | 91 | * |
92 | * Once a session is in #S_DISCONNECT, it is cleaned up and then goes | 92 | * Once a session is in #GNUNET_TRANSPORT_PS_DISCONNECT, it is cleaned up and then goes |
93 | * to (#S_DISCONNECT_FINISHED). If we receive an explicit disconnect | 93 | * to (#GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED). If we receive an explicit disconnect |
94 | * request, we can go from any state to #S_DISCONNECT, possibly after | 94 | * request, we can go from any state to #GNUNET_TRANSPORT_PS_DISCONNECT, possibly after |
95 | * generating disconnect notifications. | 95 | * generating disconnect notifications. |
96 | * | 96 | * |
97 | * Note that it is quite possible that while we are in any of these | 97 | * Note that it is quite possible that while we are in any of these |
@@ -101,7 +101,7 @@ extern "C" | |||
101 | * set to 1. If our state machine allows us to send a 'CONNECT_ACK' | 101 | * set to 1. If our state machine allows us to send a 'CONNECT_ACK' |
102 | * (because we have an acceptable address), we send the 'CONNECT_ACK' | 102 | * (because we have an acceptable address), we send the 'CONNECT_ACK' |
103 | * and set the 'send_connect_ack' to 2. If we then receive a | 103 | * and set the 'send_connect_ack' to 2. If we then receive a |
104 | * 'SESSION_ACK', we go to #S_CONNECTED (and reset 'send_connect_ack' | 104 | * 'SESSION_ACK', we go to #GNUNET_TRANSPORT_PS_CONNECTED (and reset 'send_connect_ack' |
105 | * to 0). | 105 | * to 0). |
106 | * | 106 | * |
107 | */ | 107 | */ |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 66f177145..76a398dc9 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -267,18 +267,12 @@ kill_session (const char *plugin_name, struct Session *session) | |||
267 | * Function called by the transport for each received message. | 267 | * Function called by the transport for each received message. |
268 | * | 268 | * |
269 | * @param cls closure, const char* with the name of the plugin we received the message from | 269 | * @param cls closure, const char* with the name of the plugin we received the message from |
270 | * @param peer (claimed) identity of the other peer | 270 | * @param address address and (claimed) identity of the other peer |
271 | * @param message the message, NULL if we only care about | 271 | * @param message the message, NULL if we only care about |
272 | * learning about the delay until we should receive again | 272 | * learning about the delay until we should receive again |
273 | * @param session identifier used for this session (NULL for plugins | 273 | * @param session identifier used for this session (NULL for plugins |
274 | * that do not offer bi-directional communication to the sender | 274 | * that do not offer bi-directional communication to the sender |
275 | * using the same "connection") | 275 | * using the same "connection") |
276 | * @param sender_address binary address of the sender (if we established the | ||
277 | * connection or are otherwise sure of it; should be NULL | ||
278 | * for inbound TCP/UDP connections since it it not clear | ||
279 | * that we could establish ourselves a connection to that | ||
280 | * IP address and get the same system) | ||
281 | * @param sender_address_len number of bytes in @a sender_address | ||
282 | * @return how long the plugin should wait until receiving more data | 276 | * @return how long the plugin should wait until receiving more data |
283 | * (plugins that do not support this, can ignore the return value) | 277 | * (plugins that do not support this, can ignore the return value) |
284 | */ | 278 | */ |
@@ -579,13 +573,10 @@ GST_ats_update_metrics (const struct GNUNET_PeerIdentity *peer, | |||
579 | } | 573 | } |
580 | 574 | ||
581 | /** | 575 | /** |
582 | * Function that will be called to figure if an address is an loopback, | 576 | * Function that will be called to update metrics for an address |
583 | * LAN, WAN etc. address | ||
584 | * | 577 | * |
585 | * @param cls closure | 578 | * @param cls closure |
586 | * @param peer the peer | 579 | * @param address address to update metrics for |
587 | * @param address binary address | ||
588 | * @param address_len length of the @a address | ||
589 | * @param session the session | 580 | * @param session the session |
590 | * @param ats the ats information to update | 581 | * @param ats the ats information to update |
591 | * @param ats_count the number of @a ats elements | 582 | * @param ats_count the number of @a ats elements |
@@ -649,6 +640,7 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address, | |||
649 | * actually happened. | 640 | * actually happened. |
650 | * | 641 | * |
651 | * @param cls closure | 642 | * @param cls closure |
643 | * @param peer the peer this address is intended for | ||
652 | * @param address address to use (for peer given in address) | 644 | * @param address address to use (for peer given in address) |
653 | * @param session session to use (if available) | 645 | * @param session session to use (if available) |
654 | * @param bandwidth_out assigned outbound bandwidth for the connection in NBO, | 646 | * @param bandwidth_out assigned outbound bandwidth for the connection in NBO, |
@@ -659,11 +651,14 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address, | |||
659 | * @param ats_count number of @a ats elements | 651 | * @param ats_count number of @a ats elements |
660 | */ | 652 | */ |
661 | static void | 653 | static void |
662 | ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, | 654 | ats_request_address_change (void *cls, |
663 | const struct GNUNET_HELLO_Address *address, struct Session *session, | 655 | const struct GNUNET_PeerIdentity *peer, |
656 | const struct GNUNET_HELLO_Address *address, | ||
657 | struct Session *session, | ||
664 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 658 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
665 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 659 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
666 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | 660 | const struct GNUNET_ATS_Information *ats, |
661 | uint32_t ats_count) | ||
667 | { | 662 | { |
668 | uint32_t bw_in = ntohl (bandwidth_in.value__); | 663 | uint32_t bw_in = ntohl (bandwidth_in.value__); |
669 | uint32_t bw_out = ntohl (bandwidth_out.value__); | 664 | uint32_t bw_out = ntohl (bandwidth_out.value__); |
@@ -776,11 +771,11 @@ neighbours_changed_notification (void *cls, | |||
776 | * | 771 | * |
777 | * @param cls closure | 772 | * @param cls closure |
778 | * @param peer peer this update is about (never NULL) | 773 | * @param peer peer this update is about (never NULL) |
779 | * @param address address, NULL on disconnect | 774 | * @param address address (never NULL) |
780 | * @param state current state this peer is in | 775 | * @param last_validation point in time when last validation was performed |
781 | * @param state_timeout timeout for the current state of the peer | 776 | * @param valid_until point in time how long address is valid |
782 | * @param bandwidth_in bandwidth assigned inbound | 777 | * @param next_validation point in time when next validation will be performed |
783 | * @param bandwidth_out bandwidth assigned outbound | 778 | * @param state state of validation notification |
784 | */ | 779 | */ |
785 | static void | 780 | static void |
786 | validation_changed_notification (void *cls, | 781 | validation_changed_notification (void *cls, |
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 34ed61f9e..67456bd46 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h | |||
@@ -82,22 +82,14 @@ typedef void | |||
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Function called by the transport for each received message. | 84 | * Function called by the transport for each received message. |
85 | * This function should also be called with "NULL" for the | ||
86 | * message to signal that the other peer disconnected. | ||
87 | * | 85 | * |
88 | * @param cls closure, const char* with the name of the plugin we received the message from | 86 | * @param cls closure, const char* with the name of the plugin we received the message from |
89 | * @param peer (claimed) identity of the other peer | 87 | * @param address address and (claimed) identity of the other peer |
90 | * @param message the message, NULL if we only care about | 88 | * @param message the message, NULL if we only care about |
91 | * learning about the delay until we should receive again -- FIXME! | 89 | * learning about the delay until we should receive again |
92 | * @param session identifier used for this session (NULL for plugins | 90 | * @param session identifier used for this session (NULL for plugins |
93 | * that do not offer bi-directional communication to the sender | 91 | * that do not offer bi-directional communication to the sender |
94 | * using the same "connection") | 92 | * using the same "connection") |
95 | * @param sender_address binary address of the sender (if we established the | ||
96 | * connection or are otherwise sure of it; should be NULL | ||
97 | * for inbound TCP/UDP connections since it it not clear | ||
98 | * that we could establish ourselves a connection to that | ||
99 | * IP address and get the same system) | ||
100 | * @param sender_address_len number of bytes in sender_address | ||
101 | * @return how long the plugin should wait until receiving more data | 93 | * @return how long the plugin should wait until receiving more data |
102 | * (plugins that do not support this, can ignore the return value) | 94 | * (plugins that do not support this, can ignore the return value) |
103 | */ | 95 | */ |
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index aefe581c7..7b47bb6f5 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -262,6 +262,7 @@ setup_client (struct GNUNET_SERVER_Client *client) | |||
262 | * Find the handle to the monitoring client associated with the given | 262 | * Find the handle to the monitoring client associated with the given |
263 | * client handle | 263 | * client handle |
264 | * | 264 | * |
265 | * @param head the head of the client queue to look in | ||
265 | * @param client server's client handle to look up | 266 | * @param client server's client handle to look up |
266 | * @return handle to the monitoring client | 267 | * @return handle to the monitoring client |
267 | */ | 268 | */ |
@@ -1006,15 +1007,15 @@ struct IterationContext | |||
1006 | }; | 1007 | }; |
1007 | 1008 | ||
1008 | /** | 1009 | /** |
1009 | * Output information of neighbours to the given client. | 1010 | * Output information of validation entries to the given client. |
1010 | * | 1011 | * |
1011 | * @param cls the 'struct PeerIterationContext' | 1012 | * @param cls the 'struct IterationContext' |
1012 | * @param peer identity of the neighbour | 1013 | * @param peer identity of the neighbour |
1013 | * @param address the address | 1014 | * @param address the address |
1014 | * @param state current state this peer is in | 1015 | * @param last_validation point in time when last validation was performed |
1015 | * @param state_timeout timeout for the current state of the peer | 1016 | * @param valid_until point in time how long address is valid |
1016 | * @param bandwidth_in inbound quota in NBO | 1017 | * @param next_validation point in time when next validation will be performed |
1017 | * @param bandwidth_out outbound quota in NBO | 1018 | * @param state state of validation notification |
1018 | */ | 1019 | */ |
1019 | static void | 1020 | static void |
1020 | send_validation_information (void *cls, | 1021 | send_validation_information (void *cls, |
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h index d117faca5..179070454 100644 --- a/src/transport/gnunet-service-transport_validation.h +++ b/src/transport/gnunet-service-transport_validation.h | |||
@@ -32,17 +32,16 @@ | |||
32 | #include "gnunet_hello_lib.h" | 32 | #include "gnunet_hello_lib.h" |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Function called for each address (or address status change) that | 35 | * Function called to notify transport users that a neighbour peer changed its |
36 | * the validation module is aware of (for the given target). | 36 | * active address. |
37 | * | 37 | * |
38 | * @param cls closure | 38 | * @param cls closure |
39 | * @param public_key public key for the peer, never NULL | 39 | * @param peer peer this update is about (never NULL) |
40 | * @param valid_until is ZERO if we never validated the address, | 40 | * @param address address (never NULL) |
41 | * otherwise a time up to when we consider it (or was) valid | 41 | * @param last_validation point in time when last validation was performed |
42 | * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO) | 42 | * @param valid_until point in time how long address is valid |
43 | * is ZERO if the address is considered valid (no validation needed) | 43 | * @param next_validation point in time when next validation will be performed |
44 | * otherwise a time in the future if we're currently denying re-validation | 44 | * @param state state of validation notification |
45 | * @param address the address | ||
46 | */ | 45 | */ |
47 | typedef void (*GST_ValidationChangedCallback) (void *cls, | 46 | typedef void (*GST_ValidationChangedCallback) (void *cls, |
48 | const struct GNUNET_PeerIdentity *peer, | 47 | const struct GNUNET_PeerIdentity *peer, |