diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_tunnel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 360 |
1 files changed, 180 insertions, 180 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 15883b43e..971b186c9 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -219,7 +219,7 @@ struct CadetTunnel3Queue | |||
219 | /** | 219 | /** |
220 | * Continuation to call once sent. | 220 | * Continuation to call once sent. |
221 | */ | 221 | */ |
222 | GMT_sent cont; | 222 | GCT_sent cont; |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Closure for @c cont. | 225 | * Closure for @c cont. |
@@ -370,9 +370,9 @@ is_ready (struct CadetTunnel3 *t) | |||
370 | { | 370 | { |
371 | int ready; | 371 | int ready; |
372 | 372 | ||
373 | GMT_debug (t); | 373 | GCT_debug (t); |
374 | ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate); | 374 | ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate); |
375 | ready = ready || GMT_is_loopback (t); | 375 | ready = ready || GCT_is_loopback (t); |
376 | return ready; | 376 | return ready; |
377 | } | 377 | } |
378 | 378 | ||
@@ -418,9 +418,9 @@ get_channel_buffer (const struct CadetTChannel *tch) | |||
418 | int fwd; | 418 | int fwd; |
419 | 419 | ||
420 | /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ | 420 | /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ |
421 | fwd = GMCH_is_origin (tch->ch, GNUNET_YES); | 421 | fwd = GCCH_is_origin (tch->ch, GNUNET_YES); |
422 | 422 | ||
423 | return GMCH_get_buffer (tch->ch, fwd); | 423 | return GCCH_get_buffer (tch->ch, fwd); |
424 | } | 424 | } |
425 | 425 | ||
426 | 426 | ||
@@ -437,9 +437,9 @@ get_channel_allowed (const struct CadetTChannel *tch) | |||
437 | int fwd; | 437 | int fwd; |
438 | 438 | ||
439 | /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ | 439 | /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ |
440 | fwd = GMCH_is_origin (tch->ch, GNUNET_YES); | 440 | fwd = GCCH_is_origin (tch->ch, GNUNET_YES); |
441 | 441 | ||
442 | return GMCH_get_allowed (tch->ch, fwd); | 442 | return GCCH_get_allowed (tch->ch, fwd); |
443 | } | 443 | } |
444 | 444 | ||
445 | 445 | ||
@@ -456,9 +456,9 @@ get_connection_buffer (const struct CadetTConnection *tc) | |||
456 | int fwd; | 456 | int fwd; |
457 | 457 | ||
458 | /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ | 458 | /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ |
459 | fwd = GMC_is_origin (tc->c, GNUNET_YES); | 459 | fwd = GCC_is_origin (tc->c, GNUNET_YES); |
460 | 460 | ||
461 | return GMC_get_buffer (tc->c, fwd); | 461 | return GCC_get_buffer (tc->c, fwd); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
@@ -475,9 +475,9 @@ get_connection_allowed (const struct CadetTConnection *tc) | |||
475 | int fwd; | 475 | int fwd; |
476 | 476 | ||
477 | /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ | 477 | /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ |
478 | fwd = GMC_is_origin (tc->c, GNUNET_YES); | 478 | fwd = GCC_is_origin (tc->c, GNUNET_YES); |
479 | 479 | ||
480 | return GMC_get_allowed (tc->c, fwd); | 480 | return GCC_get_allowed (tc->c, fwd); |
481 | } | 481 | } |
482 | 482 | ||
483 | 483 | ||
@@ -503,7 +503,7 @@ check_ephemeral (struct CadetTunnel3 *t, | |||
503 | 503 | ||
504 | /* Check origin */ | 504 | /* Check origin */ |
505 | if (0 != memcmp (&msg->origin_identity, | 505 | if (0 != memcmp (&msg->origin_identity, |
506 | GMP_get_id (t->peer), | 506 | GCP_get_id (t->peer), |
507 | sizeof (struct GNUNET_PeerIdentity))) | 507 | sizeof (struct GNUNET_PeerIdentity))) |
508 | return GNUNET_SYSERR; | 508 | return GNUNET_SYSERR; |
509 | 509 | ||
@@ -578,8 +578,8 @@ t_decrypt (struct CadetTunnel3 *t, | |||
578 | GNUNET_STATISTICS_update (stats, "# non decryptable data", 1, GNUNET_NO); | 578 | GNUNET_STATISTICS_update (stats, "# non decryptable data", 1, GNUNET_NO); |
579 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 579 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
580 | "WARNING got data on %s without a valid key\n", | 580 | "WARNING got data on %s without a valid key\n", |
581 | GMT_2s (t)); | 581 | GCT_2s (t)); |
582 | GMT_debug (t); | 582 | GCT_debug (t); |
583 | return 0; | 583 | return 0; |
584 | } | 584 | } |
585 | 585 | ||
@@ -652,16 +652,16 @@ tunnel_get_connection (struct CadetTunnel3 *t) | |||
652 | unsigned int qn; | 652 | unsigned int qn; |
653 | unsigned int lowest_q; | 653 | unsigned int lowest_q; |
654 | 654 | ||
655 | LOG (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n", GMT_2s (t)); | 655 | LOG (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n", GCT_2s (t)); |
656 | best = NULL; | 656 | best = NULL; |
657 | lowest_q = UINT_MAX; | 657 | lowest_q = UINT_MAX; |
658 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | 658 | for (iter = t->connection_head; NULL != iter; iter = iter->next) |
659 | { | 659 | { |
660 | LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n", | 660 | LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n", |
661 | GMC_2s (iter->c), GMC_get_state (iter->c)); | 661 | GCC_2s (iter->c), GCC_get_state (iter->c)); |
662 | if (CADET_CONNECTION_READY == GMC_get_state (iter->c)) | 662 | if (CADET_CONNECTION_READY == GCC_get_state (iter->c)) |
663 | { | 663 | { |
664 | qn = GMC_get_qn (iter->c, GMC_is_origin (iter->c, GNUNET_YES)); | 664 | qn = GCC_get_qn (iter->c, GCC_is_origin (iter->c, GNUNET_YES)); |
665 | LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn); | 665 | LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn); |
666 | if (qn < lowest_q) | 666 | if (qn < lowest_q) |
667 | { | 667 | { |
@@ -670,7 +670,7 @@ tunnel_get_connection (struct CadetTunnel3 *t) | |||
670 | } | 670 | } |
671 | } | 671 | } |
672 | } | 672 | } |
673 | LOG (GNUNET_ERROR_TYPE_DEBUG, " selected: connection %s\n", GMC_2s (best)); | 673 | LOG (GNUNET_ERROR_TYPE_DEBUG, " selected: connection %s\n", GCC_2s (best)); |
674 | return best; | 674 | return best; |
675 | } | 675 | } |
676 | 676 | ||
@@ -699,7 +699,7 @@ tun_message_sent (void *cls, | |||
699 | LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n"); | 699 | LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n"); |
700 | 700 | ||
701 | GNUNET_assert (NULL != qt->cont); | 701 | GNUNET_assert (NULL != qt->cont); |
702 | t = NULL == c ? NULL : GMC_get_tunnel (c); | 702 | t = NULL == c ? NULL : GCC_get_tunnel (c); |
703 | qt->cont (qt->cont_cls, t, qt, type, size); | 703 | qt->cont (qt->cont_cls, t, qt, type, size); |
704 | GNUNET_free (qt); | 704 | GNUNET_free (qt); |
705 | } | 705 | } |
@@ -731,7 +731,7 @@ queue_data (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *msg) | |||
731 | struct CadetTunnelDelayed *tqd; | 731 | struct CadetTunnelDelayed *tqd; |
732 | uint16_t size = ntohs (msg->size); | 732 | uint16_t size = ntohs (msg->size); |
733 | 733 | ||
734 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t)); | 734 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GCT_2s (t)); |
735 | 735 | ||
736 | if (GNUNET_YES == is_ready (t)) | 736 | if (GNUNET_YES == is_ready (t)) |
737 | { | 737 | { |
@@ -797,7 +797,7 @@ t_hmac (struct CadetTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, | |||
797 | static struct CadetTunnel3Queue * | 797 | static struct CadetTunnel3Queue * |
798 | send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 798 | send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
799 | struct CadetTunnel3 *t, struct CadetConnection *c, | 799 | struct CadetTunnel3 *t, struct CadetConnection *c, |
800 | int force, GMT_sent cont, void *cont_cls, | 800 | int force, GCT_sent cont, void *cont_cls, |
801 | struct CadetTunnel3Queue *existing_q) | 801 | struct CadetTunnel3Queue *existing_q) |
802 | { | 802 | { |
803 | struct CadetTunnel3Queue *tq; | 803 | struct CadetTunnel3Queue *tq; |
@@ -809,7 +809,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
809 | uint16_t type; | 809 | uint16_t type; |
810 | int fwd; | 810 | int fwd; |
811 | 811 | ||
812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT Send on Tunnel %s\n", GMT_2s (t)); | 812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT Send on Tunnel %s\n", GCT_2s (t)); |
813 | 813 | ||
814 | if (GNUNET_NO == is_ready (t)) | 814 | if (GNUNET_NO == is_ready (t)) |
815 | { | 815 | { |
@@ -829,7 +829,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
829 | return tq; | 829 | return tq; |
830 | } | 830 | } |
831 | 831 | ||
832 | GNUNET_assert (GNUNET_NO == GMT_is_loopback (t)); | 832 | GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); |
833 | 833 | ||
834 | iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 834 | iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
835 | msg = (struct GNUNET_CADET_Encrypted *) cbuf; | 835 | msg = (struct GNUNET_CADET_Encrypted *) cbuf; |
@@ -847,7 +847,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
847 | || CADET_TUNNEL3_SEARCHING != t->cstate) | 847 | || CADET_TUNNEL3_SEARCHING != t->cstate) |
848 | { | 848 | { |
849 | GNUNET_break (0); | 849 | GNUNET_break (0); |
850 | GMT_debug (t); | 850 | GCT_debug (t); |
851 | } | 851 | } |
852 | return NULL; | 852 | return NULL; |
853 | } | 853 | } |
@@ -868,20 +868,20 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
868 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 868 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
869 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 869 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: |
870 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 870 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: |
871 | msg->cid = *GMC_get_id (c); | 871 | msg->cid = *GCC_get_id (c); |
872 | msg->ttl = htonl (default_ttl); | 872 | msg->ttl = htonl (default_ttl); |
873 | break; | 873 | break; |
874 | default: | 874 | default: |
875 | GNUNET_break (0); | 875 | GNUNET_break (0); |
876 | } | 876 | } |
877 | LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GM_m2s (type)); | 877 | LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GC_m2s (type)); |
878 | 878 | ||
879 | fwd = GMC_is_origin (c, GNUNET_YES); | 879 | fwd = GCC_is_origin (c, GNUNET_YES); |
880 | 880 | ||
881 | if (NULL == cont) | 881 | if (NULL == cont) |
882 | { | 882 | { |
883 | GNUNET_break (NULL == | 883 | GNUNET_break (NULL == |
884 | GMC_send_prebuilt_message (&msg->header, type, mid, | 884 | GCC_send_prebuilt_message (&msg->header, type, mid, |
885 | c, fwd, force, NULL, NULL)); | 885 | c, fwd, force, NULL, NULL)); |
886 | return NULL; | 886 | return NULL; |
887 | } | 887 | } |
@@ -894,7 +894,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
894 | tq = existing_q; | 894 | tq = existing_q; |
895 | tq->tqd = NULL; | 895 | tq->tqd = NULL; |
896 | } | 896 | } |
897 | tq->cq = GMC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, | 897 | tq->cq = GCC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, |
898 | &tun_message_sent, tq); | 898 | &tun_message_sent, tq); |
899 | tq->cont = cont; | 899 | tq->cont = cont; |
900 | tq->cont_cls = cont_cls; | 900 | tq->cont_cls = cont_cls; |
@@ -916,10 +916,10 @@ send_queued_data (struct CadetTunnel3 *t) | |||
916 | unsigned int room; | 916 | unsigned int room; |
917 | 917 | ||
918 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 918 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
919 | "GMT_send_queued_data on tunnel %s\n", | 919 | "GCT_send_queued_data on tunnel %s\n", |
920 | GMT_2s (t)); | 920 | GCT_2s (t)); |
921 | 921 | ||
922 | if (GMT_is_loopback (t)) | 922 | if (GCT_is_loopback (t)) |
923 | { | 923 | { |
924 | GNUNET_break (0); | 924 | GNUNET_break (0); |
925 | return; | 925 | return; |
@@ -932,7 +932,7 @@ send_queued_data (struct CadetTunnel3 *t) | |||
932 | return; | 932 | return; |
933 | } | 933 | } |
934 | 934 | ||
935 | room = GMT_get_connections_buffer (t); | 935 | room = GCT_get_connections_buffer (t); |
936 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); | 936 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); |
937 | LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head); | 937 | LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head); |
938 | for (tqd = t->tq_head; NULL != tqd && room > 0; tqd = next) | 938 | for (tqd = t->tq_head; NULL != tqd && room > 0; tqd = next) |
@@ -947,7 +947,7 @@ send_queued_data (struct CadetTunnel3 *t) | |||
947 | tqd->tq); | 947 | tqd->tq); |
948 | unqueue_data (tqd); | 948 | unqueue_data (tqd); |
949 | } | 949 | } |
950 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_send_queued_data end\n", GMP_2s (t->peer)); | 950 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_send_queued_data end\n", GCP_2s (t->peer)); |
951 | } | 951 | } |
952 | 952 | ||
953 | 953 | ||
@@ -969,10 +969,10 @@ send_kx (struct CadetTunnel3 *t, | |||
969 | uint16_t type; | 969 | uint16_t type; |
970 | int fwd; | 970 | int fwd; |
971 | 971 | ||
972 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT KX on Tunnel %s\n", GMT_2s (t)); | 972 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT KX on Tunnel %s\n", GCT_2s (t)); |
973 | 973 | ||
974 | /* Avoid loopback. */ | 974 | /* Avoid loopback. */ |
975 | if (GMT_is_loopback (t)) | 975 | if (GCT_is_loopback (t)) |
976 | { | 976 | { |
977 | LOG (GNUNET_ERROR_TYPE_DEBUG, " loopback!\n"); | 977 | LOG (GNUNET_ERROR_TYPE_DEBUG, " loopback!\n"); |
978 | GNUNET_break (0); | 978 | GNUNET_break (0); |
@@ -988,7 +988,7 @@ send_kx (struct CadetTunnel3 *t, | |||
988 | if (NULL == t->connection_head) | 988 | if (NULL == t->connection_head) |
989 | { | 989 | { |
990 | GNUNET_break (CADET_TUNNEL3_SEARCHING == t->cstate); | 990 | GNUNET_break (CADET_TUNNEL3_SEARCHING == t->cstate); |
991 | GMT_debug (t); | 991 | GCT_debug (t); |
992 | return; | 992 | return; |
993 | } | 993 | } |
994 | 994 | ||
@@ -1000,7 +1000,7 @@ send_kx (struct CadetTunnel3 *t, | |||
1000 | { | 1000 | { |
1001 | GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task | 1001 | GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task |
1002 | || CADET_TUNNEL3_READY != t->cstate); | 1002 | || CADET_TUNNEL3_READY != t->cstate); |
1003 | GMT_debug (t); | 1003 | GCT_debug (t); |
1004 | return; | 1004 | return; |
1005 | } | 1005 | } |
1006 | type = ntohs (message->type); | 1006 | type = ntohs (message->type); |
@@ -1013,13 +1013,13 @@ send_kx (struct CadetTunnel3 *t, | |||
1013 | break; | 1013 | break; |
1014 | default: | 1014 | default: |
1015 | LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", | 1015 | LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", |
1016 | GM_m2s (type)); | 1016 | GC_m2s (type)); |
1017 | GNUNET_break (0); | 1017 | GNUNET_break (0); |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES); | 1020 | fwd = GCC_is_origin (t->connection_head->c, GNUNET_YES); |
1021 | /* TODO save handle and cancel in case of a unneeded retransmission */ | 1021 | /* TODO save handle and cancel in case of a unneeded retransmission */ |
1022 | GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, | 1022 | GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, |
1023 | message->type, c, fwd, GNUNET_YES, NULL, NULL); | 1023 | message->type, c, fwd, GNUNET_YES, NULL, NULL); |
1024 | } | 1024 | } |
1025 | 1025 | ||
@@ -1032,7 +1032,7 @@ send_kx (struct CadetTunnel3 *t, | |||
1032 | static void | 1032 | static void |
1033 | send_ephemeral (struct CadetTunnel3 *t) | 1033 | send_ephemeral (struct CadetTunnel3 *t) |
1034 | { | 1034 | { |
1035 | LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GMT_2s (t)); | 1035 | LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GCT_2s (t)); |
1036 | 1036 | ||
1037 | kx_msg.sender_status = htonl (t->estate); | 1037 | kx_msg.sender_status = htonl (t->estate); |
1038 | send_kx (t, &kx_msg.header); | 1038 | send_kx (t, &kx_msg.header); |
@@ -1048,11 +1048,11 @@ send_ping (struct CadetTunnel3 *t) | |||
1048 | { | 1048 | { |
1049 | struct GNUNET_CADET_KX_Ping msg; | 1049 | struct GNUNET_CADET_KX_Ping msg; |
1050 | 1050 | ||
1051 | LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GMT_2s (t)); | 1051 | LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GCT_2s (t)); |
1052 | msg.header.size = htons (sizeof (msg)); | 1052 | msg.header.size = htons (sizeof (msg)); |
1053 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PING); | 1053 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PING); |
1054 | msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 1054 | msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
1055 | msg.target = *GMP_get_id (t->peer); | 1055 | msg.target = *GCP_get_id (t->peer); |
1056 | msg.nonce = t->kx_ctx->challenge; | 1056 | msg.nonce = t->kx_ctx->challenge; |
1057 | 1057 | ||
1058 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce); | 1058 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce); |
@@ -1076,7 +1076,7 @@ send_pong (struct CadetTunnel3 *t, uint32_t challenge) | |||
1076 | { | 1076 | { |
1077 | struct GNUNET_CADET_KX_Pong msg; | 1077 | struct GNUNET_CADET_KX_Pong msg; |
1078 | 1078 | ||
1079 | LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GMT_2s (t)); | 1079 | LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GCT_2s (t)); |
1080 | msg.header.size = htons (sizeof (msg)); | 1080 | msg.header.size = htons (sizeof (msg)); |
1081 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PONG); | 1081 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PONG); |
1082 | msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 1082 | msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
@@ -1102,7 +1102,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1102 | 1102 | ||
1103 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; | 1103 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; |
1104 | 1104 | ||
1105 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Re-key Tunnel %s\n", GMT_2s (t)); | 1105 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Re-key Tunnel %s\n", GCT_2s (t)); |
1106 | if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 1106 | if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
1107 | return; | 1107 | return; |
1108 | 1108 | ||
@@ -1114,7 +1114,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1114 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 1114 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
1115 | t->kx_ctx->d_key_old = t->d_key; | 1115 | t->kx_ctx->d_key_old = t->d_key; |
1116 | LOG (GNUNET_ERROR_TYPE_DEBUG, " new challenge for %s: %u\n", | 1116 | LOG (GNUNET_ERROR_TYPE_DEBUG, " new challenge for %s: %u\n", |
1117 | GMT_2s (t), t->kx_ctx->challenge); | 1117 | GCT_2s (t), t->kx_ctx->challenge); |
1118 | } | 1118 | } |
1119 | send_ephemeral (t); | 1119 | send_ephemeral (t); |
1120 | switch (t->estate) | 1120 | switch (t->estate) |
@@ -1161,7 +1161,7 @@ rekey_iterator (void *cls, | |||
1161 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) | 1161 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) |
1162 | return GNUNET_YES; | 1162 | return GNUNET_YES; |
1163 | 1163 | ||
1164 | if (GNUNET_YES == GMT_is_loopback (t)) | 1164 | if (GNUNET_YES == GCT_is_loopback (t)) |
1165 | return GNUNET_YES; | 1165 | return GNUNET_YES; |
1166 | 1166 | ||
1167 | r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) n * 100); | 1167 | r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) n * 100); |
@@ -1227,8 +1227,8 @@ destroy_iterator (void *cls, | |||
1227 | { | 1227 | { |
1228 | struct CadetTunnel3 *t = value; | 1228 | struct CadetTunnel3 *t = value; |
1229 | 1229 | ||
1230 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_shutdown destroying tunnel at %p\n", t); | 1230 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_shutdown destroying tunnel at %p\n", t); |
1231 | GMT_destroy (t); | 1231 | GCT_destroy (t); |
1232 | return GNUNET_YES; | 1232 | return GNUNET_YES; |
1233 | } | 1233 | } |
1234 | 1234 | ||
@@ -1251,7 +1251,7 @@ send_channel_destroy (struct CadetTunnel3 *t, unsigned int gid) | |||
1251 | 1251 | ||
1252 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1252 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1253 | "WARNING destroying unknown channel %u on tunnel %s\n", | 1253 | "WARNING destroying unknown channel %u on tunnel %s\n", |
1254 | gid, GMT_2s (t)); | 1254 | gid, GCT_2s (t)); |
1255 | send_prebuilt_message (&msg.header, t, NULL, GNUNET_YES, NULL, NULL, NULL); | 1255 | send_prebuilt_message (&msg.header, t, NULL, GNUNET_YES, NULL, NULL, NULL); |
1256 | } | 1256 | } |
1257 | 1257 | ||
@@ -1284,10 +1284,10 @@ handle_data (struct CadetTunnel3 *t, | |||
1284 | return; | 1284 | return; |
1285 | } | 1285 | } |
1286 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", | 1286 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", |
1287 | GM_m2s (ntohs (msg[1].header.type))); | 1287 | GC_m2s (ntohs (msg[1].header.type))); |
1288 | 1288 | ||
1289 | /* Check channel */ | 1289 | /* Check channel */ |
1290 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1290 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1291 | if (NULL == ch) | 1291 | if (NULL == ch) |
1292 | { | 1292 | { |
1293 | GNUNET_STATISTICS_update (stats, "# data on unknown channel", | 1293 | GNUNET_STATISTICS_update (stats, "# data on unknown channel", |
@@ -1298,7 +1298,7 @@ handle_data (struct CadetTunnel3 *t, | |||
1298 | return; | 1298 | return; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | GMCH_handle_data (ch, msg, fwd); | 1301 | GCCH_handle_data (ch, msg, fwd); |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | 1304 | ||
@@ -1329,7 +1329,7 @@ handle_data_ack (struct CadetTunnel3 *t, | |||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | /* Check channel */ | 1331 | /* Check channel */ |
1332 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1332 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1333 | if (NULL == ch) | 1333 | if (NULL == ch) |
1334 | { | 1334 | { |
1335 | GNUNET_STATISTICS_update (stats, "# data ack on unknown channel", | 1335 | GNUNET_STATISTICS_update (stats, "# data ack on unknown channel", |
@@ -1339,7 +1339,7 @@ handle_data_ack (struct CadetTunnel3 *t, | |||
1339 | return; | 1339 | return; |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | GMCH_handle_data_ack (ch, msg, fwd); | 1342 | GCCH_handle_data_ack (ch, msg, fwd); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | 1345 | ||
@@ -1365,15 +1365,15 @@ handle_ch_create (struct CadetTunnel3 *t, | |||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | /* Check channel */ | 1367 | /* Check channel */ |
1368 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1368 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1369 | if (NULL != ch && ! GMT_is_loopback (t)) | 1369 | if (NULL != ch && ! GCT_is_loopback (t)) |
1370 | { | 1370 | { |
1371 | /* Probably a retransmission, safe to ignore */ | 1371 | /* Probably a retransmission, safe to ignore */ |
1372 | LOG (GNUNET_ERROR_TYPE_DEBUG, " already exists...\n"); | 1372 | LOG (GNUNET_ERROR_TYPE_DEBUG, " already exists...\n"); |
1373 | } | 1373 | } |
1374 | ch = GMCH_handle_create (t, msg); | 1374 | ch = GCCH_handle_create (t, msg); |
1375 | if (NULL != ch) | 1375 | if (NULL != ch) |
1376 | GMT_add_channel (t, ch); | 1376 | GCT_add_channel (t, ch); |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | 1379 | ||
@@ -1400,7 +1400,7 @@ handle_ch_nack (struct CadetTunnel3 *t, | |||
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | /* Check channel */ | 1402 | /* Check channel */ |
1403 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1403 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1404 | if (NULL == ch) | 1404 | if (NULL == ch) |
1405 | { | 1405 | { |
1406 | GNUNET_STATISTICS_update (stats, "# channel NACK on unknown channel", | 1406 | GNUNET_STATISTICS_update (stats, "# channel NACK on unknown channel", |
@@ -1410,7 +1410,7 @@ handle_ch_nack (struct CadetTunnel3 *t, | |||
1410 | return; | 1410 | return; |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | GMCH_handle_nack (ch); | 1413 | GCCH_handle_nack (ch); |
1414 | } | 1414 | } |
1415 | 1415 | ||
1416 | 1416 | ||
@@ -1441,7 +1441,7 @@ handle_ch_ack (struct CadetTunnel3 *t, | |||
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | /* Check channel */ | 1443 | /* Check channel */ |
1444 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1444 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1445 | if (NULL == ch) | 1445 | if (NULL == ch) |
1446 | { | 1446 | { |
1447 | GNUNET_STATISTICS_update (stats, "# channel ack on unknown channel", | 1447 | GNUNET_STATISTICS_update (stats, "# channel ack on unknown channel", |
@@ -1451,7 +1451,7 @@ handle_ch_ack (struct CadetTunnel3 *t, | |||
1451 | return; | 1451 | return; |
1452 | } | 1452 | } |
1453 | 1453 | ||
1454 | GMCH_handle_ack (ch, msg, fwd); | 1454 | GCCH_handle_ack (ch, msg, fwd); |
1455 | } | 1455 | } |
1456 | 1456 | ||
1457 | 1457 | ||
@@ -1483,14 +1483,14 @@ handle_ch_destroy (struct CadetTunnel3 *t, | |||
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | /* Check channel */ | 1485 | /* Check channel */ |
1486 | ch = GMT_get_channel (t, ntohl (msg->chid)); | 1486 | ch = GCT_get_channel (t, ntohl (msg->chid)); |
1487 | if (NULL == ch) | 1487 | if (NULL == ch) |
1488 | { | 1488 | { |
1489 | /* Probably a retransmission, safe to ignore */ | 1489 | /* Probably a retransmission, safe to ignore */ |
1490 | return; | 1490 | return; |
1491 | } | 1491 | } |
1492 | 1492 | ||
1493 | GMCH_handle_destroy (ch, msg, fwd); | 1493 | GCCH_handle_destroy (ch, msg, fwd); |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | 1496 | ||
@@ -1505,7 +1505,7 @@ handle_ephemeral (struct CadetTunnel3 *t, | |||
1505 | const struct GNUNET_CADET_KX_Ephemeral *msg) | 1505 | const struct GNUNET_CADET_KX_Ephemeral *msg) |
1506 | { | 1506 | { |
1507 | struct GNUNET_HashCode km; | 1507 | struct GNUNET_HashCode km; |
1508 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GMT_2s (t)); | 1508 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GCT_2s (t)); |
1509 | 1509 | ||
1510 | if (GNUNET_OK != check_ephemeral (t, msg)) | 1510 | if (GNUNET_OK != check_ephemeral (t, msg)) |
1511 | { | 1511 | { |
@@ -1514,8 +1514,8 @@ handle_ephemeral (struct CadetTunnel3 *t, | |||
1514 | } | 1514 | } |
1515 | derive_key_material (&km, &msg->ephemeral_key); | 1515 | derive_key_material (&km, &msg->ephemeral_key); |
1516 | LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km)); | 1516 | LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km)); |
1517 | derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km); | 1517 | derive_symmertic (&t->e_key, &my_full_id, GCP_get_id (t->peer), &km); |
1518 | derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km); | 1518 | derive_symmertic (&t->d_key, GCP_get_id (t->peer), &my_full_id, &km); |
1519 | if (CADET_TUNNEL3_KEY_SENT == t->estate) | 1519 | if (CADET_TUNNEL3_KEY_SENT == t->estate) |
1520 | { | 1520 | { |
1521 | LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n"); | 1521 | LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n"); |
@@ -1544,12 +1544,12 @@ handle_ping (struct CadetTunnel3 *t, | |||
1544 | return; | 1544 | return; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== PING for %s\n", GMT_2s (t)); | 1547 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== PING for %s\n", GCT_2s (t)); |
1548 | t_decrypt (t, &res.target, &msg->target, ping_encryption_size (), msg->iv); | 1548 | t_decrypt (t, &res.target, &msg->target, ping_encryption_size (), msg->iv); |
1549 | if (0 != memcmp (&my_full_id, &res.target, sizeof (my_full_id))) | 1549 | if (0 != memcmp (&my_full_id, &res.target, sizeof (my_full_id))) |
1550 | { | 1550 | { |
1551 | GNUNET_STATISTICS_update (stats, "# malformed PINGs", 1, GNUNET_NO); | 1551 | GNUNET_STATISTICS_update (stats, "# malformed PINGs", 1, GNUNET_NO); |
1552 | LOG (GNUNET_ERROR_TYPE_WARNING, " malformed PING on %s\n", GMT_2s (t)); | 1552 | LOG (GNUNET_ERROR_TYPE_WARNING, " malformed PING on %s\n", GCT_2s (t)); |
1553 | LOG (GNUNET_ERROR_TYPE_DEBUG, " e got %u\n", msg->nonce); | 1553 | LOG (GNUNET_ERROR_TYPE_DEBUG, " e got %u\n", msg->nonce); |
1554 | LOG (GNUNET_ERROR_TYPE_DEBUG, " e towards %s\n", GNUNET_i2s (&msg->target)); | 1554 | LOG (GNUNET_ERROR_TYPE_DEBUG, " e towards %s\n", GNUNET_i2s (&msg->target)); |
1555 | LOG (GNUNET_ERROR_TYPE_DEBUG, " got %u\n", res.nonce); | 1555 | LOG (GNUNET_ERROR_TYPE_DEBUG, " got %u\n", res.nonce); |
@@ -1577,7 +1577,7 @@ handle_pong (struct CadetTunnel3 *t, | |||
1577 | { | 1577 | { |
1578 | uint32_t challenge; | 1578 | uint32_t challenge; |
1579 | 1579 | ||
1580 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GMT_2s (t)); | 1580 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t)); |
1581 | if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task) | 1581 | if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task) |
1582 | { | 1582 | { |
1583 | GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO); | 1583 | GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO); |
@@ -1587,7 +1587,7 @@ handle_pong (struct CadetTunnel3 *t, | |||
1587 | 1587 | ||
1588 | if (challenge != t->kx_ctx->challenge) | 1588 | if (challenge != t->kx_ctx->challenge) |
1589 | { | 1589 | { |
1590 | LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong PONG challenge on %s\n", GMT_2s (t)); | 1590 | LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong PONG challenge on %s\n", GCT_2s (t)); |
1591 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PONG: %u (e: %u). Expected: %u.\n", | 1591 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PONG: %u (e: %u). Expected: %u.\n", |
1592 | challenge, msg->nonce, t->kx_ctx->challenge); | 1592 | challenge, msg->nonce, t->kx_ctx->challenge); |
1593 | send_ephemeral (t); | 1593 | send_ephemeral (t); |
@@ -1598,7 +1598,7 @@ handle_pong (struct CadetTunnel3 *t, | |||
1598 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; | 1598 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; |
1599 | GNUNET_free (t->kx_ctx); | 1599 | GNUNET_free (t->kx_ctx); |
1600 | t->kx_ctx = NULL; | 1600 | t->kx_ctx = NULL; |
1601 | GMT_change_estate (t, CADET_TUNNEL3_KEY_OK); | 1601 | GCT_change_estate (t, CADET_TUNNEL3_KEY_OK); |
1602 | } | 1602 | } |
1603 | 1603 | ||
1604 | 1604 | ||
@@ -1621,7 +1621,7 @@ handle_decrypted (struct CadetTunnel3 *t, | |||
1621 | uint16_t type; | 1621 | uint16_t type; |
1622 | 1622 | ||
1623 | type = ntohs (msgh->type); | 1623 | type = ntohs (msgh->type); |
1624 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GM_m2s (type), GMT_2s (t)); | 1624 | LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GC_m2s (type), GCT_2s (t)); |
1625 | 1625 | ||
1626 | switch (type) | 1626 | switch (type) |
1627 | { | 1627 | { |
@@ -1666,7 +1666,7 @@ handle_decrypted (struct CadetTunnel3 *t, | |||
1666 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1666 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1667 | "end-to-end message not known (%u)\n", | 1667 | "end-to-end message not known (%u)\n", |
1668 | ntohs (msgh->type)); | 1668 | ntohs (msgh->type)); |
1669 | GMT_debug (t); | 1669 | GCT_debug (t); |
1670 | } | 1670 | } |
1671 | } | 1671 | } |
1672 | 1672 | ||
@@ -1682,7 +1682,7 @@ handle_decrypted (struct CadetTunnel3 *t, | |||
1682 | * @param msg Encrypted message. | 1682 | * @param msg Encrypted message. |
1683 | */ | 1683 | */ |
1684 | void | 1684 | void |
1685 | GMT_handle_encrypted (struct CadetTunnel3 *t, | 1685 | GCT_handle_encrypted (struct CadetTunnel3 *t, |
1686 | const struct GNUNET_CADET_Encrypted *msg) | 1686 | const struct GNUNET_CADET_Encrypted *msg) |
1687 | { | 1687 | { |
1688 | size_t size = ntohs (msg->header.size); | 1688 | size_t size = ntohs (msg->header.size); |
@@ -1700,7 +1700,7 @@ GMT_handle_encrypted (struct CadetTunnel3 *t, | |||
1700 | /* checksum failed */ | 1700 | /* checksum failed */ |
1701 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1701 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1702 | "Failed checksum validation for a message on tunnel `%s'\n", | 1702 | "Failed checksum validation for a message on tunnel `%s'\n", |
1703 | GMT_2s (t)); | 1703 | GCT_2s (t)); |
1704 | GNUNET_STATISTICS_update (stats, "# wrong HMAC", 1, GNUNET_NO); | 1704 | GNUNET_STATISTICS_update (stats, "# wrong HMAC", 1, GNUNET_NO); |
1705 | return; | 1705 | return; |
1706 | } | 1706 | } |
@@ -1721,7 +1721,7 @@ GMT_handle_encrypted (struct CadetTunnel3 *t, | |||
1721 | * @param message Payload of KX message. | 1721 | * @param message Payload of KX message. |
1722 | */ | 1722 | */ |
1723 | void | 1723 | void |
1724 | GMT_handle_kx (struct CadetTunnel3 *t, | 1724 | GCT_handle_kx (struct CadetTunnel3 *t, |
1725 | const struct GNUNET_MessageHeader *message) | 1725 | const struct GNUNET_MessageHeader *message) |
1726 | { | 1726 | { |
1727 | uint16_t type; | 1727 | uint16_t type; |
@@ -1756,7 +1756,7 @@ GMT_handle_kx (struct CadetTunnel3 *t, | |||
1756 | * @param key ECC private key, to derive all other keys and do crypto. | 1756 | * @param key ECC private key, to derive all other keys and do crypto. |
1757 | */ | 1757 | */ |
1758 | void | 1758 | void |
1759 | GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, | 1759 | GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, |
1760 | const struct GNUNET_CRYPTO_EddsaPrivateKey *key) | 1760 | const struct GNUNET_CRYPTO_EddsaPrivateKey *key) |
1761 | { | 1761 | { |
1762 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); | 1762 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); |
@@ -1791,7 +1791,7 @@ GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1791 | * Shut down the tunnel subsystem. | 1791 | * Shut down the tunnel subsystem. |
1792 | */ | 1792 | */ |
1793 | void | 1793 | void |
1794 | GMT_shutdown (void) | 1794 | GCT_shutdown (void) |
1795 | { | 1795 | { |
1796 | if (GNUNET_SCHEDULER_NO_TASK != rekey_task) | 1796 | if (GNUNET_SCHEDULER_NO_TASK != rekey_task) |
1797 | { | 1797 | { |
@@ -1809,7 +1809,7 @@ GMT_shutdown (void) | |||
1809 | * @param destination Peer this tunnel is towards. | 1809 | * @param destination Peer this tunnel is towards. |
1810 | */ | 1810 | */ |
1811 | struct CadetTunnel3 * | 1811 | struct CadetTunnel3 * |
1812 | GMT_new (struct CadetPeer *destination) | 1812 | GCT_new (struct CadetPeer *destination) |
1813 | { | 1813 | { |
1814 | struct CadetTunnel3 *t; | 1814 | struct CadetTunnel3 *t; |
1815 | 1815 | ||
@@ -1818,7 +1818,7 @@ GMT_new (struct CadetPeer *destination) | |||
1818 | t->peer = destination; | 1818 | t->peer = destination; |
1819 | 1819 | ||
1820 | if (GNUNET_OK != | 1820 | if (GNUNET_OK != |
1821 | GNUNET_CONTAINER_multipeermap_put (tunnels, GMP_get_id (destination), t, | 1821 | GNUNET_CONTAINER_multipeermap_put (tunnels, GCP_get_id (destination), t, |
1822 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 1822 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
1823 | { | 1823 | { |
1824 | GNUNET_break (0); | 1824 | GNUNET_break (0); |
@@ -1836,13 +1836,13 @@ GMT_new (struct CadetPeer *destination) | |||
1836 | * @param cstate New connection state. | 1836 | * @param cstate New connection state. |
1837 | */ | 1837 | */ |
1838 | void | 1838 | void |
1839 | GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) | 1839 | GCT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) |
1840 | { | 1840 | { |
1841 | if (NULL == t) | 1841 | if (NULL == t) |
1842 | return; | 1842 | return; |
1843 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n", | 1843 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n", |
1844 | GMP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate)); | 1844 | GCP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate)); |
1845 | if (myid != GMP_get_short_id (t->peer) && | 1845 | if (myid != GCP_get_short_id (t->peer) && |
1846 | CADET_TUNNEL3_READY != t->cstate && | 1846 | CADET_TUNNEL3_READY != t->cstate && |
1847 | CADET_TUNNEL3_READY == cstate) | 1847 | CADET_TUNNEL3_READY == cstate) |
1848 | { | 1848 | { |
@@ -1861,10 +1861,10 @@ GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) | |||
1861 | t->cstate = cstate; | 1861 | t->cstate = cstate; |
1862 | 1862 | ||
1863 | if (CADET_TUNNEL3_READY == cstate | 1863 | if (CADET_TUNNEL3_READY == cstate |
1864 | && CONNECTIONS_PER_TUNNEL <= GMT_count_connections (t)) | 1864 | && CONNECTIONS_PER_TUNNEL <= GCT_count_connections (t)) |
1865 | { | 1865 | { |
1866 | LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n"); | 1866 | LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n"); |
1867 | GMP_stop_search (t->peer); | 1867 | GCP_stop_search (t->peer); |
1868 | } | 1868 | } |
1869 | } | 1869 | } |
1870 | 1870 | ||
@@ -1875,17 +1875,17 @@ GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) | |||
1875 | * @param state New encryption state. | 1875 | * @param state New encryption state. |
1876 | */ | 1876 | */ |
1877 | void | 1877 | void |
1878 | GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state) | 1878 | GCT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state) |
1879 | { | 1879 | { |
1880 | if (NULL == t) | 1880 | if (NULL == t) |
1881 | return; | 1881 | return; |
1882 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1882 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1883 | "Tunnel %s estate was %s\n", | 1883 | "Tunnel %s estate was %s\n", |
1884 | GMP_2s (t->peer), estate2s (t->estate)); | 1884 | GCP_2s (t->peer), estate2s (t->estate)); |
1885 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1885 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1886 | "Tunnel %s estate is now %s\n", | 1886 | "Tunnel %s estate is now %s\n", |
1887 | GMP_2s (t->peer), estate2s (state)); | 1887 | GCP_2s (t->peer), estate2s (state)); |
1888 | if (myid != GMP_get_short_id (t->peer) && | 1888 | if (myid != GCP_get_short_id (t->peer) && |
1889 | CADET_TUNNEL3_KEY_OK != t->estate && CADET_TUNNEL3_KEY_OK == state) | 1889 | CADET_TUNNEL3_KEY_OK != t->estate && CADET_TUNNEL3_KEY_OK == state) |
1890 | { | 1890 | { |
1891 | t->estate = state; | 1891 | t->estate = state; |
@@ -1914,7 +1914,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1914 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1914 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1915 | return; | 1915 | return; |
1916 | 1916 | ||
1917 | if (GMT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL) | 1917 | if (GCT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL) |
1918 | { | 1918 | { |
1919 | struct CadetTConnection *iter; | 1919 | struct CadetTConnection *iter; |
1920 | struct CadetTConnection *c; | 1920 | struct CadetTConnection *c; |
@@ -1922,7 +1922,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1922 | for (c = iter = t->connection_head; NULL != iter; iter = iter->next) | 1922 | for (c = iter = t->connection_head; NULL != iter; iter = iter->next) |
1923 | { | 1923 | { |
1924 | if ((NULL == c || iter->created.abs_value_us > c->created.abs_value_us) | 1924 | if ((NULL == c || iter->created.abs_value_us > c->created.abs_value_us) |
1925 | && GNUNET_NO == GMC_is_direct (iter->c)) | 1925 | && GNUNET_NO == GCC_is_direct (iter->c)) |
1926 | { | 1926 | { |
1927 | c = iter; | 1927 | c = iter; |
1928 | } | 1928 | } |
@@ -1930,10 +1930,10 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1930 | if (NULL != c) | 1930 | if (NULL != c) |
1931 | { | 1931 | { |
1932 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Too many connections on tunnel %s\n", | 1932 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Too many connections on tunnel %s\n", |
1933 | GMT_2s (t)); | 1933 | GCT_2s (t)); |
1934 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying connection %s\n", | 1934 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying connection %s\n", |
1935 | GMC_2s (c->c)); | 1935 | GCC_2s (c->c)); |
1936 | GMC_destroy (c->c); | 1936 | GCC_destroy (c->c); |
1937 | } | 1937 | } |
1938 | else | 1938 | else |
1939 | { | 1939 | { |
@@ -1950,14 +1950,14 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1950 | * @param c Connection. | 1950 | * @param c Connection. |
1951 | */ | 1951 | */ |
1952 | void | 1952 | void |
1953 | GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) | 1953 | GCT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) |
1954 | { | 1954 | { |
1955 | struct CadetTConnection *aux; | 1955 | struct CadetTConnection *aux; |
1956 | 1956 | ||
1957 | GNUNET_assert (NULL != c); | 1957 | GNUNET_assert (NULL != c); |
1958 | 1958 | ||
1959 | LOG (GNUNET_ERROR_TYPE_DEBUG, "add connection %s\n", GMC_2s (c)); | 1959 | LOG (GNUNET_ERROR_TYPE_DEBUG, "add connection %s\n", GCC_2s (c)); |
1960 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to tunnel %s\n", GMT_2s (t)); | 1960 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to tunnel %s\n", GCT_2s (t)); |
1961 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | 1961 | for (aux = t->connection_head; aux != NULL; aux = aux->next) |
1962 | if (aux->c == c) | 1962 | if (aux->c == c) |
1963 | return; | 1963 | return; |
@@ -1979,9 +1979,9 @@ GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) | |||
1979 | * @param path Invalid path to remove. Is destroyed after removal. | 1979 | * @param path Invalid path to remove. Is destroyed after removal. |
1980 | */ | 1980 | */ |
1981 | void | 1981 | void |
1982 | GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) | 1982 | GCT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) |
1983 | { | 1983 | { |
1984 | GMP_remove_path (t->peer, path); | 1984 | GCP_remove_path (t->peer, path); |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | 1987 | ||
@@ -1992,14 +1992,14 @@ GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) | |||
1992 | * @param c Connection. | 1992 | * @param c Connection. |
1993 | */ | 1993 | */ |
1994 | void | 1994 | void |
1995 | GMT_remove_connection (struct CadetTunnel3 *t, | 1995 | GCT_remove_connection (struct CadetTunnel3 *t, |
1996 | struct CadetConnection *c) | 1996 | struct CadetConnection *c) |
1997 | { | 1997 | { |
1998 | struct CadetTConnection *aux; | 1998 | struct CadetTConnection *aux; |
1999 | struct CadetTConnection *next; | 1999 | struct CadetTConnection *next; |
2000 | 2000 | ||
2001 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", | 2001 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", |
2002 | GMC_2s (c), GMT_2s (t)); | 2002 | GCC_2s (c), GCT_2s (t)); |
2003 | for (aux = t->connection_head; aux != NULL; aux = next) | 2003 | for (aux = t->connection_head; aux != NULL; aux = next) |
2004 | { | 2004 | { |
2005 | next = aux->next; | 2005 | next = aux->next; |
@@ -2011,14 +2011,14 @@ GMT_remove_connection (struct CadetTunnel3 *t, | |||
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | /* Start new connections if needed */ | 2013 | /* Start new connections if needed */ |
2014 | if (CONNECTIONS_PER_TUNNEL < GMT_count_connections (t) | 2014 | if (CONNECTIONS_PER_TUNNEL < GCT_count_connections (t) |
2015 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task | 2015 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task |
2016 | && CADET_TUNNEL3_SHUTDOWN != t->cstate | 2016 | && CADET_TUNNEL3_SHUTDOWN != t->cstate |
2017 | && GNUNET_NO == shutting_down) | 2017 | && GNUNET_NO == shutting_down) |
2018 | { | 2018 | { |
2019 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); | 2019 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); |
2020 | t->cstate = CADET_TUNNEL3_SEARCHING; | 2020 | t->cstate = CADET_TUNNEL3_SEARCHING; |
2021 | GMP_connect (t->peer); | 2021 | GCP_connect (t->peer); |
2022 | return; | 2022 | return; |
2023 | } | 2023 | } |
2024 | 2024 | ||
@@ -2028,7 +2028,7 @@ GMT_remove_connection (struct CadetTunnel3 *t, | |||
2028 | 2028 | ||
2029 | /* Check if any connection is ready to maintaing cstate */ | 2029 | /* Check if any connection is ready to maintaing cstate */ |
2030 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | 2030 | for (aux = t->connection_head; aux != NULL; aux = aux->next) |
2031 | if (CADET_CONNECTION_READY == GMC_get_state (aux->c)) | 2031 | if (CADET_CONNECTION_READY == GCC_get_state (aux->c)) |
2032 | return; | 2032 | return; |
2033 | 2033 | ||
2034 | t->cstate = CADET_TUNNEL3_WAITING; | 2034 | t->cstate = CADET_TUNNEL3_WAITING; |
@@ -2042,7 +2042,7 @@ GMT_remove_connection (struct CadetTunnel3 *t, | |||
2042 | * @param ch Channel. | 2042 | * @param ch Channel. |
2043 | */ | 2043 | */ |
2044 | void | 2044 | void |
2045 | GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) | 2045 | GCT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) |
2046 | { | 2046 | { |
2047 | struct CadetTChannel *aux; | 2047 | struct CadetTChannel *aux; |
2048 | 2048 | ||
@@ -2078,7 +2078,7 @@ GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) | |||
2078 | * @param ch Channel. | 2078 | * @param ch Channel. |
2079 | */ | 2079 | */ |
2080 | void | 2080 | void |
2081 | GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) | 2081 | GCT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) |
2082 | { | 2082 | { |
2083 | struct CadetTChannel *aux; | 2083 | struct CadetTChannel *aux; |
2084 | 2084 | ||
@@ -2087,7 +2087,7 @@ GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) | |||
2087 | { | 2087 | { |
2088 | if (aux->ch == ch) | 2088 | if (aux->ch == ch) |
2089 | { | 2089 | { |
2090 | LOG (GNUNET_ERROR_TYPE_DEBUG, " found! %s\n", GMCH_2s (ch)); | 2090 | LOG (GNUNET_ERROR_TYPE_DEBUG, " found! %s\n", GCCH_2s (ch)); |
2091 | GNUNET_CONTAINER_DLL_remove (t->channel_head, t->channel_tail, aux); | 2091 | GNUNET_CONTAINER_DLL_remove (t->channel_head, t->channel_tail, aux); |
2092 | GNUNET_free (aux); | 2092 | GNUNET_free (aux); |
2093 | return; | 2093 | return; |
@@ -2105,7 +2105,7 @@ GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) | |||
2105 | * @return channel handler, NULL if doesn't exist | 2105 | * @return channel handler, NULL if doesn't exist |
2106 | */ | 2106 | */ |
2107 | struct CadetChannel * | 2107 | struct CadetChannel * |
2108 | GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) | 2108 | GCT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) |
2109 | { | 2109 | { |
2110 | struct CadetTChannel *iter; | 2110 | struct CadetTChannel *iter; |
2111 | 2111 | ||
@@ -2114,7 +2114,7 @@ GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) | |||
2114 | 2114 | ||
2115 | for (iter = t->channel_head; NULL != iter; iter = iter->next) | 2115 | for (iter = t->channel_head; NULL != iter; iter = iter->next) |
2116 | { | 2116 | { |
2117 | if (GMCH_get_id (iter->ch) == chid) | 2117 | if (GCCH_get_id (iter->ch) == chid) |
2118 | break; | 2118 | break; |
2119 | } | 2119 | } |
2120 | 2120 | ||
@@ -2143,7 +2143,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2143 | { | 2143 | { |
2144 | LOG (GNUNET_ERROR_TYPE_WARNING, | 2144 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2145 | "Not destroying tunnel, due to shutdown. " | 2145 | "Not destroying tunnel, due to shutdown. " |
2146 | "Tunnel at %p should have been freed by GMT_shutdown\n", t); | 2146 | "Tunnel at %p should have been freed by GCT_shutdown\n", t); |
2147 | return; | 2147 | return; |
2148 | } | 2148 | } |
2149 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; | 2149 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -2151,9 +2151,9 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2151 | 2151 | ||
2152 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | 2152 | for (iter = t->connection_head; NULL != iter; iter = iter->next) |
2153 | { | 2153 | { |
2154 | GMC_send_destroy (iter->c); | 2154 | GCC_send_destroy (iter->c); |
2155 | } | 2155 | } |
2156 | GMT_destroy (t); | 2156 | GCT_destroy (t); |
2157 | } | 2157 | } |
2158 | 2158 | ||
2159 | 2159 | ||
@@ -2165,7 +2165,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2165 | * @param t Tunnel to destroy. | 2165 | * @param t Tunnel to destroy. |
2166 | */ | 2166 | */ |
2167 | void | 2167 | void |
2168 | GMT_destroy_empty (struct CadetTunnel3 *t) | 2168 | GCT_destroy_empty (struct CadetTunnel3 *t) |
2169 | { | 2169 | { |
2170 | if (GNUNET_YES == shutting_down) | 2170 | if (GNUNET_YES == shutting_down) |
2171 | return; /* Will be destroyed immediately anyway */ | 2171 | return; /* Will be destroyed immediately anyway */ |
@@ -2174,7 +2174,7 @@ GMT_destroy_empty (struct CadetTunnel3 *t) | |||
2174 | { | 2174 | { |
2175 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2175 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2176 | "Tunnel %s is already scheduled for destruction\n", | 2176 | "Tunnel %s is already scheduled for destruction\n", |
2177 | GMT_2s (t)); | 2177 | GCT_2s (t)); |
2178 | GNUNET_break (0); | 2178 | GNUNET_break (0); |
2179 | /* should never happen, tunnel can only become empty once, and the | 2179 | /* should never happen, tunnel can only become empty once, and the |
2180 | * task identifier should be NO_TASK (cleaned when the tunnel was created | 2180 | * task identifier should be NO_TASK (cleaned when the tunnel was created |
@@ -2184,7 +2184,7 @@ GMT_destroy_empty (struct CadetTunnel3 *t) | |||
2184 | } | 2184 | } |
2185 | 2185 | ||
2186 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", | 2186 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", |
2187 | GMT_2s (t)); | 2187 | GCT_2s (t)); |
2188 | 2188 | ||
2189 | t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 2189 | t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
2190 | &delayed_destroy, t); | 2190 | &delayed_destroy, t); |
@@ -2199,13 +2199,13 @@ GMT_destroy_empty (struct CadetTunnel3 *t) | |||
2199 | * @param t Tunnel to destroy if empty. | 2199 | * @param t Tunnel to destroy if empty. |
2200 | */ | 2200 | */ |
2201 | void | 2201 | void |
2202 | GMT_destroy_if_empty (struct CadetTunnel3 *t) | 2202 | GCT_destroy_if_empty (struct CadetTunnel3 *t) |
2203 | { | 2203 | { |
2204 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GMT_2s (t)); | 2204 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GCT_2s (t)); |
2205 | if (1 < GMT_count_channels (t)) | 2205 | if (1 < GCT_count_channels (t)) |
2206 | return; | 2206 | return; |
2207 | 2207 | ||
2208 | GMT_destroy_empty (t); | 2208 | GCT_destroy_empty (t); |
2209 | } | 2209 | } |
2210 | 2210 | ||
2211 | 2211 | ||
@@ -2221,7 +2221,7 @@ GMT_destroy_if_empty (struct CadetTunnel3 *t) | |||
2221 | * @param t The tunnel to destroy. | 2221 | * @param t The tunnel to destroy. |
2222 | */ | 2222 | */ |
2223 | void | 2223 | void |
2224 | GMT_destroy (struct CadetTunnel3 *t) | 2224 | GCT_destroy (struct CadetTunnel3 *t) |
2225 | { | 2225 | { |
2226 | struct CadetTConnection *iter_c; | 2226 | struct CadetTConnection *iter_c; |
2227 | struct CadetTConnection *next_c; | 2227 | struct CadetTConnection *next_c; |
@@ -2231,21 +2231,21 @@ GMT_destroy (struct CadetTunnel3 *t) | |||
2231 | if (NULL == t) | 2231 | if (NULL == t) |
2232 | return; | 2232 | return; |
2233 | 2233 | ||
2234 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n", GMP_2s (t->peer)); | 2234 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n", GCP_2s (t->peer)); |
2235 | 2235 | ||
2236 | GNUNET_break (GNUNET_YES == | 2236 | GNUNET_break (GNUNET_YES == |
2237 | GNUNET_CONTAINER_multipeermap_remove (tunnels, | 2237 | GNUNET_CONTAINER_multipeermap_remove (tunnels, |
2238 | GMP_get_id (t->peer), t)); | 2238 | GCP_get_id (t->peer), t)); |
2239 | 2239 | ||
2240 | for (iter_c = t->connection_head; NULL != iter_c; iter_c = next_c) | 2240 | for (iter_c = t->connection_head; NULL != iter_c; iter_c = next_c) |
2241 | { | 2241 | { |
2242 | next_c = iter_c->next; | 2242 | next_c = iter_c->next; |
2243 | GMC_destroy (iter_c->c); | 2243 | GCC_destroy (iter_c->c); |
2244 | } | 2244 | } |
2245 | for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = next_ch) | 2245 | for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = next_ch) |
2246 | { | 2246 | { |
2247 | next_ch = iter_ch->next; | 2247 | next_ch = iter_ch->next; |
2248 | GMCH_destroy (iter_ch->ch); | 2248 | GCCH_destroy (iter_ch->ch); |
2249 | /* Should only happen on shutdown, but it's ok. */ | 2249 | /* Should only happen on shutdown, but it's ok. */ |
2250 | } | 2250 | } |
2251 | 2251 | ||
@@ -2257,7 +2257,7 @@ GMT_destroy (struct CadetTunnel3 *t) | |||
2257 | } | 2257 | } |
2258 | 2258 | ||
2259 | GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); | 2259 | GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); |
2260 | GMP_set_tunnel (t->peer, NULL); | 2260 | GCP_set_tunnel (t->peer, NULL); |
2261 | 2261 | ||
2262 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) | 2262 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) |
2263 | { | 2263 | { |
@@ -2284,7 +2284,7 @@ GMT_destroy (struct CadetTunnel3 *t) | |||
2284 | * @return Connection created. | 2284 | * @return Connection created. |
2285 | */ | 2285 | */ |
2286 | struct CadetConnection * | 2286 | struct CadetConnection * |
2287 | GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) | 2287 | GCT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) |
2288 | { | 2288 | { |
2289 | struct CadetConnection *c; | 2289 | struct CadetConnection *c; |
2290 | struct GNUNET_CADET_Hash cid; | 2290 | struct GNUNET_CADET_Hash cid; |
@@ -2314,13 +2314,13 @@ GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) | |||
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cid, sizeof (cid)); | 2316 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cid, sizeof (cid)); |
2317 | c = GMC_new (&cid, t, p, own_pos); | 2317 | c = GCC_new (&cid, t, p, own_pos); |
2318 | if (NULL == c) | 2318 | if (NULL == c) |
2319 | { | 2319 | { |
2320 | /* Path was flawed */ | 2320 | /* Path was flawed */ |
2321 | return NULL; | 2321 | return NULL; |
2322 | } | 2322 | } |
2323 | GMT_add_connection (t, c); | 2323 | GCT_add_connection (t, c); |
2324 | return c; | 2324 | return c; |
2325 | } | 2325 | } |
2326 | 2326 | ||
@@ -2333,7 +2333,7 @@ GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) | |||
2333 | * @return Number of connections. | 2333 | * @return Number of connections. |
2334 | */ | 2334 | */ |
2335 | unsigned int | 2335 | unsigned int |
2336 | GMT_count_connections (struct CadetTunnel3 *t) | 2336 | GCT_count_connections (struct CadetTunnel3 *t) |
2337 | { | 2337 | { |
2338 | struct CadetTConnection *iter; | 2338 | struct CadetTConnection *iter; |
2339 | unsigned int count; | 2339 | unsigned int count; |
@@ -2342,7 +2342,7 @@ GMT_count_connections (struct CadetTunnel3 *t) | |||
2342 | return 0; | 2342 | return 0; |
2343 | 2343 | ||
2344 | for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next) | 2344 | for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next) |
2345 | if (CADET_CONNECTION_DESTROYED != GMC_get_state (iter->c)) | 2345 | if (CADET_CONNECTION_DESTROYED != GCC_get_state (iter->c)) |
2346 | count++; | 2346 | count++; |
2347 | 2347 | ||
2348 | return count; | 2348 | return count; |
@@ -2356,7 +2356,7 @@ GMT_count_connections (struct CadetTunnel3 *t) | |||
2356 | * @return Number of channels. | 2356 | * @return Number of channels. |
2357 | */ | 2357 | */ |
2358 | unsigned int | 2358 | unsigned int |
2359 | GMT_count_channels (struct CadetTunnel3 *t) | 2359 | GCT_count_channels (struct CadetTunnel3 *t) |
2360 | { | 2360 | { |
2361 | struct CadetTChannel *iter; | 2361 | struct CadetTChannel *iter; |
2362 | unsigned int count; | 2362 | unsigned int count; |
@@ -2377,7 +2377,7 @@ GMT_count_channels (struct CadetTunnel3 *t) | |||
2377 | * @return Tunnel's connectivity state. | 2377 | * @return Tunnel's connectivity state. |
2378 | */ | 2378 | */ |
2379 | enum CadetTunnel3CState | 2379 | enum CadetTunnel3CState |
2380 | GMT_get_cstate (struct CadetTunnel3 *t) | 2380 | GCT_get_cstate (struct CadetTunnel3 *t) |
2381 | { | 2381 | { |
2382 | if (NULL == t) | 2382 | if (NULL == t) |
2383 | { | 2383 | { |
@@ -2396,7 +2396,7 @@ GMT_get_cstate (struct CadetTunnel3 *t) | |||
2396 | * @return Tunnel's encryption state. | 2396 | * @return Tunnel's encryption state. |
2397 | */ | 2397 | */ |
2398 | enum CadetTunnel3EState | 2398 | enum CadetTunnel3EState |
2399 | GMT_get_estate (struct CadetTunnel3 *t) | 2399 | GCT_get_estate (struct CadetTunnel3 *t) |
2400 | { | 2400 | { |
2401 | if (NULL == t) | 2401 | if (NULL == t) |
2402 | { | 2402 | { |
@@ -2414,7 +2414,7 @@ GMT_get_estate (struct CadetTunnel3 *t) | |||
2414 | * @return Biggest buffer space offered by any channel in the tunnel. | 2414 | * @return Biggest buffer space offered by any channel in the tunnel. |
2415 | */ | 2415 | */ |
2416 | unsigned int | 2416 | unsigned int |
2417 | GMT_get_channels_buffer (struct CadetTunnel3 *t) | 2417 | GCT_get_channels_buffer (struct CadetTunnel3 *t) |
2418 | { | 2418 | { |
2419 | struct CadetTChannel *iter; | 2419 | struct CadetTChannel *iter; |
2420 | unsigned int buffer; | 2420 | unsigned int buffer; |
@@ -2445,7 +2445,7 @@ GMT_get_channels_buffer (struct CadetTunnel3 *t) | |||
2445 | * @return Buffer space offered by all connections in the tunnel. | 2445 | * @return Buffer space offered by all connections in the tunnel. |
2446 | */ | 2446 | */ |
2447 | unsigned int | 2447 | unsigned int |
2448 | GMT_get_connections_buffer (struct CadetTunnel3 *t) | 2448 | GCT_get_connections_buffer (struct CadetTunnel3 *t) |
2449 | { | 2449 | { |
2450 | struct CadetTConnection *iter; | 2450 | struct CadetTConnection *iter; |
2451 | unsigned int buffer; | 2451 | unsigned int buffer; |
@@ -2453,7 +2453,7 @@ GMT_get_connections_buffer (struct CadetTunnel3 *t) | |||
2453 | buffer = 0; | 2453 | buffer = 0; |
2454 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | 2454 | for (iter = t->connection_head; NULL != iter; iter = iter->next) |
2455 | { | 2455 | { |
2456 | if (GMC_get_state (iter->c) != CADET_CONNECTION_READY) | 2456 | if (GCC_get_state (iter->c) != CADET_CONNECTION_READY) |
2457 | { | 2457 | { |
2458 | continue; | 2458 | continue; |
2459 | } | 2459 | } |
@@ -2472,9 +2472,9 @@ GMT_get_connections_buffer (struct CadetTunnel3 *t) | |||
2472 | * @return ID of the destination peer. | 2472 | * @return ID of the destination peer. |
2473 | */ | 2473 | */ |
2474 | const struct GNUNET_PeerIdentity * | 2474 | const struct GNUNET_PeerIdentity * |
2475 | GMT_get_destination (struct CadetTunnel3 *t) | 2475 | GCT_get_destination (struct CadetTunnel3 *t) |
2476 | { | 2476 | { |
2477 | return GMP_get_id (t->peer); | 2477 | return GCP_get_id (t->peer); |
2478 | } | 2478 | } |
2479 | 2479 | ||
2480 | 2480 | ||
@@ -2486,7 +2486,7 @@ GMT_get_destination (struct CadetTunnel3 *t) | |||
2486 | * @return GID of a channel free to use. | 2486 | * @return GID of a channel free to use. |
2487 | */ | 2487 | */ |
2488 | CADET_ChannelNumber | 2488 | CADET_ChannelNumber |
2489 | GMT_get_next_chid (struct CadetTunnel3 *t) | 2489 | GCT_get_next_chid (struct CadetTunnel3 *t) |
2490 | { | 2490 | { |
2491 | CADET_ChannelNumber chid; | 2491 | CADET_ChannelNumber chid; |
2492 | CADET_ChannelNumber mask; | 2492 | CADET_ChannelNumber mask; |
@@ -2496,14 +2496,14 @@ GMT_get_next_chid (struct CadetTunnel3 *t) | |||
2496 | * If our ID is bigger or loopback tunnel, start at 0, bit 30 = 0 | 2496 | * If our ID is bigger or loopback tunnel, start at 0, bit 30 = 0 |
2497 | * If peer's ID is bigger, start at 0x4... bit 30 = 1 | 2497 | * If peer's ID is bigger, start at 0x4... bit 30 = 1 |
2498 | */ | 2498 | */ |
2499 | result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GMP_get_id (t->peer)); | 2499 | result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GCP_get_id (t->peer)); |
2500 | if (0 > result) | 2500 | if (0 > result) |
2501 | mask = 0x40000000; | 2501 | mask = 0x40000000; |
2502 | else | 2502 | else |
2503 | mask = 0x0; | 2503 | mask = 0x0; |
2504 | t->next_chid |= mask; | 2504 | t->next_chid |= mask; |
2505 | 2505 | ||
2506 | while (NULL != GMT_get_channel (t, t->next_chid)) | 2506 | while (NULL != GCT_get_channel (t, t->next_chid)) |
2507 | { | 2507 | { |
2508 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid); | 2508 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid); |
2509 | t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; | 2509 | t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
@@ -2523,21 +2523,21 @@ GMT_get_next_chid (struct CadetTunnel3 *t) | |||
2523 | * @param t Channel which has some free buffer space. | 2523 | * @param t Channel which has some free buffer space. |
2524 | */ | 2524 | */ |
2525 | void | 2525 | void |
2526 | GMT_unchoke_channels (struct CadetTunnel3 *t) | 2526 | GCT_unchoke_channels (struct CadetTunnel3 *t) |
2527 | { | 2527 | { |
2528 | struct CadetTChannel *iter; | 2528 | struct CadetTChannel *iter; |
2529 | unsigned int buffer; | 2529 | unsigned int buffer; |
2530 | unsigned int channels = GMT_count_channels (t); | 2530 | unsigned int channels = GCT_count_channels (t); |
2531 | unsigned int choked_n; | 2531 | unsigned int choked_n; |
2532 | struct CadetChannel *choked[channels]; | 2532 | struct CadetChannel *choked[channels]; |
2533 | 2533 | ||
2534 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_unchoke_channels on %s\n", GMT_2s (t)); | 2534 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_unchoke_channels on %s\n", GCT_2s (t)); |
2535 | LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head); | 2535 | LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head); |
2536 | if (NULL != t->channel_head) | 2536 | if (NULL != t->channel_head) |
2537 | LOG (GNUNET_ERROR_TYPE_DEBUG, " head ch: %p\n", t->channel_head->ch); | 2537 | LOG (GNUNET_ERROR_TYPE_DEBUG, " head ch: %p\n", t->channel_head->ch); |
2538 | 2538 | ||
2539 | /* Get buffer space */ | 2539 | /* Get buffer space */ |
2540 | buffer = GMT_get_connections_buffer (t); | 2540 | buffer = GCT_get_connections_buffer (t); |
2541 | if (0 == buffer) | 2541 | if (0 == buffer) |
2542 | { | 2542 | { |
2543 | return; | 2543 | return; |
@@ -2558,7 +2558,7 @@ GMT_unchoke_channels (struct CadetTunnel3 *t) | |||
2558 | { | 2558 | { |
2559 | unsigned int r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2559 | unsigned int r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2560 | choked_n); | 2560 | choked_n); |
2561 | GMCH_allow_client (choked[r], GMCH_is_origin (choked[r], GNUNET_YES)); | 2561 | GCCH_allow_client (choked[r], GCCH_is_origin (choked[r], GNUNET_YES)); |
2562 | choked_n--; | 2562 | choked_n--; |
2563 | buffer--; | 2563 | buffer--; |
2564 | choked[r] = choked[choked_n]; | 2564 | choked[r] = choked[choked_n]; |
@@ -2574,7 +2574,7 @@ GMT_unchoke_channels (struct CadetTunnel3 *t) | |||
2574 | * @param t Tunnel. | 2574 | * @param t Tunnel. |
2575 | */ | 2575 | */ |
2576 | void | 2576 | void |
2577 | GMT_send_connection_acks (struct CadetTunnel3 *t) | 2577 | GCT_send_connection_acks (struct CadetTunnel3 *t) |
2578 | { | 2578 | { |
2579 | struct CadetTConnection *iter; | 2579 | struct CadetTConnection *iter; |
2580 | uint32_t allowed; | 2580 | uint32_t allowed; |
@@ -2584,7 +2584,7 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) | |||
2584 | unsigned int buffer; | 2584 | unsigned int buffer; |
2585 | 2585 | ||
2586 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel send connection ACKs on %s\n", | 2586 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel send connection ACKs on %s\n", |
2587 | GMT_2s (t)); | 2587 | GCT_2s (t)); |
2588 | 2588 | ||
2589 | if (NULL == t) | 2589 | if (NULL == t) |
2590 | { | 2590 | { |
@@ -2592,11 +2592,11 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) | |||
2592 | return; | 2592 | return; |
2593 | } | 2593 | } |
2594 | 2594 | ||
2595 | buffer = GMT_get_channels_buffer (t); | 2595 | buffer = GCT_get_channels_buffer (t); |
2596 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer %u\n", buffer); | 2596 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer %u\n", buffer); |
2597 | 2597 | ||
2598 | /* Count connections, how many messages are already allowed */ | 2598 | /* Count connections, how many messages are already allowed */ |
2599 | cs = GMT_count_connections (t); | 2599 | cs = GCT_count_connections (t); |
2600 | for (allowed = 0, iter = t->connection_head; NULL != iter; iter = iter->next) | 2600 | for (allowed = 0, iter = t->connection_head; NULL != iter; iter = iter->next) |
2601 | { | 2601 | { |
2602 | allowed += get_connection_allowed (iter); | 2602 | allowed += get_connection_allowed (iter); |
@@ -2623,8 +2623,8 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) | |||
2623 | { | 2623 | { |
2624 | continue; | 2624 | continue; |
2625 | } | 2625 | } |
2626 | GMC_allow (iter->c, allow_per_connection, | 2626 | GCC_allow (iter->c, allow_per_connection, |
2627 | GMC_is_origin (iter->c, GNUNET_NO)); | 2627 | GCC_is_origin (iter->c, GNUNET_NO)); |
2628 | } | 2628 | } |
2629 | 2629 | ||
2630 | GNUNET_break (to_allow == 0); | 2630 | GNUNET_break (to_allow == 0); |
@@ -2641,11 +2641,11 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) | |||
2641 | * @param q Handle to the queue. | 2641 | * @param q Handle to the queue. |
2642 | */ | 2642 | */ |
2643 | void | 2643 | void |
2644 | GMT_cancel (struct CadetTunnel3Queue *q) | 2644 | GCT_cancel (struct CadetTunnel3Queue *q) |
2645 | { | 2645 | { |
2646 | if (NULL != q->cq) | 2646 | if (NULL != q->cq) |
2647 | { | 2647 | { |
2648 | GMC_cancel (q->cq); | 2648 | GCC_cancel (q->cq); |
2649 | /* tun_message_sent() will be called and free q */ | 2649 | /* tun_message_sent() will be called and free q */ |
2650 | } | 2650 | } |
2651 | else if (NULL != q->tqd) | 2651 | else if (NULL != q->tqd) |
@@ -2677,9 +2677,9 @@ GMT_cancel (struct CadetTunnel3Queue *q) | |||
2677 | * @return Handle to cancel message. NULL if @c cont is NULL. | 2677 | * @return Handle to cancel message. NULL if @c cont is NULL. |
2678 | */ | 2678 | */ |
2679 | struct CadetTunnel3Queue * | 2679 | struct CadetTunnel3Queue * |
2680 | GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 2680 | GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
2681 | struct CadetTunnel3 *t, struct CadetConnection *c, | 2681 | struct CadetTunnel3 *t, struct CadetConnection *c, |
2682 | int force, GMT_sent cont, void *cont_cls) | 2682 | int force, GCT_sent cont, void *cont_cls) |
2683 | { | 2683 | { |
2684 | return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); | 2684 | return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); |
2685 | } | 2685 | } |
@@ -2693,9 +2693,9 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2693 | * @return #GNUNET_YES if it is loopback. | 2693 | * @return #GNUNET_YES if it is loopback. |
2694 | */ | 2694 | */ |
2695 | int | 2695 | int |
2696 | GMT_is_loopback (const struct CadetTunnel3 *t) | 2696 | GCT_is_loopback (const struct CadetTunnel3 *t) |
2697 | { | 2697 | { |
2698 | return (myid == GMP_get_short_id (t->peer)); | 2698 | return (myid == GCP_get_short_id (t->peer)); |
2699 | } | 2699 | } |
2700 | 2700 | ||
2701 | 2701 | ||
@@ -2708,12 +2708,12 @@ GMT_is_loopback (const struct CadetTunnel3 *t) | |||
2708 | * @return #GNUNET_YES a connection uses this path. | 2708 | * @return #GNUNET_YES a connection uses this path. |
2709 | */ | 2709 | */ |
2710 | int | 2710 | int |
2711 | GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) | 2711 | GCT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) |
2712 | { | 2712 | { |
2713 | struct CadetTConnection *iter; | 2713 | struct CadetTConnection *iter; |
2714 | 2714 | ||
2715 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | 2715 | for (iter = t->connection_head; NULL != iter; iter = iter->next) |
2716 | if (GMC_get_path (iter->c) == p) | 2716 | if (GCC_get_path (iter->c) == p) |
2717 | return GNUNET_YES; | 2717 | return GNUNET_YES; |
2718 | 2718 | ||
2719 | return GNUNET_NO; | 2719 | return GNUNET_NO; |
@@ -2729,7 +2729,7 @@ GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) | |||
2729 | * @return Cost of the path (path length + number of overlapping nodes) | 2729 | * @return Cost of the path (path length + number of overlapping nodes) |
2730 | */ | 2730 | */ |
2731 | unsigned int | 2731 | unsigned int |
2732 | GMT_get_path_cost (const struct CadetTunnel3 *t, | 2732 | GCT_get_path_cost (const struct CadetTunnel3 *t, |
2733 | const struct CadetPeerPath *path) | 2733 | const struct CadetPeerPath *path) |
2734 | { | 2734 | { |
2735 | struct CadetTConnection *iter; | 2735 | struct CadetTConnection *iter; |
@@ -2748,7 +2748,7 @@ GMT_get_path_cost (const struct CadetTunnel3 *t, | |||
2748 | { | 2748 | { |
2749 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | 2749 | for (iter = t->connection_head; NULL != iter; iter = iter->next) |
2750 | { | 2750 | { |
2751 | aux = GMC_get_path (iter->c); | 2751 | aux = GCC_get_path (iter->c); |
2752 | if (NULL == aux) | 2752 | if (NULL == aux) |
2753 | continue; | 2753 | continue; |
2754 | 2754 | ||
@@ -2774,12 +2774,12 @@ GMT_get_path_cost (const struct CadetTunnel3 *t, | |||
2774 | * @return Static string the destination peer's ID. | 2774 | * @return Static string the destination peer's ID. |
2775 | */ | 2775 | */ |
2776 | const char * | 2776 | const char * |
2777 | GMT_2s (const struct CadetTunnel3 *t) | 2777 | GCT_2s (const struct CadetTunnel3 *t) |
2778 | { | 2778 | { |
2779 | if (NULL == t) | 2779 | if (NULL == t) |
2780 | return "(NULL)"; | 2780 | return "(NULL)"; |
2781 | 2781 | ||
2782 | return GMP_2s (t->peer); | 2782 | return GCP_2s (t->peer); |
2783 | } | 2783 | } |
2784 | 2784 | ||
2785 | 2785 | ||
@@ -2794,12 +2794,12 @@ GMT_2s (const struct CadetTunnel3 *t) | |||
2794 | * @param t Tunnel to debug. | 2794 | * @param t Tunnel to debug. |
2795 | */ | 2795 | */ |
2796 | void | 2796 | void |
2797 | GMT_debug (const struct CadetTunnel3 *t) | 2797 | GCT_debug (const struct CadetTunnel3 *t) |
2798 | { | 2798 | { |
2799 | struct CadetTChannel *iterch; | 2799 | struct CadetTChannel *iterch; |
2800 | struct CadetTConnection *iterc; | 2800 | struct CadetTConnection *iterc; |
2801 | 2801 | ||
2802 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GMT_2s (t)); | 2802 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GCT_2s (t)); |
2803 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n", | 2803 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n", |
2804 | cstate2s (t->cstate), estate2s (t->estate)); | 2804 | cstate2s (t->cstate), estate2s (t->estate)); |
2805 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT kx_ctx %p, rekey_task %u\n", | 2805 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT kx_ctx %p, rekey_task %u\n", |
@@ -2811,18 +2811,18 @@ GMT_debug (const struct CadetTunnel3 *t) | |||
2811 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT channels:\n"); | 2811 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT channels:\n"); |
2812 | for (iterch = t->channel_head; NULL != iterch; iterch = iterch->next) | 2812 | for (iterch = t->channel_head; NULL != iterch; iterch = iterch->next) |
2813 | { | 2813 | { |
2814 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s\n", GMCH_2s (iterch->ch)); | 2814 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s\n", GCCH_2s (iterch->ch)); |
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT connections:\n"); | 2817 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT connections:\n"); |
2818 | for (iterc = t->connection_head; NULL != iterc; iterc = iterc->next) | 2818 | for (iterc = t->connection_head; NULL != iterc; iterc = iterc->next) |
2819 | { | 2819 | { |
2820 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s [%u] buf: %u/%u (qn %u/%u)\n", | 2820 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s [%u] buf: %u/%u (qn %u/%u)\n", |
2821 | GMC_2s (iterc->c), GMC_get_state (iterc->c), | 2821 | GCC_2s (iterc->c), GCC_get_state (iterc->c), |
2822 | GMC_get_buffer (iterc->c, GNUNET_YES), | 2822 | GCC_get_buffer (iterc->c, GNUNET_YES), |
2823 | GMC_get_buffer (iterc->c, GNUNET_NO), | 2823 | GCC_get_buffer (iterc->c, GNUNET_NO), |
2824 | GMC_get_qn (iterc->c, GNUNET_YES), | 2824 | GCC_get_qn (iterc->c, GNUNET_YES), |
2825 | GMC_get_qn (iterc->c, GNUNET_NO)); | 2825 | GCC_get_qn (iterc->c, GNUNET_NO)); |
2826 | } | 2826 | } |
2827 | 2827 | ||
2828 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL END\n"); | 2828 | LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL END\n"); |
@@ -2836,7 +2836,7 @@ GMT_debug (const struct CadetTunnel3 *t) | |||
2836 | * @param cls Closure for @c iter. | 2836 | * @param cls Closure for @c iter. |
2837 | */ | 2837 | */ |
2838 | void | 2838 | void |
2839 | GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) | 2839 | GCT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) |
2840 | { | 2840 | { |
2841 | GNUNET_CONTAINER_multipeermap_iterate (tunnels, iter, cls); | 2841 | GNUNET_CONTAINER_multipeermap_iterate (tunnels, iter, cls); |
2842 | } | 2842 | } |
@@ -2848,7 +2848,7 @@ GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) | |||
2848 | * @return Number of tunnels to remote peers kept by this peer. | 2848 | * @return Number of tunnels to remote peers kept by this peer. |
2849 | */ | 2849 | */ |
2850 | unsigned int | 2850 | unsigned int |
2851 | GMT_count_all (void) | 2851 | GCT_count_all (void) |
2852 | { | 2852 | { |
2853 | return GNUNET_CONTAINER_multipeermap_size (tunnels); | 2853 | return GNUNET_CONTAINER_multipeermap_size (tunnels); |
2854 | } | 2854 | } |
@@ -2862,7 +2862,7 @@ GMT_count_all (void) | |||
2862 | * @param cls Closure for @c iter. | 2862 | * @param cls Closure for @c iter. |
2863 | */ | 2863 | */ |
2864 | void | 2864 | void |
2865 | GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls) | 2865 | GCT_iterate_connections (struct CadetTunnel3 *t, GCT_conn_iter iter, void *cls) |
2866 | { | 2866 | { |
2867 | struct CadetTConnection *ct; | 2867 | struct CadetTConnection *ct; |
2868 | 2868 | ||
@@ -2879,7 +2879,7 @@ GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls) | |||
2879 | * @param cls Closure for @c iter. | 2879 | * @param cls Closure for @c iter. |
2880 | */ | 2880 | */ |
2881 | void | 2881 | void |
2882 | GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls) | 2882 | GCT_iterate_channels (struct CadetTunnel3 *t, GCT_chan_iter iter, void *cls) |
2883 | { | 2883 | { |
2884 | struct CadetTChannel *cht; | 2884 | struct CadetTChannel *cht; |
2885 | 2885 | ||