aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gnunet-service-core.c')
-rw-r--r--src/core/gnunet-service-core.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 5d262fdc6..010c42a09 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -490,7 +490,7 @@ struct Neighbour
490 /** 490 /**
491 * Performance data for the peer. 491 * Performance data for the peer.
492 */ 492 */
493 struct GNUNET_TRANSPORT_ATS_Information *ats; 493 struct GNUNET_ATS_Information *ats;
494 494
495 /** 495 /**
496 * Identity of the neighbour. 496 * Identity of the neighbour.
@@ -957,7 +957,7 @@ handle_peer_status_change (struct Neighbour *n)
957{ 957{
958 struct PeerStatusNotifyMessage *psnm; 958 struct PeerStatusNotifyMessage *psnm;
959 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1]; 959 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
960 struct GNUNET_TRANSPORT_ATS_Information *ats; 960 struct GNUNET_ATS_Information *ats;
961 size_t size; 961 size_t size;
962 962
963 if ((!n->is_connected) || (n->status != PEER_STATE_KEY_CONFIRMED)) 963 if ((!n->is_connected) || (n->status != PEER_STATE_KEY_CONFIRMED))
@@ -968,7 +968,7 @@ handle_peer_status_change (struct Neighbour *n)
968#endif 968#endif
969 size = 969 size =
970 sizeof (struct PeerStatusNotifyMessage) + 970 sizeof (struct PeerStatusNotifyMessage) +
971 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 971 n->ats_count * sizeof (struct GNUNET_ATS_Information);
972 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 972 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
973 { 973 {
974 GNUNET_break (0); 974 GNUNET_break (0);
@@ -976,7 +976,7 @@ handle_peer_status_change (struct Neighbour *n)
976 GNUNET_array_grow (n->ats, n->ats_count, 0); 976 GNUNET_array_grow (n->ats, n->ats_count, 0);
977 size = 977 size =
978 sizeof (struct PeerStatusNotifyMessage) + 978 sizeof (struct PeerStatusNotifyMessage) +
979 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 979 n->ats_count * sizeof (struct GNUNET_ATS_Information);
980 } 980 }
981 psnm = (struct PeerStatusNotifyMessage *) buf; 981 psnm = (struct PeerStatusNotifyMessage *) buf;
982 psnm->header.size = htons (size); 982 psnm->header.size = htons (size);
@@ -988,7 +988,7 @@ handle_peer_status_change (struct Neighbour *n)
988 psnm->ats_count = htonl (n->ats_count); 988 psnm->ats_count = htonl (n->ats_count);
989 ats = &psnm->ats; 989 ats = &psnm->ats;
990 memcpy (ats, n->ats, 990 memcpy (ats, n->ats,
991 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 991 n->ats_count * sizeof (struct GNUNET_ATS_Information));
992 ats[n->ats_count].type = htonl (0); 992 ats[n->ats_count].type = htonl (0);
993 ats[n->ats_count].value = htonl (0); 993 ats[n->ats_count].value = htonl (0);
994 send_to_all_clients (&psnm->header, GNUNET_YES, 994 send_to_all_clients (&psnm->header, GNUNET_YES,
@@ -1245,12 +1245,12 @@ notify_client_about_neighbour (void *cls, const GNUNET_HashCode * key,
1245 struct Neighbour *n = value; 1245 struct Neighbour *n = value;
1246 size_t size; 1246 size_t size;
1247 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1]; 1247 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
1248 struct GNUNET_TRANSPORT_ATS_Information *ats; 1248 struct GNUNET_ATS_Information *ats;
1249 struct ConnectNotifyMessage *cnm; 1249 struct ConnectNotifyMessage *cnm;
1250 1250
1251 size = 1251 size =
1252 sizeof (struct ConnectNotifyMessage) + 1252 sizeof (struct ConnectNotifyMessage) +
1253 (n->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 1253 (n->ats_count) * sizeof (struct GNUNET_ATS_Information);
1254 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1254 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1255 { 1255 {
1256 GNUNET_break (0); 1256 GNUNET_break (0);
@@ -1258,7 +1258,7 @@ notify_client_about_neighbour (void *cls, const GNUNET_HashCode * key,
1258 GNUNET_array_grow (n->ats, n->ats_count, 0); 1258 GNUNET_array_grow (n->ats, n->ats_count, 0);
1259 size = 1259 size =
1260 sizeof (struct ConnectNotifyMessage) + 1260 sizeof (struct ConnectNotifyMessage) +
1261 (n->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 1261 (n->ats_count) * sizeof (struct GNUNET_ATS_Information);
1262 } 1262 }
1263 cnm = (struct ConnectNotifyMessage *) buf; 1263 cnm = (struct ConnectNotifyMessage *) buf;
1264 cnm->header.size = htons (size); 1264 cnm->header.size = htons (size);
@@ -1266,8 +1266,8 @@ notify_client_about_neighbour (void *cls, const GNUNET_HashCode * key,
1266 cnm->ats_count = htonl (n->ats_count); 1266 cnm->ats_count = htonl (n->ats_count);
1267 ats = &cnm->ats; 1267 ats = &cnm->ats;
1268 memcpy (ats, n->ats, 1268 memcpy (ats, n->ats,
1269 sizeof (struct GNUNET_TRANSPORT_ATS_Information) * n->ats_count); 1269 sizeof (struct GNUNET_ATS_Information) * n->ats_count);
1270 ats[n->ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); 1270 ats[n->ats_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
1271 ats[n->ats_count].value = htonl (0); 1271 ats[n->ats_count].value = htonl (0);
1272 if (n->status == PEER_STATE_KEY_CONFIRMED) 1272 if (n->status == PEER_STATE_KEY_CONFIRMED)
1273 { 1273 {
@@ -1464,7 +1464,7 @@ queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
1464 struct GNUNET_SERVER_TransmitContext *tc = cls; 1464 struct GNUNET_SERVER_TransmitContext *tc = cls;
1465 struct Neighbour *n = value; 1465 struct Neighbour *n = value;
1466 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1]; 1466 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
1467 struct GNUNET_TRANSPORT_ATS_Information *ats; 1467 struct GNUNET_ATS_Information *ats;
1468 size_t size; 1468 size_t size;
1469 struct ConnectNotifyMessage *cnm; 1469 struct ConnectNotifyMessage *cnm;
1470 1470
@@ -1473,7 +1473,7 @@ queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
1473 return GNUNET_OK; 1473 return GNUNET_OK;
1474 size = 1474 size =
1475 sizeof (struct ConnectNotifyMessage) + 1475 sizeof (struct ConnectNotifyMessage) +
1476 (n->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 1476 (n->ats_count) * sizeof (struct GNUNET_ATS_Information);
1477 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1477 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1478 { 1478 {
1479 GNUNET_break (0); 1479 GNUNET_break (0);
@@ -1481,7 +1481,7 @@ queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
1481 GNUNET_array_grow (n->ats, n->ats_count, 0); 1481 GNUNET_array_grow (n->ats, n->ats_count, 0);
1482 size = 1482 size =
1483 sizeof (struct PeerStatusNotifyMessage) + 1483 sizeof (struct PeerStatusNotifyMessage) +
1484 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 1484 n->ats_count * sizeof (struct GNUNET_ATS_Information);
1485 } 1485 }
1486 cnm = (struct ConnectNotifyMessage *) buf; 1486 cnm = (struct ConnectNotifyMessage *) buf;
1487 cnm->header.size = htons (size); 1487 cnm->header.size = htons (size);
@@ -1489,8 +1489,8 @@ queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
1489 cnm->ats_count = htonl (n->ats_count); 1489 cnm->ats_count = htonl (n->ats_count);
1490 ats = &cnm->ats; 1490 ats = &cnm->ats;
1491 memcpy (ats, n->ats, 1491 memcpy (ats, n->ats,
1492 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 1492 n->ats_count * sizeof (struct GNUNET_ATS_Information));
1493 ats[n->ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); 1493 ats[n->ats_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
1494 ats[n->ats_count].value = htonl (0); 1494 ats[n->ats_count].value = htonl (0);
1495#if DEBUG_CORE_CLIENT 1495#if DEBUG_CORE_CLIENT
1496 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", 1496 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n",
@@ -3089,7 +3089,7 @@ trigger_processing:
3089 */ 3089 */
3090static void 3090static void
3091handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m, 3091handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m,
3092 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3092 const struct GNUNET_ATS_Information *ats,
3093 uint32_t ats_count); 3093 uint32_t ats_count);
3094 3094
3095 3095
@@ -3166,7 +3166,7 @@ process_hello_retry_handle_set_key (void *cls,
3166 */ 3166 */
3167static void 3167static void
3168update_neighbour_performance (struct Neighbour *n, 3168update_neighbour_performance (struct Neighbour *n,
3169 const struct GNUNET_TRANSPORT_ATS_Information 3169 const struct GNUNET_ATS_Information
3170 *ats, uint32_t ats_count) 3170 *ats, uint32_t ats_count)
3171{ 3171{
3172 uint32_t i; 3172 uint32_t i;
@@ -3203,7 +3203,7 @@ update_neighbour_performance (struct Neighbour *n,
3203 */ 3203 */
3204static void 3204static void
3205handle_ping (struct Neighbour *n, const struct PingMessage *m, 3205handle_ping (struct Neighbour *n, const struct PingMessage *m,
3206 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3206 const struct GNUNET_ATS_Information *ats,
3207 uint32_t ats_count) 3207 uint32_t ats_count)
3208{ 3208{
3209 struct PingMessage t; 3209 struct PingMessage t;
@@ -3295,14 +3295,14 @@ handle_ping (struct Neighbour *n, const struct PingMessage *m,
3295 */ 3295 */
3296static void 3296static void
3297handle_pong (struct Neighbour *n, const struct PongMessage *m, 3297handle_pong (struct Neighbour *n, const struct PongMessage *m,
3298 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3298 const struct GNUNET_ATS_Information *ats,
3299 uint32_t ats_count) 3299 uint32_t ats_count)
3300{ 3300{
3301 struct PongMessage t; 3301 struct PongMessage t;
3302 struct ConnectNotifyMessage *cnm; 3302 struct ConnectNotifyMessage *cnm;
3303 struct GNUNET_CRYPTO_AesInitializationVector iv; 3303 struct GNUNET_CRYPTO_AesInitializationVector iv;
3304 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1]; 3304 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
3305 struct GNUNET_TRANSPORT_ATS_Information *mats; 3305 struct GNUNET_ATS_Information *mats;
3306 size_t size; 3306 size_t size;
3307 3307
3308#if DEBUG_HANDSHAKE 3308#if DEBUG_HANDSHAKE
@@ -3393,7 +3393,7 @@ handle_pong (struct Neighbour *n, const struct PongMessage *m,
3393 update_neighbour_performance (n, ats, ats_count); 3393 update_neighbour_performance (n, ats, ats_count);
3394 size = 3394 size =
3395 sizeof (struct ConnectNotifyMessage) + 3395 sizeof (struct ConnectNotifyMessage) +
3396 (n->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 3396 (n->ats_count) * sizeof (struct GNUNET_ATS_Information);
3397 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 3397 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
3398 { 3398 {
3399 GNUNET_break (0); 3399 GNUNET_break (0);
@@ -3401,7 +3401,7 @@ handle_pong (struct Neighbour *n, const struct PongMessage *m,
3401 GNUNET_array_grow (n->ats, n->ats_count, 0); 3401 GNUNET_array_grow (n->ats, n->ats_count, 0);
3402 size = 3402 size =
3403 sizeof (struct PeerStatusNotifyMessage) + 3403 sizeof (struct PeerStatusNotifyMessage) +
3404 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 3404 n->ats_count * sizeof (struct GNUNET_ATS_Information);
3405 } 3405 }
3406 cnm = (struct ConnectNotifyMessage *) buf; 3406 cnm = (struct ConnectNotifyMessage *) buf;
3407 cnm->header.size = htons (size); 3407 cnm->header.size = htons (size);
@@ -3410,8 +3410,8 @@ handle_pong (struct Neighbour *n, const struct PongMessage *m,
3410 cnm->peer = n->peer; 3410 cnm->peer = n->peer;
3411 mats = &cnm->ats; 3411 mats = &cnm->ats;
3412 memcpy (mats, n->ats, 3412 memcpy (mats, n->ats,
3413 n->ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 3413 n->ats_count * sizeof (struct GNUNET_ATS_Information));
3414 mats[n->ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); 3414 mats[n->ats_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
3415 mats[n->ats_count].value = htonl (0); 3415 mats[n->ats_count].value = htonl (0);
3416 send_to_all_clients (&cnm->header, GNUNET_NO, 3416 send_to_all_clients (&cnm->header, GNUNET_NO,
3417 GNUNET_CORE_OPTION_SEND_CONNECT); 3417 GNUNET_CORE_OPTION_SEND_CONNECT);
@@ -3445,7 +3445,7 @@ handle_pong (struct Neighbour *n, const struct PongMessage *m,
3445 */ 3445 */
3446static void 3446static void
3447handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m, 3447handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m,
3448 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3448 const struct GNUNET_ATS_Information *ats,
3449 uint32_t ats_count) 3449 uint32_t ats_count)
3450{ 3450{
3451 struct SetKeyMessage *m_cpy; 3451 struct SetKeyMessage *m_cpy;
@@ -3619,10 +3619,10 @@ send_p2p_message_to_client (struct Neighbour *sender, struct Client *client,
3619{ 3619{
3620 size_t size = 3620 size_t size =
3621 msize + sizeof (struct NotifyTrafficMessage) + 3621 msize + sizeof (struct NotifyTrafficMessage) +
3622 (sender->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 3622 (sender->ats_count) * sizeof (struct GNUNET_ATS_Information);
3623 char buf[size]; 3623 char buf[size];
3624 struct NotifyTrafficMessage *ntm; 3624 struct NotifyTrafficMessage *ntm;
3625 struct GNUNET_TRANSPORT_ATS_Information *ats; 3625 struct GNUNET_ATS_Information *ats;
3626 3626
3627 GNUNET_assert (GNUNET_YES == sender->is_connected); 3627 GNUNET_assert (GNUNET_YES == sender->is_connected);
3628 GNUNET_break (sender->status == PEER_STATE_KEY_CONFIRMED); 3628 GNUNET_break (sender->status == PEER_STATE_KEY_CONFIRMED);
@@ -3633,7 +3633,7 @@ send_p2p_message_to_client (struct Neighbour *sender, struct Client *client,
3633 GNUNET_array_grow (sender->ats, sender->ats_count, 0); 3633 GNUNET_array_grow (sender->ats, sender->ats_count, 0);
3634 size = 3634 size =
3635 msize + sizeof (struct NotifyTrafficMessage) + 3635 msize + sizeof (struct NotifyTrafficMessage) +
3636 (sender->ats_count) * sizeof (struct GNUNET_TRANSPORT_ATS_Information); 3636 (sender->ats_count) * sizeof (struct GNUNET_ATS_Information);
3637 } 3637 }
3638#if DEBUG_CORE 3638#if DEBUG_CORE
3639 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3639 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3649,8 +3649,8 @@ send_p2p_message_to_client (struct Neighbour *sender, struct Client *client,
3649 ntm->peer = sender->peer; 3649 ntm->peer = sender->peer;
3650 ats = &ntm->ats; 3650 ats = &ntm->ats;
3651 memcpy (ats, sender->ats, 3651 memcpy (ats, sender->ats,
3652 sizeof (struct GNUNET_TRANSPORT_ATS_Information) * sender->ats_count); 3652 sizeof (struct GNUNET_ATS_Information) * sender->ats_count);
3653 ats[sender->ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); 3653 ats[sender->ats_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
3654 ats[sender->ats_count].value = htonl (0); 3654 ats[sender->ats_count].value = htonl (0);
3655 memcpy (&ats[sender->ats_count + 1], m, msize); 3655 memcpy (&ats[sender->ats_count + 1], m, msize);
3656 send_to_client (client, &ntm->header, GNUNET_YES); 3656 send_to_client (client, &ntm->header, GNUNET_YES);
@@ -3748,7 +3748,7 @@ deliver_message (void *cls, void *client, const struct GNUNET_MessageHeader *m)
3748 */ 3748 */
3749static void 3749static void
3750handle_encrypted_message (struct Neighbour *n, const struct EncryptedMessage *m, 3750handle_encrypted_message (struct Neighbour *n, const struct EncryptedMessage *m,
3751 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3751 const struct GNUNET_ATS_Information *ats,
3752 uint32_t ats_count) 3752 uint32_t ats_count)
3753{ 3753{
3754 size_t size = ntohs (m->header.size); 3754 size_t size = ntohs (m->header.size);
@@ -3908,7 +3908,7 @@ handle_encrypted_message (struct Neighbour *n, const struct EncryptedMessage *m,
3908static void 3908static void
3909handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, 3909handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
3910 const struct GNUNET_MessageHeader *message, 3910 const struct GNUNET_MessageHeader *message,
3911 const struct GNUNET_TRANSPORT_ATS_Information *ats, 3911 const struct GNUNET_ATS_Information *ats,
3912 uint32_t ats_count) 3912 uint32_t ats_count)
3913{ 3913{
3914 struct Neighbour *n; 3914 struct Neighbour *n;
@@ -4171,7 +4171,7 @@ neighbour_quota_update (void *cls,
4171static void 4171static void
4172handle_transport_notify_connect (void *cls, 4172handle_transport_notify_connect (void *cls,
4173 const struct GNUNET_PeerIdentity *peer, 4173 const struct GNUNET_PeerIdentity *peer,
4174 const struct GNUNET_TRANSPORT_ATS_Information 4174 const struct GNUNET_ATS_Information
4175 *ats, uint32_t ats_count) 4175 *ats, uint32_t ats_count)
4176{ 4176{
4177 struct Neighbour *n; 4177 struct Neighbour *n;