diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 287d42efe..716165374 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -103,7 +103,7 @@ struct CadetPeerQueue | |||
103 | /** | 103 | /** |
104 | * Function to call on sending. | 104 | * Function to call on sending. |
105 | */ | 105 | */ |
106 | GMP_sent callback; | 106 | GCP_sent callback; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Closure for callback. | 109 | * Closure for callback. |
@@ -139,7 +139,7 @@ struct CadetPeer | |||
139 | /** | 139 | /** |
140 | * Handle to stop the DHT search for paths to this peer | 140 | * Handle to stop the DHT search for paths to this peer |
141 | */ | 141 | */ |
142 | struct GMD_search_handle *search_h; | 142 | struct GCD_search_handle *search_h; |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * Tunnel to this peer, if any. | 145 | * Tunnel to this peer, if any. |
@@ -232,16 +232,16 @@ queue_debug (struct CadetPeer *peer) | |||
232 | { | 232 | { |
233 | struct CadetPeerQueue *q; | 233 | struct CadetPeerQueue *q; |
234 | 234 | ||
235 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GMP_2s (peer)); | 235 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GCP_2s (peer)); |
236 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n", peer->core_transmit); | 236 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n", peer->core_transmit); |
237 | 237 | ||
238 | for (q = peer->queue_head; NULL != q; q = q->next) | 238 | for (q = peer->queue_head; NULL != q; q = q->next) |
239 | { | 239 | { |
240 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ - %s %s on %s\n", | 240 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ - %s %s on %s\n", |
241 | GM_m2s (q->type), GM_f2s (q->fwd), GMC_2s (q->c)); | 241 | GC_m2s (q->type), GC_f2s (q->fwd), GCC_2s (q->c)); |
242 | } | 242 | } |
243 | 243 | ||
244 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ End queued towards %s\n", GMP_2s (peer)); | 244 | LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ End queued towards %s\n", GCP_2s (peer)); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
@@ -269,8 +269,8 @@ notify_broken (void *cls, | |||
269 | struct CadetConnection *c = value; | 269 | struct CadetConnection *c = value; |
270 | 270 | ||
271 | LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n", | 271 | LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n", |
272 | GMC_2s (c), GMP_2s (peer)); | 272 | GCC_2s (c), GCP_2s (peer)); |
273 | GMC_notify_broken (c, peer); | 273 | GCC_notify_broken (c, peer); |
274 | 274 | ||
275 | return GNUNET_YES; | 275 | return GNUNET_YES; |
276 | } | 276 | } |
@@ -317,7 +317,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
317 | char own_id[16]; | 317 | char own_id[16]; |
318 | 318 | ||
319 | strncpy (own_id, GNUNET_i2s (&my_full_id), 15); | 319 | strncpy (own_id, GNUNET_i2s (&my_full_id), 15); |
320 | mp = GMP_get (peer); | 320 | mp = GCP_get (peer); |
321 | if (myid == mp->id) | 321 | if (myid == mp->id) |
322 | { | 322 | { |
323 | LOG (GNUNET_ERROR_TYPE_INFO, "CONNECTED %s (self)\n", own_id); | 323 | LOG (GNUNET_ERROR_TYPE_INFO, "CONNECTED %s (self)\n", own_id); |
@@ -334,14 +334,14 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
334 | } | 334 | } |
335 | path->peers[0] = myid; | 335 | path->peers[0] = myid; |
336 | GNUNET_PEER_change_rc (myid, 1); | 336 | GNUNET_PEER_change_rc (myid, 1); |
337 | GMP_add_path (mp, path, GNUNET_YES); | 337 | GCP_add_path (mp, path, GNUNET_YES); |
338 | 338 | ||
339 | mp->connections = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES); | 339 | mp->connections = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES); |
340 | 340 | ||
341 | if (NULL != GMP_get_tunnel (mp) && | 341 | if (NULL != GCP_get_tunnel (mp) && |
342 | 0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) | 342 | 0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) |
343 | { | 343 | { |
344 | GMP_connect (mp); | 344 | GCP_connect (mp); |
345 | } | 345 | } |
346 | 346 | ||
347 | return; | 347 | return; |
@@ -393,19 +393,19 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
393 | * Functions to handle messages from core | 393 | * Functions to handle messages from core |
394 | */ | 394 | */ |
395 | static struct GNUNET_CORE_MessageHandler core_handlers[] = { | 395 | static struct GNUNET_CORE_MessageHandler core_handlers[] = { |
396 | {&GMC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0}, | 396 | {&GCC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0}, |
397 | {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, | 397 | {&GCC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, |
398 | sizeof (struct GNUNET_CADET_ConnectionACK)}, | 398 | sizeof (struct GNUNET_CADET_ConnectionACK)}, |
399 | {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, | 399 | {&GCC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, |
400 | sizeof (struct GNUNET_CADET_ConnectionBroken)}, | 400 | sizeof (struct GNUNET_CADET_ConnectionBroken)}, |
401 | {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, | 401 | {&GCC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, |
402 | sizeof (struct GNUNET_CADET_ConnectionDestroy)}, | 402 | sizeof (struct GNUNET_CADET_ConnectionDestroy)}, |
403 | {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK, | 403 | {&GCC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK, |
404 | sizeof (struct GNUNET_CADET_ACK)}, | 404 | sizeof (struct GNUNET_CADET_ACK)}, |
405 | {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL, | 405 | {&GCC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL, |
406 | sizeof (struct GNUNET_CADET_Poll)}, | 406 | sizeof (struct GNUNET_CADET_Poll)}, |
407 | {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0}, | 407 | {&GCC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0}, |
408 | {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0}, | 408 | {&GCC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0}, |
409 | {NULL, 0, 0} | 409 | {NULL, 0, 0} |
410 | }; | 410 | }; |
411 | 411 | ||
@@ -490,7 +490,7 @@ send_core_connection_create (struct CadetConnection *c, size_t size, void *buf) | |||
490 | { | 490 | { |
491 | struct GNUNET_CADET_ConnectionCreate *msg; | 491 | struct GNUNET_CADET_ConnectionCreate *msg; |
492 | struct GNUNET_PeerIdentity *peer_ptr; | 492 | struct GNUNET_PeerIdentity *peer_ptr; |
493 | const struct CadetPeerPath *p = GMC_get_path (c); | 493 | const struct CadetPeerPath *p = GCC_get_path (c); |
494 | size_t size_needed; | 494 | size_t size_needed; |
495 | int i; | 495 | int i; |
496 | 496 | ||
@@ -510,7 +510,7 @@ send_core_connection_create (struct CadetConnection *c, size_t size, void *buf) | |||
510 | msg = (struct GNUNET_CADET_ConnectionCreate *) buf; | 510 | msg = (struct GNUNET_CADET_ConnectionCreate *) buf; |
511 | msg->header.size = htons (size_needed); | 511 | msg->header.size = htons (size_needed); |
512 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); | 512 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); |
513 | msg->cid = *GMC_get_id (c); | 513 | msg->cid = *GCC_get_id (c); |
514 | 514 | ||
515 | peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1]; | 515 | peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1]; |
516 | for (i = 0; i < p->length; i++) | 516 | for (i = 0; i < p->length; i++) |
@@ -547,7 +547,7 @@ send_core_connection_ack (struct CadetConnection *c, size_t size, void *buf) | |||
547 | } | 547 | } |
548 | msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionACK)); | 548 | msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionACK)); |
549 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK); | 549 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK); |
550 | msg->cid = *GMC_get_id (c); | 550 | msg->cid = *GCC_get_id (c); |
551 | 551 | ||
552 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n"); | 552 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n"); |
553 | return sizeof (struct GNUNET_CADET_ConnectionACK); | 553 | return sizeof (struct GNUNET_CADET_ConnectionACK); |
@@ -579,7 +579,7 @@ get_priority (struct CadetPeerQueue *q) | |||
579 | } | 579 | } |
580 | 580 | ||
581 | /* Relayed traffic has lower priority, our own traffic has higher */ | 581 | /* Relayed traffic has lower priority, our own traffic has higher */ |
582 | if (NULL == q->c || GNUNET_NO == GMC_is_origin (q->c, q->fwd)) | 582 | if (NULL == q->c || GNUNET_NO == GCC_is_origin (q->c, q->fwd)) |
583 | { | 583 | { |
584 | low = GNUNET_CORE_PRIO_BEST_EFFORT; | 584 | low = GNUNET_CORE_PRIO_BEST_EFFORT; |
585 | high = GNUNET_CORE_PRIO_URGENT; | 585 | high = GNUNET_CORE_PRIO_URGENT; |
@@ -616,7 +616,7 @@ shutdown_tunnel (void *cls, | |||
616 | struct CadetTunnel3 *t = p->tunnel; | 616 | struct CadetTunnel3 *t = p->tunnel; |
617 | 617 | ||
618 | if (NULL != t) | 618 | if (NULL != t) |
619 | GMT_destroy (t); | 619 | GCT_destroy (t); |
620 | return GNUNET_YES; | 620 | return GNUNET_YES; |
621 | } | 621 | } |
622 | 622 | ||
@@ -648,7 +648,7 @@ peer_destroy (struct CadetPeer *peer) | |||
648 | } | 648 | } |
649 | if (NULL != peer->search_h) | 649 | if (NULL != peer->search_h) |
650 | { | 650 | { |
651 | GMD_search_stop (peer->search_h); | 651 | GCD_search_stop (peer->search_h); |
652 | } | 652 | } |
653 | p = peer->path_head; | 653 | p = peer->path_head; |
654 | while (NULL != p) | 654 | while (NULL != p) |
@@ -658,7 +658,7 @@ peer_destroy (struct CadetPeer *peer) | |||
658 | path_destroy (p); | 658 | path_destroy (p); |
659 | p = nextp; | 659 | p = nextp; |
660 | } | 660 | } |
661 | GMT_destroy_empty (peer->tunnel); | 661 | GCT_destroy_empty (peer->tunnel); |
662 | GNUNET_free (peer); | 662 | GNUNET_free (peer); |
663 | return GNUNET_OK; | 663 | return GNUNET_OK; |
664 | } | 664 | } |
@@ -783,10 +783,10 @@ peer_get_best_path (const struct CadetPeer *peer) | |||
783 | { | 783 | { |
784 | if (GNUNET_NO == path_is_valid (p)) | 784 | if (GNUNET_NO == path_is_valid (p)) |
785 | continue; /* Don't use invalid paths. */ | 785 | continue; /* Don't use invalid paths. */ |
786 | if (GNUNET_YES == GMT_is_path_used (peer->tunnel, p)) | 786 | if (GNUNET_YES == GCT_is_path_used (peer->tunnel, p)) |
787 | continue; /* If path is already in use, skip it. */ | 787 | continue; /* If path is already in use, skip it. */ |
788 | 788 | ||
789 | if ((cost = GMT_get_path_cost (peer->tunnel, p)) < best_cost) | 789 | if ((cost = GCT_get_path_cost (peer->tunnel, p)) < best_cost) |
790 | { | 790 | { |
791 | best_cost = cost; | 791 | best_cost = cost; |
792 | best_p = p; | 792 | best_p = p; |
@@ -828,7 +828,7 @@ queue_is_sendable (struct CadetPeerQueue *q) | |||
828 | GNUNET_break (0); | 828 | GNUNET_break (0); |
829 | } | 829 | } |
830 | 830 | ||
831 | return GMC_is_sendable (q->c, q->fwd); | 831 | return GCC_is_sendable (q->c, q->fwd); |
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
@@ -846,7 +846,7 @@ peer_get_first_message (const struct CadetPeer *peer) | |||
846 | 846 | ||
847 | for (q = peer->queue_head; NULL != q; q = q->next) | 847 | for (q = peer->queue_head; NULL != q; q = q->next) |
848 | { | 848 | { |
849 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking %p towards %s\n", q, GMC_2s (q->c)); | 849 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking %p towards %s\n", q, GCC_2s (q->c)); |
850 | if (queue_is_sendable (q)) | 850 | if (queue_is_sendable (q)) |
851 | return q; | 851 | return q; |
852 | } | 852 | } |
@@ -869,19 +869,19 @@ search_handler (void *cls, const struct CadetPeerPath *path) | |||
869 | struct CadetPeer *peer = cls; | 869 | struct CadetPeer *peer = cls; |
870 | unsigned int connection_count; | 870 | unsigned int connection_count; |
871 | 871 | ||
872 | GMP_add_path_to_all (path, GNUNET_NO); | 872 | GCP_add_path_to_all (path, GNUNET_NO); |
873 | 873 | ||
874 | /* Count connections */ | 874 | /* Count connections */ |
875 | connection_count = GMT_count_connections (peer->tunnel); | 875 | connection_count = GCT_count_connections (peer->tunnel); |
876 | 876 | ||
877 | /* If we already have 3 (or more (?!)) connections, it's enough */ | 877 | /* If we already have 3 (or more (?!)) connections, it's enough */ |
878 | if (3 <= connection_count) | 878 | if (3 <= connection_count) |
879 | return; | 879 | return; |
880 | 880 | ||
881 | if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel)) | 881 | if (CADET_TUNNEL3_SEARCHING == GCT_get_cstate (peer->tunnel)) |
882 | { | 882 | { |
883 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n"); | 883 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n"); |
884 | GMP_connect (peer); | 884 | GCP_connect (peer); |
885 | } | 885 | } |
886 | return; | 886 | return; |
887 | } | 887 | } |
@@ -910,7 +910,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
910 | pid = 0; | 910 | pid = 0; |
911 | peer->core_transmit = NULL; | 911 | peer->core_transmit = NULL; |
912 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Queue send towards %s (max %u)\n", | 912 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Queue send towards %s (max %u)\n", |
913 | GMP_2s (peer), size); | 913 | GCP_2s (peer), size); |
914 | 914 | ||
915 | if (NULL == buf || 0 == size) | 915 | if (NULL == buf || 0 == size) |
916 | { | 916 | { |
@@ -929,7 +929,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
929 | 929 | ||
930 | dst_id = GNUNET_PEER_resolve2 (peer->id); | 930 | dst_id = GNUNET_PEER_resolve2 (peer->id); |
931 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s %s\n", | 931 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s %s\n", |
932 | GMC_2s (c), GM_f2s(queue->fwd)); | 932 | GCC_2s (c), GC_f2s(queue->fwd)); |
933 | /* Check if buffer size is enough for the message */ | 933 | /* Check if buffer size is enough for the message */ |
934 | if (queue->size > size) | 934 | if (queue->size > size) |
935 | { | 935 | { |
@@ -951,7 +951,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
951 | switch (queue->type) | 951 | switch (queue->type) |
952 | { | 952 | { |
953 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: | 953 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: |
954 | pid = GMC_get_pid (queue->c, queue->fwd); | 954 | pid = GCC_get_pid (queue->c, queue->fwd); |
955 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid); | 955 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid); |
956 | data_size = send_core_data_raw (queue->cls, size, buf); | 956 | data_size = send_core_data_raw (queue->cls, size, buf); |
957 | ((struct GNUNET_CADET_Encrypted *) buf)->pid = htonl (pid); | 957 | ((struct GNUNET_CADET_Encrypted *) buf)->pid = htonl (pid); |
@@ -961,20 +961,20 @@ queue_send (void *cls, size_t size, void *buf) | |||
961 | case GNUNET_MESSAGE_TYPE_CADET_KX: | 961 | case GNUNET_MESSAGE_TYPE_CADET_KX: |
962 | case GNUNET_MESSAGE_TYPE_CADET_ACK: | 962 | case GNUNET_MESSAGE_TYPE_CADET_ACK: |
963 | case GNUNET_MESSAGE_TYPE_CADET_POLL: | 963 | case GNUNET_MESSAGE_TYPE_CADET_POLL: |
964 | LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GM_m2s (queue->type)); | 964 | LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GC_m2s (queue->type)); |
965 | data_size = send_core_data_raw (queue->cls, size, buf); | 965 | data_size = send_core_data_raw (queue->cls, size, buf); |
966 | break; | 966 | break; |
967 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: | 967 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: |
968 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n"); | 968 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n"); |
969 | if (GMC_is_origin (c, GNUNET_YES)) | 969 | if (GCC_is_origin (c, GNUNET_YES)) |
970 | data_size = send_core_connection_create (queue->c, size, buf); | 970 | data_size = send_core_connection_create (queue->c, size, buf); |
971 | else | 971 | else |
972 | data_size = send_core_data_raw (queue->cls, size, buf); | 972 | data_size = send_core_data_raw (queue->cls, size, buf); |
973 | break; | 973 | break; |
974 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: | 974 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: |
975 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n"); | 975 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n"); |
976 | if (GMC_is_origin (c, GNUNET_NO) || | 976 | if (GCC_is_origin (c, GNUNET_NO) || |
977 | GMC_is_origin (c, GNUNET_YES)) | 977 | GCC_is_origin (c, GNUNET_YES)) |
978 | data_size = send_core_connection_ack (queue->c, size, buf); | 978 | data_size = send_core_connection_ack (queue->c, size, buf); |
979 | else | 979 | else |
980 | data_size = send_core_data_raw (queue->cls, size, buf); | 980 | data_size = send_core_data_raw (queue->cls, size, buf); |
@@ -996,19 +996,19 @@ queue_send (void *cls, size_t size, void *buf) | |||
996 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 101) < drop_percent) | 996 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 101) < drop_percent) |
997 | { | 997 | { |
998 | LOG (GNUNET_ERROR_TYPE_WARNING, "DD %s on connection %s\n", | 998 | LOG (GNUNET_ERROR_TYPE_WARNING, "DD %s on connection %s\n", |
999 | GM_m2s (queue->type), GMC_2s (c)); | 999 | GC_m2s (queue->type), GCC_2s (c)); |
1000 | data_size = 0; | 1000 | data_size = 0; |
1001 | } | 1001 | } |
1002 | else | 1002 | else |
1003 | { | 1003 | { |
1004 | LOG (GNUNET_ERROR_TYPE_INFO, | 1004 | LOG (GNUNET_ERROR_TYPE_INFO, |
1005 | "snd %s (%s %u) on connection %s (%p) %s (size %u)\n", | 1005 | "snd %s (%s %u) on connection %s (%p) %s (size %u)\n", |
1006 | GM_m2s (queue->type), GM_m2s (queue->payload_type), | 1006 | GC_m2s (queue->type), GC_m2s (queue->payload_type), |
1007 | queue->payload_type, GMC_2s (c), c, GM_f2s (queue->fwd), data_size); | 1007 | queue->payload_type, GCC_2s (c), c, GC_f2s (queue->fwd), data_size); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /* Free queue, but cls was freed by send_core_* */ | 1010 | /* Free queue, but cls was freed by send_core_* */ |
1011 | GMP_queue_destroy (queue, GNUNET_NO, GNUNET_YES, pid); | 1011 | GCP_queue_destroy (queue, GNUNET_NO, GNUNET_YES, pid); |
1012 | 1012 | ||
1013 | /* If more data in queue, send next */ | 1013 | /* If more data in queue, send next */ |
1014 | queue = peer_get_first_message (peer); | 1014 | queue = peer_get_first_message (peer); |
@@ -1032,11 +1032,11 @@ queue_send (void *cls, size_t size, void *buf) | |||
1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1033 | "* tmt rdy called somewhere else\n"); | 1033 | "* tmt rdy called somewhere else\n"); |
1034 | } | 1034 | } |
1035 | // GMC_start_poll (); FIXME needed? | 1035 | // GCC_start_poll (); FIXME needed? |
1036 | } | 1036 | } |
1037 | else | 1037 | else |
1038 | { | 1038 | { |
1039 | // GMC_stop_poll(); FIXME needed? | 1039 | // GCC_stop_poll(); FIXME needed? |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | LOG (GNUNET_ERROR_TYPE_DEBUG, " return %d\n", data_size); | 1042 | LOG (GNUNET_ERROR_TYPE_DEBUG, " return %d\n", data_size); |
@@ -1060,7 +1060,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
1060 | * @param pid PID, if relevant (was sent and was a payload message). | 1060 | * @param pid PID, if relevant (was sent and was a payload message). |
1061 | */ | 1061 | */ |
1062 | void | 1062 | void |
1063 | GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, | 1063 | GCP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, |
1064 | int sent, uint32_t pid) | 1064 | int sent, uint32_t pid) |
1065 | { | 1065 | { |
1066 | struct CadetPeer *peer; | 1066 | struct CadetPeer *peer; |
@@ -1070,7 +1070,7 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, | |||
1070 | if (GNUNET_YES == clear_cls) | 1070 | if (GNUNET_YES == clear_cls) |
1071 | { | 1071 | { |
1072 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue destroy type %s\n", | 1072 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue destroy type %s\n", |
1073 | GM_m2s (queue->type)); | 1073 | GC_m2s (queue->type)); |
1074 | switch (queue->type) | 1074 | switch (queue->type) |
1075 | { | 1075 | { |
1076 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: | 1076 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: |
@@ -1090,7 +1090,7 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, | |||
1090 | default: | 1090 | default: |
1091 | GNUNET_break (0); | 1091 | GNUNET_break (0); |
1092 | LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n", | 1092 | LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n", |
1093 | GM_m2s (queue->type)); | 1093 | GC_m2s (queue->type)); |
1094 | } | 1094 | } |
1095 | } | 1095 | } |
1096 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); | 1096 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); |
@@ -1137,10 +1137,10 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, | |||
1137 | * message has been sent and therefore the handle is no longer valid. | 1137 | * message has been sent and therefore the handle is no longer valid. |
1138 | */ | 1138 | */ |
1139 | struct CadetPeerQueue * | 1139 | struct CadetPeerQueue * |
1140 | GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | 1140 | GCP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, |
1141 | uint16_t payload_type, uint32_t payload_id, size_t size, | 1141 | uint16_t payload_type, uint32_t payload_id, size_t size, |
1142 | struct CadetConnection *c, int fwd, | 1142 | struct CadetConnection *c, int fwd, |
1143 | GMP_sent cont, void *cont_cls) | 1143 | GCP_sent cont, void *cont_cls) |
1144 | { | 1144 | { |
1145 | struct CadetPeerQueue *queue; | 1145 | struct CadetPeerQueue *queue; |
1146 | int priority; | 1146 | int priority; |
@@ -1148,13 +1148,13 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | |||
1148 | 1148 | ||
1149 | LOG (GNUNET_ERROR_TYPE_INFO, | 1149 | LOG (GNUNET_ERROR_TYPE_INFO, |
1150 | "que %s (%s %u) on connection %s (%p) %s towards %s (size %u)\n", | 1150 | "que %s (%s %u) on connection %s (%p) %s towards %s (size %u)\n", |
1151 | GM_m2s (type), GM_m2s (payload_type), payload_id, | 1151 | GC_m2s (type), GC_m2s (payload_type), payload_id, |
1152 | GMC_2s (c), c, GM_f2s (fwd), GMP_2s (peer), size); | 1152 | GCC_2s (c), c, GC_f2s (fwd), GCP_2s (peer), size); |
1153 | 1153 | ||
1154 | if (NULL == peer->connections) | 1154 | if (NULL == peer->connections) |
1155 | { | 1155 | { |
1156 | /* We are not connected to this peer, ignore request. */ | 1156 | /* We are not connected to this peer, ignore request. */ |
1157 | LOG (GNUNET_ERROR_TYPE_WARNING, "%s not a neighbor\n", GMP_2s (peer)); | 1157 | LOG (GNUNET_ERROR_TYPE_WARNING, "%s not a neighbor\n", GCP_2s (peer)); |
1158 | GNUNET_STATISTICS_update (stats, "# messages dropped due to wrong hop", 1, | 1158 | GNUNET_STATISTICS_update (stats, "# messages dropped due to wrong hop", 1, |
1159 | GNUNET_NO); | 1159 | GNUNET_NO); |
1160 | return NULL; | 1160 | return NULL; |
@@ -1170,7 +1170,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | |||
1170 | 1170 | ||
1171 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); | 1171 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); |
1172 | 1172 | ||
1173 | call_core = NULL == c ? GNUNET_YES : GMC_is_sendable (c, fwd); | 1173 | call_core = NULL == c ? GNUNET_YES : GCC_is_sendable (c, fwd); |
1174 | queue = GNUNET_new (struct CadetPeerQueue); | 1174 | queue = GNUNET_new (struct CadetPeerQueue); |
1175 | queue->cls = cls; | 1175 | queue->cls = cls; |
1176 | queue->type = type; | 1176 | queue->type = type; |
@@ -1197,7 +1197,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | |||
1197 | { | 1197 | { |
1198 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1198 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1199 | "calling core tmt rdy towards %s for %u bytes\n", | 1199 | "calling core tmt rdy towards %s for %u bytes\n", |
1200 | GMP_2s (peer), size); | 1200 | GCP_2s (peer), size); |
1201 | peer->core_transmit = | 1201 | peer->core_transmit = |
1202 | GNUNET_CORE_notify_transmit_ready (core_handle, | 1202 | GNUNET_CORE_notify_transmit_ready (core_handle, |
1203 | GNUNET_NO, get_priority (queue), | 1203 | GNUNET_NO, get_priority (queue), |
@@ -1211,13 +1211,13 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | |||
1211 | else if (GNUNET_NO == call_core) | 1211 | else if (GNUNET_NO == call_core) |
1212 | { | 1212 | { |
1213 | LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s not needed\n", | 1213 | LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s not needed\n", |
1214 | GMP_2s (peer)); | 1214 | GCP_2s (peer)); |
1215 | 1215 | ||
1216 | } | 1216 | } |
1217 | else | 1217 | else |
1218 | { | 1218 | { |
1219 | LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s already called\n", | 1219 | LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s already called\n", |
1220 | GMP_2s (peer)); | 1220 | GCP_2s (peer)); |
1221 | 1221 | ||
1222 | } | 1222 | } |
1223 | queue_debug (peer); | 1223 | queue_debug (peer); |
@@ -1233,7 +1233,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, | |||
1233 | * the sent continuation call. | 1233 | * the sent continuation call. |
1234 | */ | 1234 | */ |
1235 | void | 1235 | void |
1236 | GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) | 1236 | GCP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) |
1237 | { | 1237 | { |
1238 | struct CadetPeerQueue *q; | 1238 | struct CadetPeerQueue *q; |
1239 | struct CadetPeerQueue *next; | 1239 | struct CadetPeerQueue *next; |
@@ -1244,18 +1244,18 @@ GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) | |||
1244 | prev = q->prev; | 1244 | prev = q->prev; |
1245 | if (q->c == c) | 1245 | if (q->c == c) |
1246 | { | 1246 | { |
1247 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GM_m2s (q->type)); | 1247 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GC_m2s (q->type)); |
1248 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY != q->type) | 1248 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY != q->type) |
1249 | { | 1249 | { |
1250 | q->c = NULL; | 1250 | q->c = NULL; |
1251 | } | 1251 | } |
1252 | else | 1252 | else |
1253 | { | 1253 | { |
1254 | GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); | 1254 | GCP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); |
1255 | } | 1255 | } |
1256 | 1256 | ||
1257 | /* Get next from prev, q->next might be already freed: | 1257 | /* Get next from prev, q->next might be already freed: |
1258 | * queue destroy -> callback -> GMC_destroy -> cancel_queues -> here | 1258 | * queue destroy -> callback -> GCC_destroy -> cancel_queues -> here |
1259 | */ | 1259 | */ |
1260 | if (NULL == prev) | 1260 | if (NULL == prev) |
1261 | next = peer->queue_head; | 1261 | next = peer->queue_head; |
@@ -1316,13 +1316,13 @@ connection_get_first_message (struct CadetPeer *peer, struct CadetConnection *c) | |||
1316 | * @return First message for this connection. | 1316 | * @return First message for this connection. |
1317 | */ | 1317 | */ |
1318 | struct GNUNET_MessageHeader * | 1318 | struct GNUNET_MessageHeader * |
1319 | GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) | 1319 | GCP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) |
1320 | { | 1320 | { |
1321 | struct CadetPeerQueue *q; | 1321 | struct CadetPeerQueue *q; |
1322 | struct CadetPeerQueue *next; | 1322 | struct CadetPeerQueue *next; |
1323 | struct GNUNET_MessageHeader *msg; | 1323 | struct GNUNET_MessageHeader *msg; |
1324 | 1324 | ||
1325 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GMC_2s (c)); | 1325 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GCC_2s (c)); |
1326 | for (q = peer->queue_head; NULL != q; q = next) | 1326 | for (q = peer->queue_head; NULL != q; q = next) |
1327 | { | 1327 | { |
1328 | next = q->next; | 1328 | next = q->next; |
@@ -1336,13 +1336,13 @@ GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) | |||
1336 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: | 1336 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: |
1337 | case GNUNET_MESSAGE_TYPE_CADET_ACK: | 1337 | case GNUNET_MESSAGE_TYPE_CADET_ACK: |
1338 | case GNUNET_MESSAGE_TYPE_CADET_POLL: | 1338 | case GNUNET_MESSAGE_TYPE_CADET_POLL: |
1339 | GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); | 1339 | GCP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); |
1340 | continue; | 1340 | continue; |
1341 | 1341 | ||
1342 | case GNUNET_MESSAGE_TYPE_CADET_KX: | 1342 | case GNUNET_MESSAGE_TYPE_CADET_KX: |
1343 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: | 1343 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: |
1344 | msg = (struct GNUNET_MessageHeader *) q->cls; | 1344 | msg = (struct GNUNET_MessageHeader *) q->cls; |
1345 | GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0); | 1345 | GCP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0); |
1346 | return msg; | 1346 | return msg; |
1347 | 1347 | ||
1348 | default: | 1348 | default: |
@@ -1355,7 +1355,7 @@ GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) | |||
1355 | 1355 | ||
1356 | 1356 | ||
1357 | void | 1357 | void |
1358 | GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) | 1358 | GCP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) |
1359 | { | 1359 | { |
1360 | struct CadetPeerQueue *q; | 1360 | struct CadetPeerQueue *q; |
1361 | size_t size; | 1361 | size_t size; |
@@ -1391,7 +1391,7 @@ GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) | |||
1391 | * @param c Configuration. | 1391 | * @param c Configuration. |
1392 | */ | 1392 | */ |
1393 | void | 1393 | void |
1394 | GMP_init (const struct GNUNET_CONFIGURATION_Handle *c) | 1394 | GCP_init (const struct GNUNET_CONFIGURATION_Handle *c) |
1395 | { | 1395 | { |
1396 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); | 1396 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); |
1397 | peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 1397 | peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
@@ -1460,7 +1460,7 @@ GMP_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1460 | * Shut down the peer subsystem. | 1460 | * Shut down the peer subsystem. |
1461 | */ | 1461 | */ |
1462 | void | 1462 | void |
1463 | GMP_shutdown (void) | 1463 | GCP_shutdown (void) |
1464 | { | 1464 | { |
1465 | GNUNET_CONTAINER_multipeermap_iterate (peers, &shutdown_tunnel, NULL); | 1465 | GNUNET_CONTAINER_multipeermap_iterate (peers, &shutdown_tunnel, NULL); |
1466 | 1466 | ||
@@ -1486,7 +1486,7 @@ GMP_shutdown (void) | |||
1486 | * @return Existing or newly created peer structure. | 1486 | * @return Existing or newly created peer structure. |
1487 | */ | 1487 | */ |
1488 | struct CadetPeer * | 1488 | struct CadetPeer * |
1489 | GMP_get (const struct GNUNET_PeerIdentity *peer_id) | 1489 | GCP_get (const struct GNUNET_PeerIdentity *peer_id) |
1490 | { | 1490 | { |
1491 | struct CadetPeer *peer; | 1491 | struct CadetPeer *peer; |
1492 | 1492 | ||
@@ -1517,9 +1517,9 @@ GMP_get (const struct GNUNET_PeerIdentity *peer_id) | |||
1517 | * @return Existing or newly created peer structure. | 1517 | * @return Existing or newly created peer structure. |
1518 | */ | 1518 | */ |
1519 | struct CadetPeer * | 1519 | struct CadetPeer * |
1520 | GMP_get_short (const GNUNET_PEER_Id peer) | 1520 | GCP_get_short (const GNUNET_PEER_Id peer) |
1521 | { | 1521 | { |
1522 | return GMP_get (GNUNET_PEER_resolve2 (peer)); | 1522 | return GCP_get (GNUNET_PEER_resolve2 (peer)); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | 1525 | ||
@@ -1550,17 +1550,17 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1550 | * @param peer Peer to connect to. | 1550 | * @param peer Peer to connect to. |
1551 | */ | 1551 | */ |
1552 | void | 1552 | void |
1553 | GMP_connect (struct CadetPeer *peer) | 1553 | GCP_connect (struct CadetPeer *peer) |
1554 | { | 1554 | { |
1555 | struct CadetTunnel3 *t; | 1555 | struct CadetTunnel3 *t; |
1556 | struct CadetPeerPath *p; | 1556 | struct CadetPeerPath *p; |
1557 | struct CadetConnection *c; | 1557 | struct CadetConnection *c; |
1558 | int rerun_search; | 1558 | int rerun_search; |
1559 | 1559 | ||
1560 | LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer)); | 1560 | LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GCP_2s (peer)); |
1561 | 1561 | ||
1562 | /* If we have a current hello, try to connect using it. */ | 1562 | /* If we have a current hello, try to connect using it. */ |
1563 | GMP_try_connect (peer); | 1563 | GCP_try_connect (peer); |
1564 | 1564 | ||
1565 | t = peer->tunnel; | 1565 | t = peer->tunnel; |
1566 | c = NULL; | 1566 | c = NULL; |
@@ -1578,7 +1578,7 @@ GMP_connect (struct CadetPeer *peer) | |||
1578 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path to use: %s\n", s); | 1578 | LOG (GNUNET_ERROR_TYPE_DEBUG, " path to use: %s\n", s); |
1579 | GNUNET_free (s); | 1579 | GNUNET_free (s); |
1580 | 1580 | ||
1581 | c = GMT_use_path (t, p); | 1581 | c = GCT_use_path (t, p); |
1582 | if (NULL == c) | 1582 | if (NULL == c) |
1583 | { | 1583 | { |
1584 | /* This case can happen when the path includes a first hop that is | 1584 | /* This case can happen when the path includes a first hop that is |
@@ -1593,14 +1593,14 @@ GMP_connect (struct CadetPeer *peer) | |||
1593 | * | 1593 | * |
1594 | * Re-running the DHT GET should give core time to callback. | 1594 | * Re-running the DHT GET should give core time to callback. |
1595 | * | 1595 | * |
1596 | * GMT_use_path -> GMC_new -> register_neighbors takes care of | 1596 | * GCT_use_path -> GCC_new -> register_neighbors takes care of |
1597 | * updating statistics about this issue. | 1597 | * updating statistics about this issue. |
1598 | */ | 1598 | */ |
1599 | rerun_search = GNUNET_YES; | 1599 | rerun_search = GNUNET_YES; |
1600 | } | 1600 | } |
1601 | else | 1601 | else |
1602 | { | 1602 | { |
1603 | GMC_send_create (c); | 1603 | GCC_send_create (c); |
1604 | return; | 1604 | return; |
1605 | } | 1605 | } |
1606 | } | 1606 | } |
@@ -1612,11 +1612,11 @@ GMP_connect (struct CadetPeer *peer) | |||
1612 | 1612 | ||
1613 | if (NULL != peer->search_h && GNUNET_YES == rerun_search) | 1613 | if (NULL != peer->search_h && GNUNET_YES == rerun_search) |
1614 | { | 1614 | { |
1615 | GMD_search_stop (peer->search_h); | 1615 | GCD_search_stop (peer->search_h); |
1616 | peer->search_h = NULL; | 1616 | peer->search_h = NULL; |
1617 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1617 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1618 | " Stopping DHT GET for peer %s\n", | 1618 | " Stopping DHT GET for peer %s\n", |
1619 | GMP_2s (peer)); | 1619 | GCP_2s (peer)); |
1620 | } | 1620 | } |
1621 | 1621 | ||
1622 | if (NULL == peer->search_h) | 1622 | if (NULL == peer->search_h) |
@@ -1625,10 +1625,10 @@ GMP_connect (struct CadetPeer *peer) | |||
1625 | 1625 | ||
1626 | id = GNUNET_PEER_resolve2 (peer->id); | 1626 | id = GNUNET_PEER_resolve2 (peer->id); |
1627 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1627 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1628 | " Starting DHT GET for peer %s\n", GMP_2s (peer)); | 1628 | " Starting DHT GET for peer %s\n", GCP_2s (peer)); |
1629 | peer->search_h = GMD_search (id, &search_handler, peer); | 1629 | peer->search_h = GCD_search (id, &search_handler, peer); |
1630 | if (CADET_TUNNEL3_NEW == GMT_get_cstate (t)) | 1630 | if (CADET_TUNNEL3_NEW == GCT_get_cstate (t)) |
1631 | GMT_change_cstate (t, CADET_TUNNEL3_SEARCHING); | 1631 | GCT_change_cstate (t, CADET_TUNNEL3_SEARCHING); |
1632 | } | 1632 | } |
1633 | } | 1633 | } |
1634 | 1634 | ||
@@ -1641,7 +1641,7 @@ GMP_connect (struct CadetPeer *peer) | |||
1641 | * @return #GNUNET_YES if there is a direct connection. | 1641 | * @return #GNUNET_YES if there is a direct connection. |
1642 | */ | 1642 | */ |
1643 | int | 1643 | int |
1644 | GMP_is_neighbor (const struct CadetPeer *peer) | 1644 | GCP_is_neighbor (const struct CadetPeer *peer) |
1645 | { | 1645 | { |
1646 | struct CadetPeerPath *path; | 1646 | struct CadetPeerPath *path; |
1647 | 1647 | ||
@@ -1668,11 +1668,11 @@ GMP_is_neighbor (const struct CadetPeer *peer) | |||
1668 | * @param peer Peer towards which to create the tunnel. | 1668 | * @param peer Peer towards which to create the tunnel. |
1669 | */ | 1669 | */ |
1670 | void | 1670 | void |
1671 | GMP_add_tunnel (struct CadetPeer *peer) | 1671 | GCP_add_tunnel (struct CadetPeer *peer) |
1672 | { | 1672 | { |
1673 | if (NULL != peer->tunnel) | 1673 | if (NULL != peer->tunnel) |
1674 | return; | 1674 | return; |
1675 | peer->tunnel = GMT_new (peer); | 1675 | peer->tunnel = GCT_new (peer); |
1676 | } | 1676 | } |
1677 | 1677 | ||
1678 | 1678 | ||
@@ -1689,26 +1689,26 @@ GMP_add_tunnel (struct CadetPeer *peer) | |||
1689 | * @return GNUNET_OK on success. | 1689 | * @return GNUNET_OK on success. |
1690 | */ | 1690 | */ |
1691 | int | 1691 | int |
1692 | GMP_add_connection (struct CadetPeer *peer, | 1692 | GCP_add_connection (struct CadetPeer *peer, |
1693 | struct CadetConnection *c) | 1693 | struct CadetConnection *c) |
1694 | { | 1694 | { |
1695 | int result; | 1695 | int result; |
1696 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GMC_2s (c)); | 1696 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GCC_2s (c)); |
1697 | LOG (GNUNET_ERROR_TYPE_DEBUG, "to peer %s\n", GMP_2s (peer)); | 1697 | LOG (GNUNET_ERROR_TYPE_DEBUG, "to peer %s\n", GCP_2s (peer)); |
1698 | 1698 | ||
1699 | if (NULL == peer->connections) | 1699 | if (NULL == peer->connections) |
1700 | { | 1700 | { |
1701 | GNUNET_break (0); | 1701 | GNUNET_break (0); |
1702 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1702 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1703 | "Peer %s is not a neighbor!\n", | 1703 | "Peer %s is not a neighbor!\n", |
1704 | GMP_2s (peer)); | 1704 | GCP_2s (peer)); |
1705 | return GNUNET_SYSERR; | 1705 | return GNUNET_SYSERR; |
1706 | } | 1706 | } |
1707 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1707 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1708 | "peer %s ok, has %u connections.\n", | 1708 | "peer %s ok, has %u connections.\n", |
1709 | GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); | 1709 | GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); |
1710 | result = GNUNET_CONTAINER_multihashmap_put (peer->connections, | 1710 | result = GNUNET_CONTAINER_multihashmap_put (peer->connections, |
1711 | GMC_get_h (c), | 1711 | GCC_get_h (c), |
1712 | c, | 1712 | c, |
1713 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1713 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1714 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1714 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1733,7 +1733,7 @@ GMP_add_connection (struct CadetPeer *peer, | |||
1733 | * NULL on error. | 1733 | * NULL on error. |
1734 | */ | 1734 | */ |
1735 | struct CadetPeerPath * | 1735 | struct CadetPeerPath * |
1736 | GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | 1736 | GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, |
1737 | int trusted) | 1737 | int trusted) |
1738 | { | 1738 | { |
1739 | struct CadetPeerPath *aux; | 1739 | struct CadetPeerPath *aux; |
@@ -1741,7 +1741,7 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | |||
1741 | unsigned int l2; | 1741 | unsigned int l2; |
1742 | 1742 | ||
1743 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", | 1743 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", |
1744 | path->length, GMP_2s (peer)); | 1744 | path->length, GCP_2s (peer)); |
1745 | 1745 | ||
1746 | if ((NULL == peer) || (NULL == path)) | 1746 | if ((NULL == peer) || (NULL == path)) |
1747 | { | 1747 | { |
@@ -1797,9 +1797,9 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | |||
1797 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added\n"); | 1797 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added\n"); |
1798 | GNUNET_CONTAINER_DLL_insert_before (peer->path_head, | 1798 | GNUNET_CONTAINER_DLL_insert_before (peer->path_head, |
1799 | peer->path_tail, aux, path); | 1799 | peer->path_tail, aux, path); |
1800 | if (NULL != peer->tunnel && 3 < GMT_count_connections (peer->tunnel)) | 1800 | if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel)) |
1801 | { | 1801 | { |
1802 | GMP_connect (peer); | 1802 | GCP_connect (peer); |
1803 | } | 1803 | } |
1804 | return path; | 1804 | return path; |
1805 | } | 1805 | } |
@@ -1816,9 +1816,9 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | |||
1816 | GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, peer->path_tail, | 1816 | GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, peer->path_tail, |
1817 | path); | 1817 | path); |
1818 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n"); | 1818 | LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n"); |
1819 | if (NULL != peer->tunnel && 3 < GMT_count_connections (peer->tunnel)) | 1819 | if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel)) |
1820 | { | 1820 | { |
1821 | GMP_connect (peer); | 1821 | GCP_connect (peer); |
1822 | } | 1822 | } |
1823 | return path; | 1823 | return path; |
1824 | } | 1824 | } |
@@ -1839,14 +1839,14 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | |||
1839 | * NULL on error. | 1839 | * NULL on error. |
1840 | */ | 1840 | */ |
1841 | struct CadetPeerPath * | 1841 | struct CadetPeerPath * |
1842 | GMP_add_path_to_origin (struct CadetPeer *peer, | 1842 | GCP_add_path_to_origin (struct CadetPeer *peer, |
1843 | struct CadetPeerPath *path, | 1843 | struct CadetPeerPath *path, |
1844 | int trusted) | 1844 | int trusted) |
1845 | { | 1845 | { |
1846 | if (NULL == path) | 1846 | if (NULL == path) |
1847 | return NULL; | 1847 | return NULL; |
1848 | path_invert (path); | 1848 | path_invert (path); |
1849 | return GMP_add_path (peer, path, trusted); | 1849 | return GCP_add_path (peer, path, trusted); |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | 1852 | ||
@@ -1857,7 +1857,7 @@ GMP_add_path_to_origin (struct CadetPeer *peer, | |||
1857 | * @param confirmed Whether we know if the path works or not. | 1857 | * @param confirmed Whether we know if the path works or not. |
1858 | */ | 1858 | */ |
1859 | void | 1859 | void |
1860 | GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) | 1860 | GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) |
1861 | { | 1861 | { |
1862 | unsigned int i; | 1862 | unsigned int i; |
1863 | 1863 | ||
@@ -1868,10 +1868,10 @@ GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) | |||
1868 | struct CadetPeer *aux; | 1868 | struct CadetPeer *aux; |
1869 | struct CadetPeerPath *copy; | 1869 | struct CadetPeerPath *copy; |
1870 | 1870 | ||
1871 | aux = GMP_get_short (p->peers[i]); | 1871 | aux = GCP_get_short (p->peers[i]); |
1872 | copy = path_duplicate (p); | 1872 | copy = path_duplicate (p); |
1873 | copy->length = i + 1; | 1873 | copy->length = i + 1; |
1874 | GMP_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); | 1874 | GCP_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); |
1875 | } | 1875 | } |
1876 | } | 1876 | } |
1877 | 1877 | ||
@@ -1883,7 +1883,7 @@ GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) | |||
1883 | * @param path Path to remove. Is always destroyed . | 1883 | * @param path Path to remove. Is always destroyed . |
1884 | */ | 1884 | */ |
1885 | void | 1885 | void |
1886 | GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | 1886 | GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) |
1887 | { | 1887 | { |
1888 | struct CadetPeerPath *iter; | 1888 | struct CadetPeerPath *iter; |
1889 | struct CadetPeerPath *next; | 1889 | struct CadetPeerPath *next; |
@@ -1915,25 +1915,25 @@ GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | |||
1915 | * @return GNUNET_OK on success. | 1915 | * @return GNUNET_OK on success. |
1916 | */ | 1916 | */ |
1917 | int | 1917 | int |
1918 | GMP_remove_connection (struct CadetPeer *peer, | 1918 | GCP_remove_connection (struct CadetPeer *peer, |
1919 | const struct CadetConnection *c) | 1919 | const struct CadetConnection *c) |
1920 | { | 1920 | { |
1921 | LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GMC_2s (c)); | 1921 | LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GCC_2s (c)); |
1922 | LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GMP_2s (peer)); | 1922 | LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GCP_2s (peer)); |
1923 | 1923 | ||
1924 | if (NULL == peer || NULL == peer->connections) | 1924 | if (NULL == peer || NULL == peer->connections) |
1925 | { | 1925 | { |
1926 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1926 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1927 | "Peer %s is not a neighbor!\n", | 1927 | "Peer %s is not a neighbor!\n", |
1928 | GMP_2s (peer)); | 1928 | GCP_2s (peer)); |
1929 | return GNUNET_SYSERR; | 1929 | return GNUNET_SYSERR; |
1930 | } | 1930 | } |
1931 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1931 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1932 | "peer %s ok, has %u connections.\n", | 1932 | "peer %s ok, has %u connections.\n", |
1933 | GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); | 1933 | GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); |
1934 | 1934 | ||
1935 | return GNUNET_CONTAINER_multihashmap_remove (peer->connections, | 1935 | return GNUNET_CONTAINER_multihashmap_remove (peer->connections, |
1936 | GMC_get_h (c), | 1936 | GCC_get_h (c), |
1937 | c); | 1937 | c); |
1938 | } | 1938 | } |
1939 | 1939 | ||
@@ -1944,7 +1944,7 @@ GMP_remove_connection (struct CadetPeer *peer, | |||
1944 | * @param peer Destination peer. | 1944 | * @param peer Destination peer. |
1945 | */ | 1945 | */ |
1946 | void | 1946 | void |
1947 | GMP_start_search (struct CadetPeer *peer) | 1947 | GCP_start_search (struct CadetPeer *peer) |
1948 | { | 1948 | { |
1949 | if (NULL != peer->search_h) | 1949 | if (NULL != peer->search_h) |
1950 | { | 1950 | { |
@@ -1952,7 +1952,7 @@ GMP_start_search (struct CadetPeer *peer) | |||
1952 | return; | 1952 | return; |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | peer->search_h = GMD_search (GMP_get_id (peer), &search_handler, peer); | 1955 | peer->search_h = GCD_search (GCP_get_id (peer), &search_handler, peer); |
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | 1958 | ||
@@ -1963,14 +1963,14 @@ GMP_start_search (struct CadetPeer *peer) | |||
1963 | * @param peer Destination peer. | 1963 | * @param peer Destination peer. |
1964 | */ | 1964 | */ |
1965 | void | 1965 | void |
1966 | GMP_stop_search (struct CadetPeer *peer) | 1966 | GCP_stop_search (struct CadetPeer *peer) |
1967 | { | 1967 | { |
1968 | if (NULL == peer->search_h) | 1968 | if (NULL == peer->search_h) |
1969 | { | 1969 | { |
1970 | return; | 1970 | return; |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | GMD_search_stop (peer->search_h); | 1973 | GCD_search_stop (peer->search_h); |
1974 | peer->search_h = NULL; | 1974 | peer->search_h = NULL; |
1975 | } | 1975 | } |
1976 | 1976 | ||
@@ -1983,7 +1983,7 @@ GMP_stop_search (struct CadetPeer *peer) | |||
1983 | * @return Full ID of peer. | 1983 | * @return Full ID of peer. |
1984 | */ | 1984 | */ |
1985 | const struct GNUNET_PeerIdentity * | 1985 | const struct GNUNET_PeerIdentity * |
1986 | GMP_get_id (const struct CadetPeer *peer) | 1986 | GCP_get_id (const struct CadetPeer *peer) |
1987 | { | 1987 | { |
1988 | return GNUNET_PEER_resolve2 (peer->id); | 1988 | return GNUNET_PEER_resolve2 (peer->id); |
1989 | } | 1989 | } |
@@ -1997,7 +1997,7 @@ GMP_get_id (const struct CadetPeer *peer) | |||
1997 | * @return Short ID of peer. | 1997 | * @return Short ID of peer. |
1998 | */ | 1998 | */ |
1999 | GNUNET_PEER_Id | 1999 | GNUNET_PEER_Id |
2000 | GMP_get_short_id (const struct CadetPeer *peer) | 2000 | GCP_get_short_id (const struct CadetPeer *peer) |
2001 | { | 2001 | { |
2002 | return peer->id; | 2002 | return peer->id; |
2003 | } | 2003 | } |
@@ -2010,12 +2010,12 @@ GMP_get_short_id (const struct CadetPeer *peer) | |||
2010 | * @param t Tunnel. | 2010 | * @param t Tunnel. |
2011 | */ | 2011 | */ |
2012 | void | 2012 | void |
2013 | GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) | 2013 | GCP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) |
2014 | { | 2014 | { |
2015 | peer->tunnel = t; | 2015 | peer->tunnel = t; |
2016 | if (NULL == t && NULL != peer->search_h) | 2016 | if (NULL == t && NULL != peer->search_h) |
2017 | { | 2017 | { |
2018 | GMP_stop_search (peer); | 2018 | GCP_stop_search (peer); |
2019 | } | 2019 | } |
2020 | } | 2020 | } |
2021 | 2021 | ||
@@ -2028,7 +2028,7 @@ GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) | |||
2028 | * @return Tunnel towards peer. | 2028 | * @return Tunnel towards peer. |
2029 | */ | 2029 | */ |
2030 | struct CadetTunnel3 * | 2030 | struct CadetTunnel3 * |
2031 | GMP_get_tunnel (const struct CadetPeer *peer) | 2031 | GCP_get_tunnel (const struct CadetPeer *peer) |
2032 | { | 2032 | { |
2033 | return peer->tunnel; | 2033 | return peer->tunnel; |
2034 | } | 2034 | } |
@@ -2041,16 +2041,16 @@ GMP_get_tunnel (const struct CadetPeer *peer) | |||
2041 | * @param hello Hello message. | 2041 | * @param hello Hello message. |
2042 | */ | 2042 | */ |
2043 | void | 2043 | void |
2044 | GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) | 2044 | GCP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) |
2045 | { | 2045 | { |
2046 | struct GNUNET_HELLO_Message *old; | 2046 | struct GNUNET_HELLO_Message *old; |
2047 | size_t size; | 2047 | size_t size; |
2048 | 2048 | ||
2049 | LOG (GNUNET_ERROR_TYPE_DEBUG, "set hello for %s\n", GMP_2s (peer)); | 2049 | LOG (GNUNET_ERROR_TYPE_DEBUG, "set hello for %s\n", GCP_2s (peer)); |
2050 | if (NULL == hello) | 2050 | if (NULL == hello) |
2051 | return; | 2051 | return; |
2052 | 2052 | ||
2053 | old = GMP_get_hello (peer); | 2053 | old = GCP_get_hello (peer); |
2054 | if (NULL == old) | 2054 | if (NULL == old) |
2055 | { | 2055 | { |
2056 | size = GNUNET_HELLO_size (hello); | 2056 | size = GNUNET_HELLO_size (hello); |
@@ -2076,7 +2076,7 @@ GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) | |||
2076 | * @return Hello message. | 2076 | * @return Hello message. |
2077 | */ | 2077 | */ |
2078 | struct GNUNET_HELLO_Message * | 2078 | struct GNUNET_HELLO_Message * |
2079 | GMP_get_hello (struct CadetPeer *peer) | 2079 | GCP_get_hello (struct CadetPeer *peer) |
2080 | { | 2080 | { |
2081 | struct GNUNET_TIME_Absolute expiration; | 2081 | struct GNUNET_TIME_Absolute expiration; |
2082 | struct GNUNET_TIME_Relative remaining; | 2082 | struct GNUNET_TIME_Relative remaining; |
@@ -2103,7 +2103,7 @@ GMP_get_hello (struct CadetPeer *peer) | |||
2103 | * @param peer Peer to whom to connect. | 2103 | * @param peer Peer to whom to connect. |
2104 | */ | 2104 | */ |
2105 | void | 2105 | void |
2106 | GMP_try_connect (struct CadetPeer *peer) | 2106 | GCP_try_connect (struct CadetPeer *peer) |
2107 | { | 2107 | { |
2108 | struct GNUNET_HELLO_Message *hello; | 2108 | struct GNUNET_HELLO_Message *hello; |
2109 | struct GNUNET_MessageHeader *mh; | 2109 | struct GNUNET_MessageHeader *mh; |
@@ -2111,7 +2111,7 @@ GMP_try_connect (struct CadetPeer *peer) | |||
2111 | if (NULL == transport_handle) | 2111 | if (NULL == transport_handle) |
2112 | return; | 2112 | return; |
2113 | 2113 | ||
2114 | hello = GMP_get_hello (peer); | 2114 | hello = GCP_get_hello (peer); |
2115 | if (NULL == hello) | 2115 | if (NULL == hello) |
2116 | return; | 2116 | return; |
2117 | 2117 | ||
@@ -2129,7 +2129,7 @@ GMP_try_connect (struct CadetPeer *peer) | |||
2129 | * @param peer2 Peer whose link is broken. | 2129 | * @param peer2 Peer whose link is broken. |
2130 | */ | 2130 | */ |
2131 | void | 2131 | void |
2132 | GMP_notify_broken_link (struct CadetPeer *peer, | 2132 | GCP_notify_broken_link (struct CadetPeer *peer, |
2133 | struct GNUNET_PeerIdentity *peer1, | 2133 | struct GNUNET_PeerIdentity *peer1, |
2134 | struct GNUNET_PeerIdentity *peer2) | 2134 | struct GNUNET_PeerIdentity *peer2) |
2135 | { | 2135 | { |
@@ -2178,7 +2178,7 @@ GMP_notify_broken_link (struct CadetPeer *peer, | |||
2178 | * @return Number of known paths. | 2178 | * @return Number of known paths. |
2179 | */ | 2179 | */ |
2180 | unsigned int | 2180 | unsigned int |
2181 | GMP_count_paths (const struct CadetPeer *peer) | 2181 | GCP_count_paths (const struct CadetPeer *peer) |
2182 | { | 2182 | { |
2183 | struct CadetPeerPath *iter; | 2183 | struct CadetPeerPath *iter; |
2184 | unsigned int i; | 2184 | unsigned int i; |
@@ -2197,7 +2197,7 @@ GMP_count_paths (const struct CadetPeer *peer) | |||
2197 | * @param cls Closure for @c iter. | 2197 | * @param cls Closure for @c iter. |
2198 | */ | 2198 | */ |
2199 | void | 2199 | void |
2200 | GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) | 2200 | GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) |
2201 | { | 2201 | { |
2202 | GNUNET_CONTAINER_multipeermap_iterate (peers, iter, cls); | 2202 | GNUNET_CONTAINER_multipeermap_iterate (peers, iter, cls); |
2203 | } | 2203 | } |
@@ -2211,7 +2211,7 @@ GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) | |||
2211 | * @return Static string for it's ID. | 2211 | * @return Static string for it's ID. |
2212 | */ | 2212 | */ |
2213 | const char * | 2213 | const char * |
2214 | GMP_2s (const struct CadetPeer *peer) | 2214 | GCP_2s (const struct CadetPeer *peer) |
2215 | { | 2215 | { |
2216 | if (NULL == peer) | 2216 | if (NULL == peer) |
2217 | return "(NULL)"; | 2217 | return "(NULL)"; |