aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet_connection.c')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c422
1 files changed, 211 insertions, 211 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 9c07e006b..3552a942c 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -236,7 +236,7 @@ struct CadetConnectionQueue
236 /** 236 /**
237 * Continuation to call once sent. 237 * Continuation to call once sent.
238 */ 238 */
239 GMC_sent cont; 239 GCC_sent cont;
240 240
241 /** 241 /**
242 * Closure for @c cont. 242 * Closure for @c cont.
@@ -316,7 +316,7 @@ connection_debug (struct CadetConnection *c)
316 return; 316 return;
317 } 317 }
318 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n", 318 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n",
319 peer2s (c->t->peer), GMC_2s (c)); 319 peer2s (c->t->peer), GCC_2s (c));
320 LOG (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n", 320 LOG (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n",
321 c->state, c->pending_messages); 321 c->state, c->pending_messages);
322 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); 322 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n");
@@ -362,7 +362,7 @@ connection_reset_timeout (struct CadetConnection *c, int fwd);
362 * @return String representation. 362 * @return String representation.
363 */ 363 */
364static const char * 364static const char *
365GMC_state2s (enum CadetConnectionState s) 365GCC_state2s (enum CadetConnectionState s)
366{ 366{
367 switch (s) 367 switch (s)
368 { 368 {
@@ -409,7 +409,7 @@ fc_init (struct CadetFlowControl *fc)
409static struct CadetConnection * 409static struct CadetConnection *
410connection_get (const struct GNUNET_CADET_Hash *cid) 410connection_get (const struct GNUNET_CADET_Hash *cid)
411{ 411{
412 return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid)); 412 return GNUNET_CONTAINER_multihashmap_get (connections, GC_h2hc (cid));
413} 413}
414 414
415 415
@@ -419,7 +419,7 @@ connection_change_state (struct CadetConnection* c,
419{ 419{
420 LOG (GNUNET_ERROR_TYPE_DEBUG, 420 LOG (GNUNET_ERROR_TYPE_DEBUG,
421 "Connection %s state %s -> %s\n", 421 "Connection %s state %s -> %s\n",
422 GMC_2s (c), GMC_state2s (c->state), GMC_state2s (state)); 422 GCC_2s (c), GCC_state2s (c->state), GCC_state2s (state));
423 if (CADET_CONNECTION_DESTROYED == c->state) 423 if (CADET_CONNECTION_DESTROYED == c->state)
424 { 424 {
425 LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n"); 425 LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
@@ -476,10 +476,10 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
476 int delta; 476 int delta;
477 477
478 /* If origin, there is no connection to send ACKs. Wrong function! */ 478 /* If origin, there is no connection to send ACKs. Wrong function! */
479 if (GMC_is_origin (c, fwd)) 479 if (GCC_is_origin (c, fwd))
480 { 480 {
481 LOG (GNUNET_ERROR_TYPE_DEBUG, "connection %s is origin in %s\n", 481 LOG (GNUNET_ERROR_TYPE_DEBUG, "connection %s is origin in %s\n",
482 GMC_2s (c), GM_f2s (fwd)); 482 GCC_2s (c), GC_f2s (fwd));
483 GNUNET_break (0); 483 GNUNET_break (0);
484 return; 484 return;
485 } 485 }
@@ -488,7 +488,7 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
488 prev_fc = fwd ? &c->bck_fc : &c->fwd_fc; 488 prev_fc = fwd ? &c->bck_fc : &c->fwd_fc;
489 489
490 LOG (GNUNET_ERROR_TYPE_DEBUG, "connection send %s ack on %s\n", 490 LOG (GNUNET_ERROR_TYPE_DEBUG, "connection send %s ack on %s\n",
491 GM_f2s (fwd), GMC_2s (c)); 491 GC_f2s (fwd), GCC_2s (c));
492 492
493 /* Check if we need to transmit the ACK. */ 493 /* Check if we need to transmit the ACK. */
494 delta = prev_fc->last_ack_sent - prev_fc->last_pid_recv; 494 delta = prev_fc->last_ack_sent - prev_fc->last_pid_recv;
@@ -517,11 +517,11 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
517 /* Check if message is already in queue */ 517 /* Check if message is already in queue */
518 if (NULL != prev_fc->ack_msg) 518 if (NULL != prev_fc->ack_msg)
519 { 519 {
520 if (GM_is_pid_bigger (ack, prev_fc->last_ack_sent)) 520 if (GC_is_pid_bigger (ack, prev_fc->last_ack_sent))
521 { 521 {
522 LOG (GNUNET_ERROR_TYPE_DEBUG, " canceling old ACK\n"); 522 LOG (GNUNET_ERROR_TYPE_DEBUG, " canceling old ACK\n");
523 GMC_cancel (prev_fc->ack_msg); 523 GCC_cancel (prev_fc->ack_msg);
524 /* GMC_cancel triggers ack_sent(), which clears fc->ack_msg */ 524 /* GCC_cancel triggers ack_sent(), which clears fc->ack_msg */
525 } 525 }
526 else 526 else
527 { 527 {
@@ -538,7 +538,7 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
538 msg.ack = htonl (ack); 538 msg.ack = htonl (ack);
539 msg.cid = c->id; 539 msg.cid = c->id;
540 540
541 prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header, 541 prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header,
542 GNUNET_MESSAGE_TYPE_CADET_ACK, 542 GNUNET_MESSAGE_TYPE_CADET_ACK,
543 ack, c, !fwd, GNUNET_YES, 543 ack, c, !fwd, GNUNET_YES,
544 &ack_sent, prev_fc); 544 &ack_sent, prev_fc);
@@ -575,7 +575,7 @@ conn_message_sent (void *cls,
575 575
576 fc = fwd ? &c->fwd_fc : &c->bck_fc; 576 fc = fwd ? &c->fwd_fc : &c->bck_fc;
577 LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s\n", 577 LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s\n",
578 sent ? "" : "not ", GM_f2s (fwd), GM_m2s (type)); 578 sent ? "" : "not ", GC_f2s (fwd), GC_m2s (type));
579 if (NULL != q) 579 if (NULL != q)
580 { 580 {
581 forced = q->forced; 581 forced = q->forced;
@@ -600,7 +600,7 @@ conn_message_sent (void *cls,
600 GNUNET_break (type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN || 600 GNUNET_break (type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN ||
601 type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY); 601 type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);
602 LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n", 602 LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n",
603 GM_m2s (type)); 603 GC_m2s (type));
604 return; 604 return;
605 } 605 }
606 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P- %p %u\n", c, c->pending_messages); 606 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P- %p %u\n", c, c->pending_messages);
@@ -608,7 +608,7 @@ conn_message_sent (void *cls,
608 if (GNUNET_YES == c->destroy && 0 == c->pending_messages) 608 if (GNUNET_YES == c->destroy && 0 == c->pending_messages)
609 { 609 {
610 LOG (GNUNET_ERROR_TYPE_DEBUG, "! destroying connection!\n"); 610 LOG (GNUNET_ERROR_TYPE_DEBUG, "! destroying connection!\n");
611 GMC_destroy (c); 611 GCC_destroy (c);
612 return; 612 return;
613 } 613 }
614 /* Send ACK if needed, after accounting for sent ID in fc->queue_n */ 614 /* Send ACK if needed, after accounting for sent ID in fc->queue_n */
@@ -627,7 +627,7 @@ conn_message_sent (void *cls,
627 { 627 {
628 GNUNET_assert (NULL != q); 628 GNUNET_assert (NULL != q);
629 fc->last_pid_sent = pid; // FIXME 629 fc->last_pid_sent = pid; // FIXME
630 GMC_send_ack (c, fwd, GNUNET_NO); 630 GCC_send_ack (c, fwd, GNUNET_NO);
631 connection_reset_timeout (c, fwd); 631 connection_reset_timeout (c, fwd);
632 } 632 }
633 633
@@ -703,7 +703,7 @@ get_prev_hop (const struct CadetConnection *c)
703 GNUNET_PEER_Id id; 703 GNUNET_PEER_Id id;
704 704
705 LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n", 705 LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n",
706 GMC_2s (c), c->own_pos, c->path->length); 706 GCC_2s (c), c->own_pos, c->path->length);
707 if (0 == c->own_pos || c->path->length < 2) 707 if (0 == c->own_pos || c->path->length < 2)
708 id = c->path->peers[0]; 708 id = c->path->peers[0];
709 else 709 else
@@ -712,7 +712,7 @@ get_prev_hop (const struct CadetConnection *c)
712 LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n", 712 LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n",
713 GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id); 713 GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id);
714 714
715 return GMP_get_short (id); 715 return GCP_get_short (id);
716} 716}
717 717
718 718
@@ -729,7 +729,7 @@ get_next_hop (const struct CadetConnection *c)
729 GNUNET_PEER_Id id; 729 GNUNET_PEER_Id id;
730 730
731 LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n", 731 LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n",
732 GMC_2s (c), c->own_pos, c->path->length); 732 GCC_2s (c), c->own_pos, c->path->length);
733 if ((c->path->length - 1) == c->own_pos || c->path->length < 2) 733 if ((c->path->length - 1) == c->own_pos || c->path->length < 2)
734 id = c->path->peers[c->path->length - 1]; 734 id = c->path->peers[c->path->length - 1];
735 else 735 else
@@ -738,7 +738,7 @@ get_next_hop (const struct CadetConnection *c)
738 LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n", 738 LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n",
739 GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id); 739 GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id);
740 740
741 return GMP_get_short (id); 741 return GCP_get_short (id);
742} 742}
743 743
744 744
@@ -777,10 +777,10 @@ is_fwd (const struct CadetConnection *c,
777 GNUNET_PEER_Id id; 777 GNUNET_PEER_Id id;
778 778
779 id = GNUNET_PEER_search (sender); 779 id = GNUNET_PEER_search (sender);
780 if (GMP_get_short_id (get_prev_hop (c)) == id) 780 if (GCP_get_short_id (get_prev_hop (c)) == id)
781 return GNUNET_YES; 781 return GNUNET_YES;
782 782
783 if (GMP_get_short_id (get_next_hop (c)) == id) 783 if (GCP_get_short_id (get_next_hop (c)) == id)
784 return GNUNET_NO; 784 return GNUNET_NO;
785 785
786 GNUNET_break (0); 786 GNUNET_break (0);
@@ -803,15 +803,15 @@ send_connection_ack (struct CadetConnection *connection, int fwd)
803 803
804 t = connection->t; 804 t = connection->t;
805 LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n", 805 LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n",
806 GM_f2s (!fwd), GMC_2s (connection)); 806 GC_f2s (!fwd), GCC_2s (connection));
807 GMP_queue_add (get_hop (connection, fwd), NULL, 807 GCP_queue_add (get_hop (connection, fwd), NULL,
808 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 808 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK,
809 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, 809 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
810 sizeof (struct GNUNET_CADET_ConnectionACK), 810 sizeof (struct GNUNET_CADET_ConnectionACK),
811 connection, fwd, &conn_message_sent, NULL); 811 connection, fwd, &conn_message_sent, NULL);
812 connection->pending_messages++; 812 connection->pending_messages++;
813 if (CADET_TUNNEL3_NEW == GMT_get_cstate (t)) 813 if (CADET_TUNNEL3_NEW == GCT_get_cstate (t))
814 GMT_change_cstate (t, CADET_TUNNEL3_WAITING); 814 GCT_change_cstate (t, CADET_TUNNEL3_WAITING);
815 if (CADET_CONNECTION_READY != connection->state) 815 if (CADET_CONNECTION_READY != connection->state)
816 connection_change_state (connection, CADET_CONNECTION_SENT); 816 connection_change_state (connection, CADET_CONNECTION_SENT);
817} 817}
@@ -838,7 +838,7 @@ send_broken (struct CadetConnection *c,
838 msg.cid = c->id; 838 msg.cid = c->id;
839 msg.peer1 = *id1; 839 msg.peer1 = *id1;
840 msg.peer2 = *id2; 840 msg.peer2 = *id2;
841 GMC_send_prebuilt_message (&msg.header, 841 GCC_send_prebuilt_message (&msg.header,
842 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, 842 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
843 c, fwd, GNUNET_YES, NULL, NULL); 843 c, fwd, GNUNET_YES, NULL, NULL);
844} 844}
@@ -863,7 +863,7 @@ send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id,
863 struct CadetPeer *neighbor; 863 struct CadetPeer *neighbor;
864 864
865 LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n", 865 LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n",
866 GNUNET_h2s (GM_h2hc (connection_id))); 866 GNUNET_h2s (GC_h2hc (connection_id)));
867 867
868 msg = GNUNET_new (struct GNUNET_CADET_ConnectionBroken); 868 msg = GNUNET_new (struct GNUNET_CADET_ConnectionBroken);
869 msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); 869 msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken));
@@ -874,8 +874,8 @@ send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id,
874 msg->peer2 = *id2; 874 msg->peer2 = *id2;
875 else 875 else
876 memset (&msg->peer2, 0, sizeof (msg->peer2)); 876 memset (&msg->peer2, 0, sizeof (msg->peer2));
877 neighbor = GMP_get (peer_id); 877 neighbor = GCP_get (peer_id);
878 GMP_queue_add (neighbor, msg, 878 GCP_queue_add (neighbor, msg,
879 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 879 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
880 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 2, 880 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 2,
881 sizeof (struct GNUNET_CADET_ConnectionBroken), 881 sizeof (struct GNUNET_CADET_ConnectionBroken),
@@ -898,7 +898,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd)
898 898
899 LOG (GNUNET_ERROR_TYPE_INFO, 899 LOG (GNUNET_ERROR_TYPE_INFO,
900 "keepalive %s for connection %s\n", 900 "keepalive %s for connection %s\n",
901 GM_f2s (fwd), GMC_2s (c)); 901 GC_f2s (fwd), GCC_2s (c));
902 902
903 fc = fwd ? &c->fwd_fc : &c->bck_fc; 903 fc = fwd ? &c->fwd_fc : &c->bck_fc;
904 if (0 < fc->queue_n) 904 if (0 < fc->queue_n)
@@ -913,7 +913,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd)
913 msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE); 913 msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE);
914 914
915 GNUNET_assert (NULL == 915 GNUNET_assert (NULL ==
916 GMT_send_prebuilt_message (&msg, c->t, c, 916 GCT_send_prebuilt_message (&msg, c->t, c,
917 GNUNET_NO, NULL, NULL)); 917 GNUNET_NO, NULL, NULL));
918} 918}
919 919
@@ -929,7 +929,7 @@ connection_recreate (struct CadetConnection *c, int fwd)
929{ 929{
930 LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n"); 930 LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
931 if (fwd) 931 if (fwd)
932 GMC_send_create (c); 932 GCC_send_create (c);
933 else 933 else
934 send_connection_ack (c, GNUNET_NO); 934 send_connection_ack (c, GNUNET_NO);
935} 935}
@@ -949,7 +949,7 @@ connection_maintain (struct CadetConnection *c, int fwd)
949 if (GNUNET_NO != c->destroy) 949 if (GNUNET_NO != c->destroy)
950 return; 950 return;
951 951
952 if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (c->t)) 952 if (CADET_TUNNEL3_SEARCHING == GCT_get_cstate (c->t))
953 { 953 {
954 /* TODO DHT GET with RO_BART */ 954 /* TODO DHT GET with RO_BART */
955 return; 955 return;
@@ -984,7 +984,7 @@ static void
984connection_keepalive (struct CadetConnection *c, int fwd, int shutdown) 984connection_keepalive (struct CadetConnection *c, int fwd, int shutdown)
985{ 985{
986 LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n", 986 LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n",
987 GM_f2s (fwd), GMC_2s (c)); 987 GC_f2s (fwd), GCC_2s (c));
988 988
989 if (fwd) 989 if (fwd)
990 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 990 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1048,7 +1048,7 @@ schedule_next_keepalive (struct CadetConnection *c, int fwd)
1048 GNUNET_SCHEDULER_TaskIdentifier *task_id; 1048 GNUNET_SCHEDULER_TaskIdentifier *task_id;
1049 GNUNET_SCHEDULER_Task keepalive_task; 1049 GNUNET_SCHEDULER_Task keepalive_task;
1050 1050
1051 if (GNUNET_NO == GMC_is_origin (c, fwd)) 1051 if (GNUNET_NO == GCC_is_origin (c, fwd))
1052 return; 1052 return;
1053 1053
1054 /* Calculate delay to use, depending on the state of the connection */ 1054 /* Calculate delay to use, depending on the state of the connection */
@@ -1110,16 +1110,16 @@ connection_unlock_queue (struct CadetConnection *c, int fwd)
1110 1110
1111 LOG (GNUNET_ERROR_TYPE_DEBUG, 1111 LOG (GNUNET_ERROR_TYPE_DEBUG,
1112 "connection_unlock_queue %s on %s\n", 1112 "connection_unlock_queue %s on %s\n",
1113 GM_f2s (fwd), GMC_2s (c)); 1113 GC_f2s (fwd), GCC_2s (c));
1114 1114
1115 if (GMC_is_terminal (c, fwd)) 1115 if (GCC_is_terminal (c, fwd))
1116 { 1116 {
1117 LOG (GNUNET_ERROR_TYPE_DEBUG, " is terminal!\n"); 1117 LOG (GNUNET_ERROR_TYPE_DEBUG, " is terminal!\n");
1118 return; 1118 return;
1119 } 1119 }
1120 1120
1121 peer = get_hop (c, fwd); 1121 peer = get_hop (c, fwd);
1122 GMP_queue_unlock (peer, c); 1122 GCP_queue_unlock (peer, c);
1123} 1123}
1124 1124
1125 1125
@@ -1140,7 +1140,7 @@ connection_cancel_queues (struct CadetConnection *c, int fwd)
1140 1140
1141 LOG (GNUNET_ERROR_TYPE_DEBUG, 1141 LOG (GNUNET_ERROR_TYPE_DEBUG,
1142 " *** Cancel %s queues for connection %s\n", 1142 " *** Cancel %s queues for connection %s\n",
1143 GM_f2s (fwd), GMC_2s (c)); 1143 GC_f2s (fwd), GCC_2s (c));
1144 if (NULL == c) 1144 if (NULL == c)
1145 { 1145 {
1146 GNUNET_break (0); 1146 GNUNET_break (0);
@@ -1155,7 +1155,7 @@ connection_cancel_queues (struct CadetConnection *c, int fwd)
1155 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); 1155 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc);
1156 } 1156 }
1157 peer = get_hop (c, fwd); 1157 peer = get_hop (c, fwd);
1158 GMP_queue_cancel (peer, c); 1158 GCP_queue_cancel (peer, c);
1159} 1159}
1160 1160
1161 1161
@@ -1225,14 +1225,14 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1225 1225
1226 c = fc->c; 1226 c = fc->c;
1227 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n", 1227 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n",
1228 GMC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK"); 1228 GCC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK");
1229 1229
1230 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL); 1230 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL);
1231 msg.header.size = htons (sizeof (msg)); 1231 msg.header.size = htons (sizeof (msg));
1232 msg.pid = htonl (fc->last_pid_sent); 1232 msg.pid = htonl (fc->last_pid_sent);
1233 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent); 1233 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent);
1234 fc->poll_msg = 1234 fc->poll_msg =
1235 GMC_send_prebuilt_message (&msg.header, 1235 GCC_send_prebuilt_message (&msg.header,
1236 GNUNET_MESSAGE_TYPE_CADET_POLL, 1236 GNUNET_MESSAGE_TYPE_CADET_POLL,
1237 fc->last_pid_sent, 1237 fc->last_pid_sent,
1238 c, fc == &c->fwd_fc, GNUNET_YES, 1238 c, fc == &c->fwd_fc, GNUNET_YES,
@@ -1258,14 +1258,14 @@ connection_fwd_timeout (void *cls,
1258 return; 1258 return;
1259 1259
1260 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s FWD timed out. Destroying.\n", 1260 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s FWD timed out. Destroying.\n",
1261 GMC_2s (c)); 1261 GCC_2s (c));
1262 if (GMC_is_origin (c, GNUNET_YES)) /* If local, leave. */ 1262 if (GCC_is_origin (c, GNUNET_YES)) /* If local, leave. */
1263 { 1263 {
1264 GNUNET_break (0); 1264 GNUNET_break (0);
1265 return; 1265 return;
1266 } 1266 }
1267 1267
1268 GMC_destroy (c); 1268 GCC_destroy (c);
1269} 1269}
1270 1270
1271 1271
@@ -1287,15 +1287,15 @@ connection_bck_timeout (void *cls,
1287 return; 1287 return;
1288 1288
1289 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s BCK timed out. Destroying.\n", 1289 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s BCK timed out. Destroying.\n",
1290 GMC_2s (c)); 1290 GCC_2s (c));
1291 1291
1292 if (GMC_is_origin (c, GNUNET_NO)) /* If local, leave. */ 1292 if (GCC_is_origin (c, GNUNET_NO)) /* If local, leave. */
1293 { 1293 {
1294 GNUNET_break (0); 1294 GNUNET_break (0);
1295 return; 1295 return;
1296 } 1296 }
1297 1297
1298 GMC_destroy (c); 1298 GCC_destroy (c);
1299} 1299}
1300 1300
1301 1301
@@ -1316,9 +1316,9 @@ connection_bck_timeout (void *cls,
1316static void 1316static void
1317connection_reset_timeout (struct CadetConnection *c, int fwd) 1317connection_reset_timeout (struct CadetConnection *c, int fwd)
1318{ 1318{
1319 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GM_f2s (fwd)); 1319 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GC_f2s (fwd));
1320 1320
1321 if (GMC_is_origin (c, fwd)) /* Startpoint */ 1321 if (GCC_is_origin (c, fwd)) /* Startpoint */
1322 { 1322 {
1323 schedule_next_keepalive (c, fwd); 1323 schedule_next_keepalive (c, fwd);
1324 } 1324 }
@@ -1357,33 +1357,33 @@ register_neighbors (struct CadetConnection *c)
1357 prev_peer = get_prev_hop (c); 1357 prev_peer = get_prev_hop (c);
1358 1358
1359 LOG (GNUNET_ERROR_TYPE_DEBUG, "register neighbors for connection %s\n", 1359 LOG (GNUNET_ERROR_TYPE_DEBUG, "register neighbors for connection %s\n",
1360 GMC_2s (c)); 1360 GCC_2s (c));
1361 path_debug (c->path); 1361 path_debug (c->path);
1362 LOG (GNUNET_ERROR_TYPE_DEBUG, "own pos %u\n", c->own_pos); 1362 LOG (GNUNET_ERROR_TYPE_DEBUG, "own pos %u\n", c->own_pos);
1363 LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to next peer %p\n", 1363 LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to next peer %p\n",
1364 GMC_2s (c), next_peer); 1364 GCC_2s (c), next_peer);
1365 LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n", next_peer, GMP_2s (next_peer)); 1365 LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n", next_peer, GCP_2s (next_peer));
1366 LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to prev peer %p\n", 1366 LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to prev peer %p\n",
1367 GMC_2s (c), prev_peer); 1367 GCC_2s (c), prev_peer);
1368 LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GMP_2s (prev_peer)); 1368 LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GCP_2s (prev_peer));
1369 1369
1370 if (GNUNET_NO == GMP_is_neighbor (next_peer) 1370 if (GNUNET_NO == GCP_is_neighbor (next_peer)
1371 || GNUNET_NO == GMP_is_neighbor (prev_peer)) 1371 || GNUNET_NO == GCP_is_neighbor (prev_peer))
1372 { 1372 {
1373 if (GMC_is_origin (c, GNUNET_YES)) 1373 if (GCC_is_origin (c, GNUNET_YES))
1374 GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO); 1374 GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
1375 GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO); 1375 GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO);
1376 1376
1377 LOG (GNUNET_ERROR_TYPE_DEBUG, " register neighbors failed\n"); 1377 LOG (GNUNET_ERROR_TYPE_DEBUG, " register neighbors failed\n");
1378 LOG (GNUNET_ERROR_TYPE_DEBUG, " prev: %s, neighbor?: %d\n", 1378 LOG (GNUNET_ERROR_TYPE_DEBUG, " prev: %s, neighbor?: %d\n",
1379 GMP_2s (prev_peer), GMP_is_neighbor (prev_peer)); 1379 GCP_2s (prev_peer), GCP_is_neighbor (prev_peer));
1380 LOG (GNUNET_ERROR_TYPE_DEBUG, " next: %s, neighbor?: %d\n", 1380 LOG (GNUNET_ERROR_TYPE_DEBUG, " next: %s, neighbor?: %d\n",
1381 GMP_2s (next_peer), GMP_is_neighbor (next_peer)); 1381 GCP_2s (next_peer), GCP_is_neighbor (next_peer));
1382 return GNUNET_SYSERR; 1382 return GNUNET_SYSERR;
1383 } 1383 }
1384 1384
1385 GMP_add_connection (next_peer, c); 1385 GCP_add_connection (next_peer, c);
1386 GMP_add_connection (prev_peer, c); 1386 GCP_add_connection (prev_peer, c);
1387 1387
1388 return GNUNET_OK; 1388 return GNUNET_OK;
1389} 1389}
@@ -1400,21 +1400,21 @@ unregister_neighbors (struct CadetConnection *c)
1400 struct CadetPeer *peer; 1400 struct CadetPeer *peer;
1401 1401
1402 peer = get_next_hop (c); 1402 peer = get_next_hop (c);
1403 if (GNUNET_OK != GMP_remove_connection (peer, c)) 1403 if (GNUNET_OK != GCP_remove_connection (peer, c))
1404 { 1404 {
1405 GNUNET_assert (CADET_CONNECTION_NEW == c->state 1405 GNUNET_assert (CADET_CONNECTION_NEW == c->state
1406 || CADET_CONNECTION_DESTROYED == c->state); 1406 || CADET_CONNECTION_DESTROYED == c->state);
1407 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); 1407 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
1408 if (NULL != c->t) GMT_debug (c->t); 1408 if (NULL != c->t) GCT_debug (c->t);
1409 } 1409 }
1410 1410
1411 peer = get_prev_hop (c); 1411 peer = get_prev_hop (c);
1412 if (GNUNET_OK != GMP_remove_connection (peer, c)) 1412 if (GNUNET_OK != GCP_remove_connection (peer, c))
1413 { 1413 {
1414 GNUNET_assert (CADET_CONNECTION_NEW == c->state 1414 GNUNET_assert (CADET_CONNECTION_NEW == c->state
1415 || CADET_CONNECTION_DESTROYED == c->state); 1415 || CADET_CONNECTION_DESTROYED == c->state);
1416 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); 1416 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
1417 if (NULL != c->t) GMT_debug (c->t); 1417 if (NULL != c->t) GCT_debug (c->t);
1418 } 1418 }
1419} 1419}
1420 1420
@@ -1431,9 +1431,9 @@ unregister_neighbors (struct CadetConnection *c)
1431static void 1431static void
1432add_to_peer (struct CadetConnection *c, struct CadetPeer *peer) 1432add_to_peer (struct CadetConnection *c, struct CadetPeer *peer)
1433{ 1433{
1434 GMP_add_tunnel (peer); 1434 GCP_add_tunnel (peer);
1435 c->t = GMP_get_tunnel (peer); 1435 c->t = GCP_get_tunnel (peer);
1436 GMT_add_connection (c->t, c); 1436 GCT_add_connection (c->t, c);
1437} 1437}
1438 1438
1439 1439
@@ -1511,7 +1511,7 @@ log_message (const struct GNUNET_MessageHeader *message,
1511 const struct GNUNET_CADET_Hash *hash) 1511 const struct GNUNET_CADET_Hash *hash)
1512{ 1512{
1513 LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n", 1513 LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n",
1514 GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)), 1514 GC_m2s (ntohs (message->type)), GNUNET_h2s (GC_h2hc (hash)),
1515 GNUNET_i2s (peer)); 1515 GNUNET_i2s (peer));
1516} 1516}
1517 1517
@@ -1530,7 +1530,7 @@ log_message (const struct GNUNET_MessageHeader *message,
1530 * GNUNET_SYSERR to close it (signal serious error) 1530 * GNUNET_SYSERR to close it (signal serious error)
1531 */ 1531 */
1532int 1532int
1533GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, 1533GCC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1534 const struct GNUNET_MessageHeader *message) 1534 const struct GNUNET_MessageHeader *message)
1535{ 1535{
1536 struct GNUNET_CADET_ConnectionCreate *msg; 1536 struct GNUNET_CADET_ConnectionCreate *msg;
@@ -1589,7 +1589,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1589 } 1589 }
1590 LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos); 1590 LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
1591 LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n"); 1591 LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
1592 c = GMC_new (cid, NULL, path_duplicate (path), own_pos); 1592 c = GCC_new (cid, NULL, path_duplicate (path), own_pos);
1593 if (NULL == c) 1593 if (NULL == c)
1594 { 1594 {
1595 if (path->length - 1 == own_pos) 1595 if (path->length - 1 == own_pos)
@@ -1604,7 +1604,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1604 path_destroy (path); 1604 path_destroy (path);
1605 return GNUNET_OK; 1605 return GNUNET_OK;
1606 } 1606 }
1607 GMP_add_path_to_all (path, GNUNET_NO); 1607 GCP_add_path_to_all (path, GNUNET_NO);
1608 connection_reset_timeout (c, GNUNET_YES); 1608 connection_reset_timeout (c, GNUNET_YES);
1609 } 1609 }
1610 else 1610 else
@@ -1615,18 +1615,18 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1615 connection_change_state (c, CADET_CONNECTION_SENT); 1615 connection_change_state (c, CADET_CONNECTION_SENT);
1616 1616
1617 /* Remember peers */ 1617 /* Remember peers */
1618 dest_peer = GMP_get (&id[size - 1]); 1618 dest_peer = GCP_get (&id[size - 1]);
1619 orig_peer = GMP_get (&id[0]); 1619 orig_peer = GCP_get (&id[0]);
1620 1620
1621 /* Is it a connection to us? */ 1621 /* Is it a connection to us? */
1622 if (c->own_pos == path->length - 1) 1622 if (c->own_pos == path->length - 1)
1623 { 1623 {
1624 LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); 1624 LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n");
1625 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES); 1625 GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES);
1626 1626
1627 add_to_peer (c, orig_peer); 1627 add_to_peer (c, orig_peer);
1628 if (CADET_TUNNEL3_NEW == GMT_get_cstate (c->t)) 1628 if (CADET_TUNNEL3_NEW == GCT_get_cstate (c->t))
1629 GMT_change_cstate (c->t, CADET_TUNNEL3_WAITING); 1629 GCT_change_cstate (c->t, CADET_TUNNEL3_WAITING);
1630 1630
1631 send_connection_ack (c, GNUNET_NO); 1631 send_connection_ack (c, GNUNET_NO);
1632 if (CADET_CONNECTION_SENT == c->state) 1632 if (CADET_CONNECTION_SENT == c->state)
@@ -1636,9 +1636,9 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1636 { 1636 {
1637 /* It's for somebody else! Retransmit. */ 1637 /* It's for somebody else! Retransmit. */
1638 LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n"); 1638 LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n");
1639 GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); 1639 GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO);
1640 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); 1640 GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO);
1641 GMC_send_prebuilt_message (message, 1641 GCC_send_prebuilt_message (message,
1642 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, 1642 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
1643 c, GNUNET_YES, GNUNET_YES, 1643 c, GNUNET_YES, GNUNET_YES,
1644 NULL, NULL); 1644 NULL, NULL);
@@ -1659,7 +1659,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1659 * GNUNET_SYSERR to close it (signal serious error) 1659 * GNUNET_SYSERR to close it (signal serious error)
1660 */ 1660 */
1661int 1661int
1662GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, 1662GCC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1663 const struct GNUNET_MessageHeader *message) 1663 const struct GNUNET_MessageHeader *message)
1664{ 1664{
1665 struct GNUNET_CADET_ConnectionACK *msg; 1665 struct GNUNET_CADET_ConnectionACK *msg;
@@ -1689,7 +1689,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1689 1689
1690 oldstate = c->state; 1690 oldstate = c->state;
1691 LOG (GNUNET_ERROR_TYPE_DEBUG, " via peer %s\n", GNUNET_i2s (peer)); 1691 LOG (GNUNET_ERROR_TYPE_DEBUG, " via peer %s\n", GNUNET_i2s (peer));
1692 pi = GMP_get (peer); 1692 pi = GCP_get (peer);
1693 if (get_next_hop (c) == pi) 1693 if (get_next_hop (c) == pi)
1694 { 1694 {
1695 LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n"); 1695 LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n");
@@ -1715,7 +1715,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1715 p = c->path; 1715 p = c->path;
1716 if (NULL != p) 1716 if (NULL != p)
1717 { 1717 {
1718 GMP_add_path_to_all (p, GNUNET_YES); 1718 GCP_add_path_to_all (p, GNUNET_YES);
1719 } 1719 }
1720 else 1720 else
1721 { 1721 {
@@ -1723,7 +1723,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1723 } 1723 }
1724 1724
1725 /* Message for us as creator? */ 1725 /* Message for us as creator? */
1726 if (GMC_is_origin (c, GNUNET_YES)) 1726 if (GCC_is_origin (c, GNUNET_YES))
1727 { 1727 {
1728 if (GNUNET_NO != fwd) 1728 if (GNUNET_NO != fwd)
1729 { 1729 {
@@ -1741,14 +1741,14 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1741 send_connection_ack (c, GNUNET_YES); 1741 send_connection_ack (c, GNUNET_YES);
1742 1742
1743 /* Change tunnel state, trigger KX */ 1743 /* Change tunnel state, trigger KX */
1744 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 1744 if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t))
1745 GMT_change_cstate (c->t, CADET_TUNNEL3_READY); 1745 GCT_change_cstate (c->t, CADET_TUNNEL3_READY);
1746 1746
1747 return GNUNET_OK; 1747 return GNUNET_OK;
1748 } 1748 }
1749 1749
1750 /* Message for us as destination? */ 1750 /* Message for us as destination? */
1751 if (GMC_is_terminal (c, GNUNET_YES)) 1751 if (GCC_is_terminal (c, GNUNET_YES))
1752 { 1752 {
1753 if (GNUNET_YES != fwd) 1753 if (GNUNET_YES != fwd)
1754 { 1754 {
@@ -1762,14 +1762,14 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1762 connection_reset_timeout (c, GNUNET_NO); 1762 connection_reset_timeout (c, GNUNET_NO);
1763 1763
1764 /* Change tunnel state */ 1764 /* Change tunnel state */
1765 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 1765 if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t))
1766 GMT_change_cstate (c->t, CADET_TUNNEL3_READY); 1766 GCT_change_cstate (c->t, CADET_TUNNEL3_READY);
1767 1767
1768 return GNUNET_OK; 1768 return GNUNET_OK;
1769 } 1769 }
1770 1770
1771 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); 1771 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
1772 GMC_send_prebuilt_message (message, 1772 GCC_send_prebuilt_message (message,
1773 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, 1773 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
1774 c, fwd, GNUNET_YES, NULL, NULL); 1774 c, fwd, GNUNET_YES, NULL, NULL);
1775 return GNUNET_OK; 1775 return GNUNET_OK;
@@ -1787,7 +1787,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1787 * GNUNET_SYSERR to close it (signal serious error) 1787 * GNUNET_SYSERR to close it (signal serious error)
1788 */ 1788 */
1789int 1789int
1790GMC_handle_broken (void* cls, 1790GCC_handle_broken (void* cls,
1791 const struct GNUNET_PeerIdentity* id, 1791 const struct GNUNET_PeerIdentity* id,
1792 const struct GNUNET_MessageHeader* message) 1792 const struct GNUNET_MessageHeader* message)
1793{ 1793{
@@ -1809,29 +1809,29 @@ GMC_handle_broken (void* cls,
1809 } 1809 }
1810 1810
1811 fwd = is_fwd (c, id); 1811 fwd = is_fwd (c, id);
1812 if (GMC_is_terminal (c, fwd)) 1812 if (GCC_is_terminal (c, fwd))
1813 { 1813 {
1814 struct GNUNET_MessageHeader *out_msg; 1814 struct GNUNET_MessageHeader *out_msg;
1815 struct CadetPeer *neighbor; 1815 struct CadetPeer *neighbor;
1816 struct CadetPeer *endpoint; 1816 struct CadetPeer *endpoint;
1817 1817
1818 neighbor = get_hop (c, !fwd); 1818 neighbor = get_hop (c, !fwd);
1819 endpoint = GMP_get_short (c->path->peers[c->path->length - 1]); 1819 endpoint = GCP_get_short (c->path->peers[c->path->length - 1]);
1820 path_invalidate (c->path); 1820 path_invalidate (c->path);
1821 GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2); 1821 GCP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
1822 c->state = CADET_CONNECTION_DESTROYED; 1822 c->state = CADET_CONNECTION_DESTROYED;
1823 while (NULL != (out_msg = GMP_connection_pop (neighbor, c))) 1823 while (NULL != (out_msg = GCP_connection_pop (neighbor, c)))
1824 { 1824 {
1825 GNUNET_assert (NULL == 1825 GNUNET_assert (NULL ==
1826 GMT_send_prebuilt_message (out_msg, c->t, NULL, GNUNET_YES, 1826 GCT_send_prebuilt_message (out_msg, c->t, NULL, GNUNET_YES,
1827 NULL, NULL)); 1827 NULL, NULL));
1828 } 1828 }
1829 1829
1830 GMC_destroy (c); 1830 GCC_destroy (c);
1831 } 1831 }
1832 else 1832 else
1833 { 1833 {
1834 GMC_send_prebuilt_message (message, 1834 GCC_send_prebuilt_message (message,
1835 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, 1835 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
1836 c, fwd, GNUNET_YES, NULL, NULL); 1836 c, fwd, GNUNET_YES, NULL, NULL);
1837 c->destroy = GNUNET_YES; 1837 c->destroy = GNUNET_YES;
@@ -1854,7 +1854,7 @@ GMC_handle_broken (void* cls,
1854 * GNUNET_SYSERR to close it (signal serious error) 1854 * GNUNET_SYSERR to close it (signal serious error)
1855 */ 1855 */
1856int 1856int
1857GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, 1857GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1858 const struct GNUNET_MessageHeader *message) 1858 const struct GNUNET_MessageHeader *message)
1859{ 1859{
1860 struct GNUNET_CADET_ConnectionDestroy *msg; 1860 struct GNUNET_CADET_ConnectionDestroy *msg;
@@ -1881,21 +1881,21 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1881 GNUNET_break_op (0); /* FIXME */ 1881 GNUNET_break_op (0); /* FIXME */
1882 return GNUNET_OK; 1882 return GNUNET_OK;
1883 } 1883 }
1884 if (GNUNET_NO == GMC_is_terminal (c, fwd)) 1884 if (GNUNET_NO == GCC_is_terminal (c, fwd))
1885 GMC_send_prebuilt_message (message, 1885 GCC_send_prebuilt_message (message,
1886 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, 1886 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
1887 c, fwd, GNUNET_YES, NULL, NULL); 1887 c, fwd, GNUNET_YES, NULL, NULL);
1888 else if (0 == c->pending_messages) 1888 else if (0 == c->pending_messages)
1889 { 1889 {
1890 LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n"); 1890 LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n");
1891 GMC_destroy (c); 1891 GCC_destroy (c);
1892 return GNUNET_OK; 1892 return GNUNET_OK;
1893 } 1893 }
1894 c->destroy = GNUNET_YES; 1894 c->destroy = GNUNET_YES;
1895 c->state = CADET_CONNECTION_DESTROYED; 1895 c->state = CADET_CONNECTION_DESTROYED;
1896 if (NULL != c->t) 1896 if (NULL != c->t)
1897 { 1897 {
1898 GMT_remove_connection (c->t, c); 1898 GCT_remove_connection (c->t, c);
1899 c->t = NULL; 1899 c->t = NULL;
1900 } 1900 }
1901 1901
@@ -1942,24 +1942,24 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
1942 { 1942 {
1943 GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); 1943 GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
1944 LOG (GNUNET_ERROR_TYPE_DEBUG, "enc on unknown connection %s\n", 1944 LOG (GNUNET_ERROR_TYPE_DEBUG, "enc on unknown connection %s\n",
1945 GNUNET_h2s (GM_h2hc (&msg->cid))); 1945 GNUNET_h2s (GC_h2hc (&msg->cid)));
1946 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); 1946 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer);
1947 return GNUNET_OK; 1947 return GNUNET_OK;
1948 } 1948 }
1949 1949
1950 LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s\n", GMC_2s (c)); 1950 LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s\n", GCC_2s (c));
1951 1951
1952 /* Check if origin is as expected */ 1952 /* Check if origin is as expected */
1953 neighbor = get_prev_hop (c); 1953 neighbor = get_prev_hop (c);
1954 peer_id = GNUNET_PEER_search (peer); 1954 peer_id = GNUNET_PEER_search (peer);
1955 if (peer_id == GMP_get_short_id (neighbor)) 1955 if (peer_id == GCP_get_short_id (neighbor))
1956 { 1956 {
1957 fwd = GNUNET_YES; 1957 fwd = GNUNET_YES;
1958 } 1958 }
1959 else 1959 else
1960 { 1960 {
1961 neighbor = get_next_hop (c); 1961 neighbor = get_next_hop (c);
1962 if (peer_id == GMP_get_short_id (neighbor)) 1962 if (peer_id == GCP_get_short_id (neighbor))
1963 { 1963 {
1964 fwd = GNUNET_NO; 1964 fwd = GNUNET_NO;
1965 } 1965 }
@@ -1976,7 +1976,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
1976 pid = ntohl (msg->pid); 1976 pid = ntohl (msg->pid);
1977 LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected %u+)\n", 1977 LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected %u+)\n",
1978 pid, fc->last_pid_recv + 1); 1978 pid, fc->last_pid_recv + 1);
1979 if (GM_is_pid_bigger (pid, fc->last_ack_sent)) 1979 if (GC_is_pid_bigger (pid, fc->last_ack_sent))
1980 { 1980 {
1981 GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); 1981 GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO);
1982 GNUNET_break_op (0); 1982 GNUNET_break_op (0);
@@ -1985,7 +1985,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
1985 pid, fc->last_pid_recv, fc->last_ack_sent); 1985 pid, fc->last_pid_recv, fc->last_ack_sent);
1986 return GNUNET_OK; 1986 return GNUNET_OK;
1987 } 1987 }
1988 if (GNUNET_NO == GM_is_pid_bigger (pid, fc->last_pid_recv)) 1988 if (GNUNET_NO == GC_is_pid_bigger (pid, fc->last_pid_recv))
1989 { 1989 {
1990 GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO); 1990 GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO);
1991 LOG (GNUNET_ERROR_TYPE_DEBUG, 1991 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1999,7 +1999,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
1999 fc->last_pid_recv = pid; 1999 fc->last_pid_recv = pid;
2000 2000
2001 /* Is this message for us? */ 2001 /* Is this message for us? */
2002 if (GMC_is_terminal (c, fwd)) 2002 if (GCC_is_terminal (c, fwd))
2003 { 2003 {
2004 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n"); 2004 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n");
2005 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); 2005 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO);
@@ -2010,8 +2010,8 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
2010 return GNUNET_OK; 2010 return GNUNET_OK;
2011 } 2011 }
2012 fc->last_pid_recv = pid; 2012 fc->last_pid_recv = pid;
2013 GMT_handle_encrypted (c->t, msg); 2013 GCT_handle_encrypted (c->t, msg);
2014 GMC_send_ack (c, fwd, GNUNET_NO); 2014 GCC_send_ack (c, fwd, GNUNET_NO);
2015 return GNUNET_OK; 2015 return GNUNET_OK;
2016 } 2016 }
2017 2017
@@ -2023,12 +2023,12 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
2023 { 2023 {
2024 GNUNET_STATISTICS_update (stats, "# TTL drops", 1, GNUNET_NO); 2024 GNUNET_STATISTICS_update (stats, "# TTL drops", 1, GNUNET_NO);
2025 LOG (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n"); 2025 LOG (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n");
2026 GMC_send_ack (c, fwd, GNUNET_NO); 2026 GCC_send_ack (c, fwd, GNUNET_NO);
2027 return GNUNET_OK; 2027 return GNUNET_OK;
2028 } 2028 }
2029 2029
2030 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); 2030 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
2031 GMC_send_prebuilt_message (&msg->header, 2031 GCC_send_prebuilt_message (&msg->header,
2032 GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0, 2032 GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0,
2033 c, fwd, GNUNET_NO, NULL, NULL); 2033 c, fwd, GNUNET_NO, NULL, NULL);
2034 2034
@@ -2072,23 +2072,23 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2072 { 2072 {
2073 GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); 2073 GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
2074 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n", 2074 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n",
2075 GNUNET_h2s (GM_h2hc (&msg->cid))); 2075 GNUNET_h2s (GC_h2hc (&msg->cid)));
2076 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); 2076 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer);
2077 return GNUNET_OK; 2077 return GNUNET_OK;
2078 } 2078 }
2079 LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c)); 2079 LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GCC_2s (c));
2080 2080
2081 /* Check if origin is as expected */ 2081 /* Check if origin is as expected */
2082 neighbor = get_prev_hop (c); 2082 neighbor = get_prev_hop (c);
2083 peer_id = GNUNET_PEER_search (peer); 2083 peer_id = GNUNET_PEER_search (peer);
2084 if (peer_id == GMP_get_short_id (neighbor)) 2084 if (peer_id == GCP_get_short_id (neighbor))
2085 { 2085 {
2086 fwd = GNUNET_YES; 2086 fwd = GNUNET_YES;
2087 } 2087 }
2088 else 2088 else
2089 { 2089 {
2090 neighbor = get_next_hop (c); 2090 neighbor = get_next_hop (c);
2091 if (peer_id == GMP_get_short_id (neighbor)) 2091 if (peer_id == GCP_get_short_id (neighbor))
2092 { 2092 {
2093 fwd = GNUNET_NO; 2093 fwd = GNUNET_NO;
2094 } 2094 }
@@ -2106,14 +2106,14 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2106 connection_change_state (c, CADET_CONNECTION_READY); 2106 connection_change_state (c, CADET_CONNECTION_READY);
2107 if (NULL != c->t) 2107 if (NULL != c->t)
2108 { 2108 {
2109 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 2109 if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t))
2110 GMT_change_cstate (c->t, CADET_TUNNEL3_READY); 2110 GCT_change_cstate (c->t, CADET_TUNNEL3_READY);
2111 } 2111 }
2112 } 2112 }
2113 connection_reset_timeout (c, fwd); 2113 connection_reset_timeout (c, fwd);
2114 2114
2115 /* Is this message for us? */ 2115 /* Is this message for us? */
2116 if (GMC_is_terminal (c, fwd)) 2116 if (GCC_is_terminal (c, fwd))
2117 { 2117 {
2118 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n"); 2118 LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n");
2119 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); 2119 GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO);
@@ -2122,14 +2122,14 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2122 GNUNET_break (0); 2122 GNUNET_break (0);
2123 return GNUNET_OK; 2123 return GNUNET_OK;
2124 } 2124 }
2125 GMT_handle_kx (c->t, &msg[1].header); 2125 GCT_handle_kx (c->t, &msg[1].header);
2126 return GNUNET_OK; 2126 return GNUNET_OK;
2127 } 2127 }
2128 2128
2129 /* Message not for us: forward to next hop */ 2129 /* Message not for us: forward to next hop */
2130 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); 2130 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
2131 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); 2131 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
2132 GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0, 2132 GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0,
2133 c, fwd, GNUNET_NO, NULL, NULL); 2133 c, fwd, GNUNET_NO, NULL, NULL);
2134 2134
2135 return GNUNET_OK; 2135 return GNUNET_OK;
@@ -2147,7 +2147,7 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2147 * GNUNET_SYSERR to close it (signal serious error) 2147 * GNUNET_SYSERR to close it (signal serious error)
2148 */ 2148 */
2149int 2149int
2150GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, 2150GCC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
2151 const struct GNUNET_MessageHeader *message) 2151 const struct GNUNET_MessageHeader *message)
2152{ 2152{
2153 return handle_cadet_encrypted (peer, 2153 return handle_cadet_encrypted (peer,
@@ -2166,7 +2166,7 @@ GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
2166 * GNUNET_SYSERR to close it (signal serious error) 2166 * GNUNET_SYSERR to close it (signal serious error)
2167 */ 2167 */
2168int 2168int
2169GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, 2169GCC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
2170 const struct GNUNET_MessageHeader *message) 2170 const struct GNUNET_MessageHeader *message)
2171{ 2171{
2172 return handle_cadet_kx (peer, 2172 return handle_cadet_kx (peer,
@@ -2185,7 +2185,7 @@ GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
2185 * GNUNET_SYSERR to close it (signal serious error) 2185 * GNUNET_SYSERR to close it (signal serious error)
2186 */ 2186 */
2187int 2187int
2188GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, 2188GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2189 const struct GNUNET_MessageHeader *message) 2189 const struct GNUNET_MessageHeader *message)
2190{ 2190{
2191 struct GNUNET_CADET_ACK *msg; 2191 struct GNUNET_CADET_ACK *msg;
@@ -2208,13 +2208,13 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2208 2208
2209 /* Is this a forward or backward ACK? */ 2209 /* Is this a forward or backward ACK? */
2210 id = GNUNET_PEER_search (peer); 2210 id = GNUNET_PEER_search (peer);
2211 if (GMP_get_short_id (get_next_hop (c)) == id) 2211 if (GCP_get_short_id (get_next_hop (c)) == id)
2212 { 2212 {
2213 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n"); 2213 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
2214 fc = &c->fwd_fc; 2214 fc = &c->fwd_fc;
2215 fwd = GNUNET_YES; 2215 fwd = GNUNET_YES;
2216 } 2216 }
2217 else if (GMP_get_short_id (get_prev_hop (c)) == id) 2217 else if (GCP_get_short_id (get_prev_hop (c)) == id)
2218 { 2218 {
2219 LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n"); 2219 LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
2220 fc = &c->bck_fc; 2220 fc = &c->bck_fc;
@@ -2229,12 +2229,12 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2229 ack = ntohl (msg->ack); 2229 ack = ntohl (msg->ack);
2230 LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u (was %u)\n", 2230 LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u (was %u)\n",
2231 ack, fc->last_ack_recv); 2231 ack, fc->last_ack_recv);
2232 if (GM_is_pid_bigger (ack, fc->last_ack_recv)) 2232 if (GC_is_pid_bigger (ack, fc->last_ack_recv))
2233 fc->last_ack_recv = ack; 2233 fc->last_ack_recv = ack;
2234 2234
2235 /* Cancel polling if the ACK is big enough. */ 2235 /* Cancel polling if the ACK is big enough. */
2236 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && 2236 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task &&
2237 GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) 2237 GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent))
2238 { 2238 {
2239 LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); 2239 LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n");
2240 GNUNET_SCHEDULER_cancel (fc->poll_task); 2240 GNUNET_SCHEDULER_cancel (fc->poll_task);
@@ -2259,7 +2259,7 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2259 * GNUNET_SYSERR to close it (signal serious error) 2259 * GNUNET_SYSERR to close it (signal serious error)
2260 */ 2260 */
2261int 2261int
2262GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, 2262GCC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2263 const struct GNUNET_MessageHeader *message) 2263 const struct GNUNET_MessageHeader *message)
2264{ 2264{
2265 struct GNUNET_CADET_Poll *msg; 2265 struct GNUNET_CADET_Poll *msg;
@@ -2277,7 +2277,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2277 GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1, 2277 GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1,
2278 GNUNET_NO); 2278 GNUNET_NO);
2279 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL message on unknown connection %s!\n", 2279 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL message on unknown connection %s!\n",
2280 GNUNET_h2s (GM_h2hc (&msg->cid))); 2280 GNUNET_h2s (GC_h2hc (&msg->cid)));
2281 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); 2281 send_broken_unknown (&msg->cid, &my_full_id, NULL, peer);
2282 return GNUNET_OK; 2282 return GNUNET_OK;
2283 } 2283 }
@@ -2288,12 +2288,12 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2288 * this way of discerining FWD/BCK should not be a problem. 2288 * this way of discerining FWD/BCK should not be a problem.
2289 */ 2289 */
2290 id = GNUNET_PEER_search (peer); 2290 id = GNUNET_PEER_search (peer);
2291 if (GMP_get_short_id (get_next_hop (c)) == id) 2291 if (GCP_get_short_id (get_next_hop (c)) == id)
2292 { 2292 {
2293 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); 2293 LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n");
2294 fc = &c->fwd_fc; 2294 fc = &c->fwd_fc;
2295 } 2295 }
2296 else if (GMP_get_short_id (get_prev_hop (c)) == id) 2296 else if (GCP_get_short_id (get_prev_hop (c)) == id)
2297 { 2297 {
2298 LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK FC\n"); 2298 LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK FC\n");
2299 fc = &c->bck_fc; 2299 fc = &c->bck_fc;
@@ -2308,7 +2308,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2308 LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n", pid, fc->last_pid_recv); 2308 LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n", pid, fc->last_pid_recv);
2309 fc->last_pid_recv = pid; 2309 fc->last_pid_recv = pid;
2310 fwd = fc == &c->bck_fc; 2310 fwd = fc == &c->bck_fc;
2311 GMC_send_ack (c, fwd, GNUNET_YES); 2311 GCC_send_ack (c, fwd, GNUNET_YES);
2312 2312
2313 return GNUNET_OK; 2313 return GNUNET_OK;
2314} 2314}
@@ -2323,13 +2323,13 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2323 * @param force Send the ACK even if suboptimal (e.g. requested by POLL). 2323 * @param force Send the ACK even if suboptimal (e.g. requested by POLL).
2324 */ 2324 */
2325void 2325void
2326GMC_send_ack (struct CadetConnection *c, int fwd, int force) 2326GCC_send_ack (struct CadetConnection *c, int fwd, int force)
2327{ 2327{
2328 unsigned int buffer; 2328 unsigned int buffer;
2329 2329
2330 LOG (GNUNET_ERROR_TYPE_DEBUG, 2330 LOG (GNUNET_ERROR_TYPE_DEBUG,
2331 "GMC send %s ACK on %s\n", 2331 "GMC send %s ACK on %s\n",
2332 GM_f2s (fwd), GMC_2s (c)); 2332 GC_f2s (fwd), GCC_2s (c));
2333 2333
2334 if (NULL == c) 2334 if (NULL == c)
2335 { 2335 {
@@ -2344,26 +2344,26 @@ GMC_send_ack (struct CadetConnection *c, int fwd, int force)
2344 } 2344 }
2345 2345
2346 /* Get available buffer space */ 2346 /* Get available buffer space */
2347 if (GMC_is_terminal (c, fwd)) 2347 if (GCC_is_terminal (c, fwd))
2348 { 2348 {
2349 LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all channels\n"); 2349 LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all channels\n");
2350 buffer = GMT_get_channels_buffer (c->t); 2350 buffer = GCT_get_channels_buffer (c->t);
2351 } 2351 }
2352 else 2352 else
2353 { 2353 {
2354 LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n"); 2354 LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n");
2355 buffer = GMC_get_buffer (c, fwd); 2355 buffer = GCC_get_buffer (c, fwd);
2356 } 2356 }
2357 LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer); 2357 LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer);
2358 if (0 == buffer && GNUNET_NO == force) 2358 if (0 == buffer && GNUNET_NO == force)
2359 return; 2359 return;
2360 2360
2361 /* Send available buffer space */ 2361 /* Send available buffer space */
2362 if (GMC_is_origin (c, fwd)) 2362 if (GCC_is_origin (c, fwd))
2363 { 2363 {
2364 GNUNET_assert (NULL != c->t); 2364 GNUNET_assert (NULL != c->t);
2365 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channels...\n"); 2365 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channels...\n");
2366 GMT_unchoke_channels (c->t); 2366 GCT_unchoke_channels (c->t);
2367 } 2367 }
2368 else 2368 else
2369 { 2369 {
@@ -2379,7 +2379,7 @@ GMC_send_ack (struct CadetConnection *c, int fwd, int force)
2379 * @param c Configuration handle. 2379 * @param c Configuration handle.
2380 */ 2380 */
2381void 2381void
2382GMC_init (const struct GNUNET_CONFIGURATION_Handle *c) 2382GCC_init (const struct GNUNET_CONFIGURATION_Handle *c)
2383{ 2383{
2384 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); 2384 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
2385 if (GNUNET_OK != 2385 if (GNUNET_OK !=
@@ -2432,7 +2432,7 @@ shutdown_iterator (void *cls,
2432{ 2432{
2433 struct CadetConnection *c = value; 2433 struct CadetConnection *c = value;
2434 2434
2435 GMC_destroy (c); 2435 GCC_destroy (c);
2436 return GNUNET_YES; 2436 return GNUNET_YES;
2437} 2437}
2438 2438
@@ -2441,7 +2441,7 @@ shutdown_iterator (void *cls,
2441 * Shut down the connections subsystem. 2441 * Shut down the connections subsystem.
2442 */ 2442 */
2443void 2443void
2444GMC_shutdown (void) 2444GCC_shutdown (void)
2445{ 2445{
2446 GNUNET_CONTAINER_multihashmap_iterate (connections, &shutdown_iterator, NULL); 2446 GNUNET_CONTAINER_multihashmap_iterate (connections, &shutdown_iterator, NULL);
2447 GNUNET_CONTAINER_multihashmap_destroy (connections); 2447 GNUNET_CONTAINER_multihashmap_destroy (connections);
@@ -2450,7 +2450,7 @@ GMC_shutdown (void)
2450 2450
2451 2451
2452struct CadetConnection * 2452struct CadetConnection *
2453GMC_new (const struct GNUNET_CADET_Hash *cid, 2453GCC_new (const struct GNUNET_CADET_Hash *cid,
2454 struct CadetTunnel3 *t, 2454 struct CadetTunnel3 *t,
2455 struct CadetPeerPath *p, 2455 struct CadetPeerPath *p,
2456 unsigned int own_pos) 2456 unsigned int own_pos)
@@ -2461,7 +2461,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid,
2461 c->id = *cid; 2461 c->id = *cid;
2462 GNUNET_assert (GNUNET_OK == 2462 GNUNET_assert (GNUNET_OK ==
2463 GNUNET_CONTAINER_multihashmap_put (connections, 2463 GNUNET_CONTAINER_multihashmap_put (connections,
2464 GMC_get_h (c), c, 2464 GCC_get_h (c), c,
2465 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 2465 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
2466 fc_init (&c->fwd_fc); 2466 fc_init (&c->fwd_fc);
2467 fc_init (&c->bck_fc); 2467 fc_init (&c->bck_fc);
@@ -2482,7 +2482,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid,
2482 c->t = NULL; 2482 c->t = NULL;
2483 c->path = NULL; 2483 c->path = NULL;
2484 } 2484 }
2485 GMC_destroy (c); 2485 GCC_destroy (c);
2486 return NULL; 2486 return NULL;
2487 } 2487 }
2488 2488
@@ -2491,7 +2491,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid,
2491 2491
2492 2492
2493void 2493void
2494GMC_destroy (struct CadetConnection *c) 2494GCC_destroy (struct CadetConnection *c)
2495{ 2495{
2496 if (NULL == c) 2496 if (NULL == c)
2497 { 2497 {
@@ -2499,11 +2499,11 @@ GMC_destroy (struct CadetConnection *c)
2499 return; 2499 return;
2500 } 2500 }
2501 2501
2502 if (2 == c->destroy) /* cancel queues -> GMP_queue_cancel -> q_destroy -> */ 2502 if (2 == c->destroy) /* cancel queues -> GCP_queue_cancel -> q_destroy -> */
2503 return; /* -> message_sent -> GMC_destroy. Don't loop. */ 2503 return; /* -> message_sent -> GCC_destroy. Don't loop. */
2504 c->destroy = 2; 2504 c->destroy = 2;
2505 2505
2506 LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", GMC_2s (c)); 2506 LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", GCC_2s (c));
2507 LOG (GNUNET_ERROR_TYPE_DEBUG, " fc's f: %p, b: %p\n", 2507 LOG (GNUNET_ERROR_TYPE_DEBUG, " fc's f: %p, b: %p\n",
2508 &c->fwd_fc, &c->bck_fc); 2508 &c->fwd_fc, &c->bck_fc);
2509 LOG (GNUNET_ERROR_TYPE_DEBUG, " fc tasks f: %u, b: %u\n", 2509 LOG (GNUNET_ERROR_TYPE_DEBUG, " fc tasks f: %u, b: %u\n",
@@ -2523,20 +2523,20 @@ GMC_destroy (struct CadetConnection *c)
2523 /* Cancel maintainance task (keepalive/timeout) */ 2523 /* Cancel maintainance task (keepalive/timeout) */
2524 if (NULL != c->fwd_fc.poll_msg) 2524 if (NULL != c->fwd_fc.poll_msg)
2525 { 2525 {
2526 GMC_cancel (c->fwd_fc.poll_msg); 2526 GCC_cancel (c->fwd_fc.poll_msg);
2527 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg FWD canceled\n"); 2527 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg FWD canceled\n");
2528 } 2528 }
2529 if (NULL != c->bck_fc.poll_msg) 2529 if (NULL != c->bck_fc.poll_msg)
2530 { 2530 {
2531 GMC_cancel (c->bck_fc.poll_msg); 2531 GCC_cancel (c->bck_fc.poll_msg);
2532 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg BCK canceled\n"); 2532 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg BCK canceled\n");
2533 } 2533 }
2534 2534
2535 /* Delete from tunnel */ 2535 /* Delete from tunnel */
2536 if (NULL != c->t) 2536 if (NULL != c->t)
2537 GMT_remove_connection (c->t, c); 2537 GCT_remove_connection (c->t, c);
2538 2538
2539 if (GNUNET_NO == GMC_is_origin (c, GNUNET_YES) && NULL != c->path) 2539 if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path)
2540 path_destroy (c->path); 2540 path_destroy (c->path);
2541 if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task) 2541 if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task)
2542 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); 2542 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task);
@@ -2555,7 +2555,7 @@ GMC_destroy (struct CadetConnection *c)
2555 2555
2556 GNUNET_break (GNUNET_YES == 2556 GNUNET_break (GNUNET_YES ==
2557 GNUNET_CONTAINER_multihashmap_remove (connections, 2557 GNUNET_CONTAINER_multihashmap_remove (connections,
2558 GMC_get_h (c), c)); 2558 GCC_get_h (c), c));
2559 2559
2560 GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); 2560 GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO);
2561 GNUNET_free (c); 2561 GNUNET_free (c);
@@ -2569,7 +2569,7 @@ GMC_destroy (struct CadetConnection *c)
2569 * @return ID of the connection. 2569 * @return ID of the connection.
2570 */ 2570 */
2571const struct GNUNET_CADET_Hash * 2571const struct GNUNET_CADET_Hash *
2572GMC_get_id (const struct CadetConnection *c) 2572GCC_get_id (const struct CadetConnection *c)
2573{ 2573{
2574 return &c->id; 2574 return &c->id;
2575} 2575}
@@ -2583,9 +2583,9 @@ GMC_get_id (const struct CadetConnection *c)
2583 * @return ID of the connection. 2583 * @return ID of the connection.
2584 */ 2584 */
2585const struct GNUNET_HashCode * 2585const struct GNUNET_HashCode *
2586GMC_get_h (const struct CadetConnection *c) 2586GCC_get_h (const struct CadetConnection *c)
2587{ 2587{
2588 return GM_h2hc (&c->id); 2588 return GC_h2hc (&c->id);
2589} 2589}
2590 2590
2591 2591
@@ -2597,7 +2597,7 @@ GMC_get_h (const struct CadetConnection *c)
2597 * @return path used by the connection. 2597 * @return path used by the connection.
2598 */ 2598 */
2599const struct CadetPeerPath * 2599const struct CadetPeerPath *
2600GMC_get_path (const struct CadetConnection *c) 2600GCC_get_path (const struct CadetConnection *c)
2601{ 2601{
2602 if (GNUNET_NO == c->destroy) 2602 if (GNUNET_NO == c->destroy)
2603 return c->path; 2603 return c->path;
@@ -2613,7 +2613,7 @@ GMC_get_path (const struct CadetConnection *c)
2613 * @return state of the connection. 2613 * @return state of the connection.
2614 */ 2614 */
2615enum CadetConnectionState 2615enum CadetConnectionState
2616GMC_get_state (const struct CadetConnection *c) 2616GCC_get_state (const struct CadetConnection *c)
2617{ 2617{
2618 return c->state; 2618 return c->state;
2619} 2619}
@@ -2626,7 +2626,7 @@ GMC_get_state (const struct CadetConnection *c)
2626 * @return tunnel of the connection. 2626 * @return tunnel of the connection.
2627 */ 2627 */
2628struct CadetTunnel3 * 2628struct CadetTunnel3 *
2629GMC_get_tunnel (const struct CadetConnection *c) 2629GCC_get_tunnel (const struct CadetConnection *c)
2630{ 2630{
2631 return c->t; 2631 return c->t;
2632} 2632}
@@ -2641,7 +2641,7 @@ GMC_get_tunnel (const struct CadetConnection *c)
2641 * @return Free buffer space [0 - max_msgs_queue/max_connections] 2641 * @return Free buffer space [0 - max_msgs_queue/max_connections]
2642 */ 2642 */
2643unsigned int 2643unsigned int
2644GMC_get_buffer (struct CadetConnection *c, int fwd) 2644GCC_get_buffer (struct CadetConnection *c, int fwd)
2645{ 2645{
2646 struct CadetFlowControl *fc; 2646 struct CadetFlowControl *fc;
2647 2647
@@ -2659,12 +2659,12 @@ GMC_get_buffer (struct CadetConnection *c, int fwd)
2659 * @return last_ack_sent - last_pid_recv 2659 * @return last_ack_sent - last_pid_recv
2660 */ 2660 */
2661unsigned int 2661unsigned int
2662GMC_get_allowed (struct CadetConnection *c, int fwd) 2662GCC_get_allowed (struct CadetConnection *c, int fwd)
2663{ 2663{
2664 struct CadetFlowControl *fc; 2664 struct CadetFlowControl *fc;
2665 2665
2666 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2666 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2667 if (GM_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent)) 2667 if (GC_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent))
2668 { 2668 {
2669 return 0; 2669 return 0;
2670 } 2670 }
@@ -2680,7 +2680,7 @@ GMC_get_allowed (struct CadetConnection *c, int fwd)
2680 * @return Number of messages queued. 2680 * @return Number of messages queued.
2681 */ 2681 */
2682unsigned int 2682unsigned int
2683GMC_get_qn (struct CadetConnection *c, int fwd) 2683GCC_get_qn (struct CadetConnection *c, int fwd)
2684{ 2684{
2685 struct CadetFlowControl *fc; 2685 struct CadetFlowControl *fc;
2686 2686
@@ -2699,7 +2699,7 @@ GMC_get_qn (struct CadetConnection *c, int fwd)
2699 * @return Last PID used + 1. 2699 * @return Last PID used + 1.
2700 */ 2700 */
2701unsigned int 2701unsigned int
2702GMC_get_pid (struct CadetConnection *c, int fwd) 2702GCC_get_pid (struct CadetConnection *c, int fwd)
2703{ 2703{
2704 struct CadetFlowControl *fc; 2704 struct CadetFlowControl *fc;
2705 2705
@@ -2720,10 +2720,10 @@ GMC_get_pid (struct CadetConnection *c, int fwd)
2720 * @param fwd Is this about FWD traffic? (The ack will go dest->root). 2720 * @param fwd Is this about FWD traffic? (The ack will go dest->root).
2721 */ 2721 */
2722void 2722void
2723GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd) 2723GCC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
2724{ 2724{
2725 LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n", 2725 LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n",
2726 GMC_2s (c), buffer, GM_f2s (fwd)); 2726 GCC_2s (c), buffer, GC_f2s (fwd));
2727 send_ack (c, buffer, fwd, GNUNET_NO); 2727 send_ack (c, buffer, fwd, GNUNET_NO);
2728} 2728}
2729 2729
@@ -2736,25 +2736,25 @@ GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
2736 * @param peer Peer that disconnected. 2736 * @param peer Peer that disconnected.
2737 */ 2737 */
2738void 2738void
2739GMC_notify_broken (struct CadetConnection *c, 2739GCC_notify_broken (struct CadetConnection *c,
2740 struct CadetPeer *peer) 2740 struct CadetPeer *peer)
2741{ 2741{
2742 int fwd; 2742 int fwd;
2743 2743
2744 LOG (GNUNET_ERROR_TYPE_DEBUG, 2744 LOG (GNUNET_ERROR_TYPE_DEBUG,
2745 " notify broken on %s due to %s disconnect\n", 2745 " notify broken on %s due to %s disconnect\n",
2746 GMC_2s (c), GMP_2s (peer)); 2746 GCC_2s (c), GCP_2s (peer));
2747 2747
2748 fwd = peer == get_prev_hop (c); 2748 fwd = peer == get_prev_hop (c);
2749 2749
2750 if (GNUNET_YES == GMC_is_terminal (c, fwd)) 2750 if (GNUNET_YES == GCC_is_terminal (c, fwd))
2751 { 2751 {
2752 /* Local shutdown, no one to notify about this. */ 2752 /* Local shutdown, no one to notify about this. */
2753 GMC_destroy (c); 2753 GCC_destroy (c);
2754 return; 2754 return;
2755 } 2755 }
2756 if (GNUNET_NO == c->destroy) 2756 if (GNUNET_NO == c->destroy)
2757 send_broken (c, &my_full_id, GMP_get_id (peer), fwd); 2757 send_broken (c, &my_full_id, GCP_get_id (peer), fwd);
2758 2758
2759 /* Connection will have at least one pending message 2759 /* Connection will have at least one pending message
2760 * (the one we just scheduled), so no point in checking whether to 2760 * (the one we just scheduled), so no point in checking whether to
@@ -2780,7 +2780,7 @@ GMC_notify_broken (struct CadetConnection *c,
2780 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal. 2780 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal.
2781 */ 2781 */
2782int 2782int
2783GMC_is_origin (struct CadetConnection *c, int fwd) 2783GCC_is_origin (struct CadetConnection *c, int fwd)
2784{ 2784{
2785 if (!fwd && c->path->length - 1 == c->own_pos ) 2785 if (!fwd && c->path->length - 1 == c->own_pos )
2786 return GNUNET_YES; 2786 return GNUNET_YES;
@@ -2800,9 +2800,9 @@ GMC_is_origin (struct CadetConnection *c, int fwd)
2800 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin. 2800 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin.
2801 */ 2801 */
2802int 2802int
2803GMC_is_terminal (struct CadetConnection *c, int fwd) 2803GCC_is_terminal (struct CadetConnection *c, int fwd)
2804{ 2804{
2805 return GMC_is_origin (c, !fwd); 2805 return GCC_is_origin (c, !fwd);
2806} 2806}
2807 2807
2808 2808
@@ -2815,12 +2815,12 @@ GMC_is_terminal (struct CadetConnection *c, int fwd)
2815 * @return #GNUNET_YES in case it's OK to send. 2815 * @return #GNUNET_YES in case it's OK to send.
2816 */ 2816 */
2817int 2817int
2818GMC_is_sendable (struct CadetConnection *c, int fwd) 2818GCC_is_sendable (struct CadetConnection *c, int fwd)
2819{ 2819{
2820 struct CadetFlowControl *fc; 2820 struct CadetFlowControl *fc;
2821 2821
2822 LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n", 2822 LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n",
2823 GM_f2s (fwd), GMC_2s (c)); 2823 GC_f2s (fwd), GCC_2s (c));
2824 if (NULL == c) 2824 if (NULL == c)
2825 { 2825 {
2826 GNUNET_break (0); 2826 GNUNET_break (0);
@@ -2830,7 +2830,7 @@ GMC_is_sendable (struct CadetConnection *c, int fwd)
2830 LOG (GNUNET_ERROR_TYPE_DEBUG, 2830 LOG (GNUNET_ERROR_TYPE_DEBUG,
2831 " last ack recv: %u, last pid sent: %u\n", 2831 " last ack recv: %u, last pid sent: %u\n",
2832 fc->last_ack_recv, fc->last_pid_sent); 2832 fc->last_ack_recv, fc->last_pid_sent);
2833 if (GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) 2833 if (GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent))
2834 { 2834 {
2835 LOG (GNUNET_ERROR_TYPE_DEBUG, " sendable\n"); 2835 LOG (GNUNET_ERROR_TYPE_DEBUG, " sendable\n");
2836 return GNUNET_YES; 2836 return GNUNET_YES;
@@ -2848,7 +2848,7 @@ GMC_is_sendable (struct CadetConnection *c, int fwd)
2848 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise. 2848 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise.
2849 */ 2849 */
2850int 2850int
2851GMC_is_direct (struct CadetConnection *c) 2851GCC_is_direct (struct CadetConnection *c)
2852{ 2852{
2853 return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO; 2853 return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO;
2854} 2854}
@@ -2871,10 +2871,10 @@ GMC_is_direct (struct CadetConnection *c)
2871 * Invalid on @c cont call. 2871 * Invalid on @c cont call.
2872 */ 2872 */
2873struct CadetConnectionQueue * 2873struct CadetConnectionQueue *
2874GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 2874GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2875 uint16_t payload_type, uint32_t payload_id, 2875 uint16_t payload_type, uint32_t payload_id,
2876 struct CadetConnection *c, int fwd, int force, 2876 struct CadetConnection *c, int fwd, int force,
2877 GMC_sent cont, void *cont_cls) 2877 GCC_sent cont, void *cont_cls)
2878{ 2878{
2879 struct CadetFlowControl *fc; 2879 struct CadetFlowControl *fc;
2880 struct CadetConnectionQueue *q; 2880 struct CadetConnectionQueue *q;
@@ -2888,7 +2888,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2888 memcpy (data, message, size); 2888 memcpy (data, message, size);
2889 type = ntohs (message->type); 2889 type = ntohs (message->type);
2890 LOG (GNUNET_ERROR_TYPE_INFO, "--> %s (%s %u) on connection %s (%u bytes)\n", 2890 LOG (GNUNET_ERROR_TYPE_INFO, "--> %s (%s %u) on connection %s (%u bytes)\n",
2891 GM_m2s (type), GM_m2s (payload_type), payload_id, GMC_2s (c), size); 2891 GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), size);
2892 2892
2893 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2893 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2894 droppable = GNUNET_NO == force; 2894 droppable = GNUNET_NO == force;
@@ -2925,9 +2925,9 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2925 { 2925 {
2926 LOG (GNUNET_ERROR_TYPE_DEBUG, " not droppable, Q_N stays the same\n"); 2926 LOG (GNUNET_ERROR_TYPE_DEBUG, " not droppable, Q_N stays the same\n");
2927 } 2927 }
2928 if (GM_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) 2928 if (GC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv))
2929 { 2929 {
2930 GMC_start_poll (c, fwd); 2930 GCC_start_poll (c, fwd);
2931 } 2931 }
2932 break; 2932 break;
2933 2933
@@ -2994,11 +2994,11 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2994 2994
2995 q = GNUNET_new (struct CadetConnectionQueue); 2995 q = GNUNET_new (struct CadetConnectionQueue);
2996 q->forced = !droppable; 2996 q->forced = !droppable;
2997 q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id, 2997 q->q = GCP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id,
2998 size, c, fwd, &conn_message_sent, q); 2998 size, c, fwd, &conn_message_sent, q);
2999 if (NULL == q->q) 2999 if (NULL == q->q)
3000 { 3000 {
3001 LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GMC_2s (c)); 3001 LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GCC_2s (c));
3002 GNUNET_free (data); 3002 GNUNET_free (data);
3003 GNUNET_free (q); 3003 GNUNET_free (q);
3004 return NULL; 3004 return NULL;
@@ -3019,12 +3019,12 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3019 * @param q Handle to the queue. 3019 * @param q Handle to the queue.
3020 */ 3020 */
3021void 3021void
3022GMC_cancel (struct CadetConnectionQueue *q) 3022GCC_cancel (struct CadetConnectionQueue *q)
3023{ 3023{
3024 LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n"); 3024 LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n");
3025 3025
3026 /* queue destroy calls message_sent, which calls q->cont and frees q */ 3026 /* queue destroy calls message_sent, which calls q->cont and frees q */
3027 GMP_queue_destroy (q->q, GNUNET_YES, GNUNET_NO, 0); 3027 GCP_queue_destroy (q->q, GNUNET_YES, GNUNET_NO, 0);
3028} 3028}
3029 3029
3030 3030
@@ -3035,7 +3035,7 @@ GMC_cancel (struct CadetConnectionQueue *q)
3035 * @param connection Connection to create. 3035 * @param connection Connection to create.
3036 */ 3036 */
3037void 3037void
3038GMC_send_create (struct CadetConnection *connection) 3038GCC_send_create (struct CadetConnection *connection)
3039{ 3039{
3040 enum CadetTunnel3CState state; 3040 enum CadetTunnel3CState state;
3041 size_t size; 3041 size_t size;
@@ -3044,21 +3044,21 @@ GMC_send_create (struct CadetConnection *connection)
3044 size += connection->path->length * sizeof (struct GNUNET_PeerIdentity); 3044 size += connection->path->length * sizeof (struct GNUNET_PeerIdentity);
3045 3045
3046 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n", 3046 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n",
3047 GM_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE), 3047 GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE),
3048 GMC_2s (connection), size); 3048 GCC_2s (connection), size);
3049 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n", 3049 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n",
3050 connection, connection->pending_messages); 3050 connection, connection->pending_messages);
3051 connection->pending_messages++; 3051 connection->pending_messages++;
3052 3052
3053 connection->maintenance_q = 3053 connection->maintenance_q =
3054 GMP_queue_add (get_next_hop (connection), NULL, 3054 GCP_queue_add (get_next_hop (connection), NULL,
3055 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 3055 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE,
3056 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, 3056 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
3057 size, connection, GNUNET_YES, &conn_message_sent, NULL); 3057 size, connection, GNUNET_YES, &conn_message_sent, NULL);
3058 3058
3059 state = GMT_get_cstate (connection->t); 3059 state = GCT_get_cstate (connection->t);
3060 if (CADET_TUNNEL3_SEARCHING == state || CADET_TUNNEL3_NEW == state) 3060 if (CADET_TUNNEL3_SEARCHING == state || CADET_TUNNEL3_NEW == state)
3061 GMT_change_cstate (connection->t, CADET_TUNNEL3_WAITING); 3061 GCT_change_cstate (connection->t, CADET_TUNNEL3_WAITING);
3062 if (CADET_CONNECTION_NEW == connection->state) 3062 if (CADET_CONNECTION_NEW == connection->state)
3063 connection_change_state (connection, CADET_CONNECTION_SENT); 3063 connection_change_state (connection, CADET_CONNECTION_SENT);
3064} 3064}
@@ -3074,7 +3074,7 @@ GMC_send_create (struct CadetConnection *connection)
3074 * @param c The connection whose peers to notify. 3074 * @param c The connection whose peers to notify.
3075 */ 3075 */
3076void 3076void
3077GMC_send_destroy (struct CadetConnection *c) 3077GCC_send_destroy (struct CadetConnection *c)
3078{ 3078{
3079 struct GNUNET_CADET_ConnectionDestroy msg; 3079 struct GNUNET_CADET_ConnectionDestroy msg;
3080 3080
@@ -3086,14 +3086,14 @@ GMC_send_destroy (struct CadetConnection *c)
3086 msg.cid = c->id; 3086 msg.cid = c->id;
3087 LOG (GNUNET_ERROR_TYPE_DEBUG, 3087 LOG (GNUNET_ERROR_TYPE_DEBUG,
3088 " sending connection destroy for connection %s\n", 3088 " sending connection destroy for connection %s\n",
3089 GMC_2s (c)); 3089 GCC_2s (c));
3090 3090
3091 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES)) 3091 if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES))
3092 GMC_send_prebuilt_message (&msg.header, 3092 GCC_send_prebuilt_message (&msg.header,
3093 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, 3093 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
3094 c, GNUNET_YES, GNUNET_YES, NULL, NULL); 3094 c, GNUNET_YES, GNUNET_YES, NULL, NULL);
3095 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) 3095 if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO))
3096 GMC_send_prebuilt_message (&msg.header, 3096 GCC_send_prebuilt_message (&msg.header,
3097 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, 3097 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
3098 c, GNUNET_NO, GNUNET_YES, NULL, NULL); 3098 c, GNUNET_NO, GNUNET_YES, NULL, NULL);
3099 c->destroy = GNUNET_YES; 3099 c->destroy = GNUNET_YES;
@@ -3112,13 +3112,13 @@ GMC_send_destroy (struct CadetConnection *c)
3112 * @param fwd Should we poll in the FWD direction? 3112 * @param fwd Should we poll in the FWD direction?
3113 */ 3113 */
3114void 3114void
3115GMC_start_poll (struct CadetConnection *c, int fwd) 3115GCC_start_poll (struct CadetConnection *c, int fwd)
3116{ 3116{
3117 struct CadetFlowControl *fc; 3117 struct CadetFlowControl *fc;
3118 3118
3119 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3119 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3120 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", 3120 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n",
3121 GM_f2s (fwd)); 3121 GC_f2s (fwd));
3122 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg) 3122 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg)
3123 { 3123 {
3124 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", 3124 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n",
@@ -3141,7 +3141,7 @@ GMC_start_poll (struct CadetConnection *c, int fwd)
3141 * @param fwd Should we stop the poll in the FWD direction? 3141 * @param fwd Should we stop the poll in the FWD direction?
3142 */ 3142 */
3143void 3143void
3144GMC_stop_poll (struct CadetConnection *c, int fwd) 3144GCC_stop_poll (struct CadetConnection *c, int fwd)
3145{ 3145{
3146 struct CadetFlowControl *fc; 3146 struct CadetFlowControl *fc;
3147 3147
@@ -3159,7 +3159,7 @@ GMC_stop_poll (struct CadetConnection *c, int fwd)
3159 * @param c Connection. 3159 * @param c Connection.
3160 */ 3160 */
3161const char * 3161const char *
3162GMC_2s (const struct CadetConnection *c) 3162GCC_2s (const struct CadetConnection *c)
3163{ 3163{
3164 if (NULL == c) 3164 if (NULL == c)
3165 return "NULL"; 3165 return "NULL";
@@ -3169,8 +3169,8 @@ GMC_2s (const struct CadetConnection *c)
3169 static char buf[128]; 3169 static char buf[128];
3170 3170
3171 sprintf (buf, "%s (->%s)", 3171 sprintf (buf, "%s (->%s)",
3172 GNUNET_h2s (GM_h2hc (GMC_get_id (c))), GMT_2s (c->t)); 3172 GNUNET_h2s (GC_h2hc (GCC_get_id (c))), GCT_2s (c->t));
3173 return buf; 3173 return buf;
3174 } 3174 }
3175 return GNUNET_h2s (GM_h2hc (&c->id)); 3175 return GNUNET_h2s (GC_h2hc (&c->id));
3176} 3176}