aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 442935993..d41fa6582 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -148,7 +148,7 @@ struct TransportSynMessage
148 * When the keep alive response with type is received, transport service 148 * When the keep alive response with type is received, transport service
149 * will call the respective plugin to update the session timeout 149 * will call the respective plugin to update the session timeout
150 */ 150 */
151struct SessionKeepAliveMessage 151struct GNUNET_ATS_SessionKeepAliveMessage
152{ 152{
153 /** 153 /**
154 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE or 154 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE or
@@ -168,7 +168,7 @@ struct SessionKeepAliveMessage
168 * the other peer should limit transmissions to the indicated 168 * the other peer should limit transmissions to the indicated
169 * quota. 169 * quota.
170 */ 170 */
171struct SessionQuotaMessage 171struct GNUNET_ATS_SessionQuotaMessage
172{ 172{
173 /** 173 /**
174 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA. 174 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA.
@@ -188,7 +188,7 @@ struct SessionQuotaMessage
188 * notification, peers must not rely on always receiving disconnect 188 * notification, peers must not rely on always receiving disconnect
189 * messages. 189 * messages.
190 */ 190 */
191struct SessionDisconnectMessage 191struct GNUNET_ATS_SessionDisconnectMessage
192{ 192{
193 /** 193 /**
194 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT 194 * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT
@@ -284,7 +284,7 @@ struct NeighbourAddress
284 /** 284 /**
285 * Active session for this address. 285 * Active session for this address.
286 */ 286 */
287 struct Session *session; 287 struct GNUNET_ATS_Session *session;
288 288
289 /** 289 /**
290 * Network-level address information. 290 * Network-level address information.
@@ -819,7 +819,7 @@ set_state_and_timeout (struct NeighbourMapEntry *n,
819static void 819static void
820set_alternative_address (struct NeighbourMapEntry *n, 820set_alternative_address (struct NeighbourMapEntry *n,
821 const struct GNUNET_HELLO_Address *address, 821 const struct GNUNET_HELLO_Address *address,
822 struct Session *session, 822 struct GNUNET_ATS_Session *session,
823 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 823 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
824 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 824 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
825{ 825{
@@ -1063,12 +1063,12 @@ send_disconnect_cont (void *cls,
1063static void 1063static void
1064send_disconnect (struct NeighbourMapEntry *n) 1064send_disconnect (struct NeighbourMapEntry *n)
1065{ 1065{
1066 struct SessionDisconnectMessage disconnect_msg; 1066 struct GNUNET_ATS_SessionDisconnectMessage disconnect_msg;
1067 1067
1068 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1068 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1069 "Sending DISCONNECT message to peer `%4s'\n", 1069 "Sending DISCONNECT message to peer `%4s'\n",
1070 GNUNET_i2s (&n->id)); 1070 GNUNET_i2s (&n->id));
1071 disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage)); 1071 disconnect_msg.header.size = htons (sizeof (struct GNUNET_ATS_SessionDisconnectMessage));
1072 disconnect_msg.header.type = 1072 disconnect_msg.header.type =
1073 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT); 1073 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
1074 disconnect_msg.reserved = htonl (0); 1074 disconnect_msg.reserved = htonl (0);
@@ -1196,9 +1196,9 @@ set_incoming_quota (struct NeighbourMapEntry *n,
1196 quota); 1196 quota);
1197 if (0 != ntohl (quota.value__)) 1197 if (0 != ntohl (quota.value__))
1198 { 1198 {
1199 struct SessionQuotaMessage sqm; 1199 struct GNUNET_ATS_SessionQuotaMessage sqm;
1200 1200
1201 sqm.header.size = htons (sizeof (struct SessionQuotaMessage)); 1201 sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage));
1202 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA); 1202 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA);
1203 sqm.quota = quota.value__; 1203 sqm.quota = quota.value__;
1204 (void) send_with_session (n, 1204 (void) send_with_session (n,
@@ -1235,7 +1235,7 @@ set_incoming_quota (struct NeighbourMapEntry *n,
1235static void 1235static void
1236set_primary_address (struct NeighbourMapEntry *n, 1236set_primary_address (struct NeighbourMapEntry *n,
1237 const struct GNUNET_HELLO_Address *address, 1237 const struct GNUNET_HELLO_Address *address,
1238 struct Session *session, 1238 struct GNUNET_ATS_Session *session,
1239 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 1239 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
1240 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 1240 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
1241{ 1241{
@@ -1475,7 +1475,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1475static void 1475static void
1476send_keepalive (struct NeighbourMapEntry *n) 1476send_keepalive (struct NeighbourMapEntry *n)
1477{ 1477{
1478 struct SessionKeepAliveMessage m; 1478 struct GNUNET_ATS_SessionKeepAliveMessage m;
1479 struct GNUNET_TIME_Relative timeout; 1479 struct GNUNET_TIME_Relative timeout;
1480 uint32_t nonce; 1480 uint32_t nonce;
1481 1481
@@ -1493,7 +1493,7 @@ send_keepalive (struct NeighbourMapEntry *n)
1493 "Sending KEEPALIVE to peer `%s' with nonce %u\n", 1493 "Sending KEEPALIVE to peer `%s' with nonce %u\n",
1494 GNUNET_i2s (&n->id), 1494 GNUNET_i2s (&n->id),
1495 nonce); 1495 nonce);
1496 m.header.size = htons (sizeof (struct SessionKeepAliveMessage)); 1496 m.header.size = htons (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage));
1497 m.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); 1497 m.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
1498 m.nonce = htonl (nonce); 1498 m.nonce = htonl (nonce);
1499 1499
@@ -1527,16 +1527,16 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
1527 const struct GNUNET_MessageHeader *m) 1527 const struct GNUNET_MessageHeader *m)
1528{ 1528{
1529 struct NeighbourMapEntry *n; 1529 struct NeighbourMapEntry *n;
1530 const struct SessionKeepAliveMessage *msg_in; 1530 const struct GNUNET_ATS_SessionKeepAliveMessage *msg_in;
1531 struct SessionKeepAliveMessage msg; 1531 struct GNUNET_ATS_SessionKeepAliveMessage msg;
1532 1532
1533 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) 1533 if (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
1534 { 1534 {
1535 GNUNET_break_op (0); 1535 GNUNET_break_op (0);
1536 return; 1536 return;
1537 } 1537 }
1538 1538
1539 msg_in = (const struct SessionKeepAliveMessage *) m; 1539 msg_in = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
1540 if (NULL == (n = lookup_neighbour (neighbour))) 1540 if (NULL == (n = lookup_neighbour (neighbour)))
1541 { 1541 {
1542 GNUNET_STATISTICS_update (GST_stats, 1542 GNUNET_STATISTICS_update (GST_stats,
@@ -1564,12 +1564,12 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
1564 GNUNET_NO); 1564 GNUNET_NO);
1565 1565
1566 /* send reply to allow neighbour to measure latency */ 1566 /* send reply to allow neighbour to measure latency */
1567 msg.header.size = htons (sizeof (struct SessionKeepAliveMessage)); 1567 msg.header.size = htons (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage));
1568 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE); 1568 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
1569 msg.nonce = msg_in->nonce; 1569 msg.nonce = msg_in->nonce;
1570 (void) send_with_session (n, 1570 (void) send_with_session (n,
1571 &msg, 1571 &msg,
1572 sizeof (struct SessionKeepAliveMessage), 1572 sizeof (struct GNUNET_ATS_SessionKeepAliveMessage),
1573 UINT32_MAX /* priority */, 1573 UINT32_MAX /* priority */,
1574 GNUNET_TIME_UNIT_FOREVER_REL, 1574 GNUNET_TIME_UNIT_FOREVER_REL,
1575 GNUNET_YES, 1575 GNUNET_YES,
@@ -1590,17 +1590,17 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1590 const struct GNUNET_MessageHeader *m) 1590 const struct GNUNET_MessageHeader *m)
1591{ 1591{
1592 struct NeighbourMapEntry *n; 1592 struct NeighbourMapEntry *n;
1593 const struct SessionKeepAliveMessage *msg; 1593 const struct GNUNET_ATS_SessionKeepAliveMessage *msg;
1594 struct GNUNET_TRANSPORT_PluginFunctions *papi; 1594 struct GNUNET_TRANSPORT_PluginFunctions *papi;
1595 struct GNUNET_TIME_Relative latency; 1595 struct GNUNET_TIME_Relative latency;
1596 1596
1597 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) 1597 if (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
1598 { 1598 {
1599 GNUNET_break_op (0); 1599 GNUNET_break_op (0);
1600 return; 1600 return;
1601 } 1601 }
1602 1602
1603 msg = (const struct SessionKeepAliveMessage *) m; 1603 msg = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
1604 if (NULL == (n = lookup_neighbour (neighbour))) 1604 if (NULL == (n = lookup_neighbour (neighbour)))
1605 { 1605 {
1606 GNUNET_STATISTICS_update (GST_stats, 1606 GNUNET_STATISTICS_update (GST_stats,
@@ -2080,7 +2080,7 @@ send_syn_ack_message (struct NeighbourAddress *na,
2080 struct GNUNET_TIME_Absolute timestamp) 2080 struct GNUNET_TIME_Absolute timestamp)
2081{ 2081{
2082 const struct GNUNET_HELLO_Address *address = na->address; 2082 const struct GNUNET_HELLO_Address *address = na->address;
2083 struct Session *session = na->session; 2083 struct GNUNET_ATS_Session *session = na->session;
2084 struct GNUNET_TRANSPORT_PluginFunctions *papi; 2084 struct GNUNET_TRANSPORT_PluginFunctions *papi;
2085 struct TransportSynMessage connect_msg; 2085 struct TransportSynMessage connect_msg;
2086 struct NeighbourMapEntry *n; 2086 struct NeighbourMapEntry *n;
@@ -2267,7 +2267,7 @@ static void
2267try_connect_bl_check_cont (void *cls, 2267try_connect_bl_check_cont (void *cls,
2268 const struct GNUNET_PeerIdentity *peer, 2268 const struct GNUNET_PeerIdentity *peer,
2269 const struct GNUNET_HELLO_Address *address, 2269 const struct GNUNET_HELLO_Address *address,
2270 struct Session *session, 2270 struct GNUNET_ATS_Session *session,
2271 int result) 2271 int result)
2272{ 2272{
2273 struct BlacklistCheckSwitchContext *blc_ctx = cls; 2273 struct BlacklistCheckSwitchContext *blc_ctx = cls;
@@ -2534,7 +2534,7 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message,
2534 */ 2534 */
2535static int 2535static int
2536try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, 2536try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
2537 struct Session *session, 2537 struct GNUNET_ATS_Session *session,
2538 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 2538 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
2539 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 2539 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
2540{ 2540{
@@ -2589,7 +2589,7 @@ static void
2589switch_address_bl_check_cont (void *cls, 2589switch_address_bl_check_cont (void *cls,
2590 const struct GNUNET_PeerIdentity *peer, 2590 const struct GNUNET_PeerIdentity *peer,
2591 const struct GNUNET_HELLO_Address *address, 2591 const struct GNUNET_HELLO_Address *address,
2592 struct Session *session, 2592 struct GNUNET_ATS_Session *session,
2593 int result) 2593 int result)
2594{ 2594{
2595 struct BlacklistCheckSwitchContext *blc_ctx = cls; 2595 struct BlacklistCheckSwitchContext *blc_ctx = cls;
@@ -2882,7 +2882,7 @@ switch_address_bl_check_cont (void *cls,
2882 */ 2882 */
2883void 2883void
2884GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address, 2884GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address,
2885 struct Session *session, 2885 struct GNUNET_ATS_Session *session,
2886 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 2886 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
2887 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 2887 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
2888{ 2888{
@@ -3042,7 +3042,7 @@ GST_neighbours_notify_data_recv (const struct GNUNET_HELLO_Address *address,
3042 */ 3042 */
3043void 3043void
3044GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address, 3044GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
3045 struct Session *session, 3045 struct GNUNET_ATS_Session *session,
3046 size_t size) 3046 size_t size)
3047{ 3047{
3048 struct NeighbourMapEntry *n; 3048 struct NeighbourMapEntry *n;
@@ -3240,7 +3240,7 @@ send_session_ack_message (struct NeighbourMapEntry *n)
3240 * We received a 'SESSION_SYN_ACK' message from the other peer. 3240 * We received a 'SESSION_SYN_ACK' message from the other peer.
3241 * Consider switching to it. 3241 * Consider switching to it.
3242 * 3242 *
3243 * @param message possibly a `struct SessionConnectMessage` (check format) 3243 * @param message possibly a `struct GNUNET_ATS_SessionConnectMessage` (check format)
3244 * @param peer identity of the peer to switch the address for 3244 * @param peer identity of the peer to switch the address for
3245 * @param address address of the other peer, NULL if other peer 3245 * @param address address of the other peer, NULL if other peer
3246 * connected to us 3246 * connected to us
@@ -3250,7 +3250,7 @@ send_session_ack_message (struct NeighbourMapEntry *n)
3250int 3250int
3251GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *message, 3251GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *message,
3252 const struct GNUNET_HELLO_Address *address, 3252 const struct GNUNET_HELLO_Address *address,
3253 struct Session *session) 3253 struct GNUNET_ATS_Session *session)
3254{ 3254{
3255 const struct TransportSynMessage *scm; 3255 const struct TransportSynMessage *scm;
3256 struct GNUNET_TIME_Absolute ts; 3256 struct GNUNET_TIME_Absolute ts;
@@ -3391,7 +3391,7 @@ GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *messag
3391 */ 3391 */
3392int 3392int
3393GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, 3393GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3394 struct Session *session) 3394 struct GNUNET_ATS_Session *session)
3395{ 3395{
3396 struct NeighbourMapEntry *n; 3396 struct NeighbourMapEntry *n;
3397 struct BlackListCheckContext *bcc; 3397 struct BlackListCheckContext *bcc;
@@ -3539,7 +3539,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3539 * If we sent a 'SYN_ACK' last, this means we are now 3539 * If we sent a 'SYN_ACK' last, this means we are now
3540 * connected. Otherwise, do nothing. 3540 * connected. Otherwise, do nothing.
3541 * 3541 *
3542 * @param message possibly a 'struct SessionConnectMessage' (check format) 3542 * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check format)
3543 * @param address address of the other peer 3543 * @param address address of the other peer
3544 * @param session session to use (or NULL) 3544 * @param session session to use (or NULL)
3545 * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error 3545 * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
@@ -3547,7 +3547,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3547int 3547int
3548GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, 3548GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3549 const struct GNUNET_HELLO_Address *address, 3549 const struct GNUNET_HELLO_Address *address,
3550 struct Session *session) 3550 struct GNUNET_ATS_Session *session)
3551{ 3551{
3552 struct NeighbourMapEntry *n; 3552 struct NeighbourMapEntry *n;
3553 3553
@@ -3673,12 +3673,12 @@ GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer,
3673 const struct GNUNET_MessageHeader *msg) 3673 const struct GNUNET_MessageHeader *msg)
3674{ 3674{
3675 struct NeighbourMapEntry *n; 3675 struct NeighbourMapEntry *n;
3676 const struct SessionQuotaMessage *sqm; 3676 const struct GNUNET_ATS_SessionQuotaMessage *sqm;
3677 3677
3678 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3678 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3679 "Received QUOTA message from peer `%s'\n", 3679 "Received QUOTA message from peer `%s'\n",
3680 GNUNET_i2s (peer)); 3680 GNUNET_i2s (peer));
3681 if (ntohs (msg->size) != sizeof (struct SessionQuotaMessage)) 3681 if (ntohs (msg->size) != sizeof (struct GNUNET_ATS_SessionQuotaMessage))
3682 { 3682 {
3683 GNUNET_break_op (0); 3683 GNUNET_break_op (0);
3684 GNUNET_STATISTICS_update (GST_stats, 3684 GNUNET_STATISTICS_update (GST_stats,
@@ -3691,7 +3691,7 @@ GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer,
3691 gettext_noop 3691 gettext_noop
3692 ("# QUOTA messages received"), 3692 ("# QUOTA messages received"),
3693 1, GNUNET_NO); 3693 1, GNUNET_NO);
3694 sqm = (const struct SessionQuotaMessage *) msg; 3694 sqm = (const struct GNUNET_ATS_SessionQuotaMessage *) msg;
3695 if (NULL == (n = lookup_neighbour (peer))) 3695 if (NULL == (n = lookup_neighbour (peer)))
3696 { 3696 {
3697 /* gone already */ 3697 /* gone already */
@@ -3716,12 +3716,12 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity *peer
3716 const struct GNUNET_MessageHeader *msg) 3716 const struct GNUNET_MessageHeader *msg)
3717{ 3717{
3718 struct NeighbourMapEntry *n; 3718 struct NeighbourMapEntry *n;
3719 const struct SessionDisconnectMessage *sdm; 3719 const struct GNUNET_ATS_SessionDisconnectMessage *sdm;
3720 3720
3721 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3721 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3722 "Received DISCONNECT message from peer `%s'\n", 3722 "Received DISCONNECT message from peer `%s'\n",
3723 GNUNET_i2s (peer)); 3723 GNUNET_i2s (peer));
3724 if (ntohs (msg->size) != sizeof (struct SessionDisconnectMessage)) 3724 if (ntohs (msg->size) != sizeof (struct GNUNET_ATS_SessionDisconnectMessage))
3725 { 3725 {
3726 GNUNET_break_op (0); 3726 GNUNET_break_op (0);
3727 GNUNET_STATISTICS_update (GST_stats, 3727 GNUNET_STATISTICS_update (GST_stats,
@@ -3735,7 +3735,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity *peer
3735 gettext_noop 3735 gettext_noop
3736 ("# DISCONNECT messages received"), 3736 ("# DISCONNECT messages received"),
3737 1, GNUNET_NO); 3737 1, GNUNET_NO);
3738 sdm = (const struct SessionDisconnectMessage *) msg; 3738 sdm = (const struct GNUNET_ATS_SessionDisconnectMessage *) msg;
3739 if (NULL == (n = lookup_neighbour (peer))) 3739 if (NULL == (n = lookup_neighbour (peer)))
3740 { 3740 {
3741 /* gone already */ 3741 /* gone already */