aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet_channel.c')
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c210
1 files changed, 105 insertions, 105 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 91338d5c0..c85900456 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -350,7 +350,7 @@ static int
350is_loopback (const struct CadetChannel *ch) 350is_loopback (const struct CadetChannel *ch)
351{ 351{
352 if (NULL != ch->t) 352 if (NULL != ch->t)
353 return GMT_is_loopback (ch->t); 353 return GCT_is_loopback (ch->t);
354 354
355 return (NULL != ch->root && NULL != ch->dest); 355 return (NULL != ch->root && NULL != ch->dest);
356} 356}
@@ -412,7 +412,7 @@ add_buffered_data (const struct GNUNET_CADET_Data *msg,
412 LOG (GNUNET_ERROR_TYPE_DEBUG, " already there!\n"); 412 LOG (GNUNET_ERROR_TYPE_DEBUG, " already there!\n");
413 return; 413 return;
414 } 414 }
415 else if (GM_is_pid_bigger (prev->mid, mid)) 415 else if (GC_is_pid_bigger (prev->mid, mid))
416 { 416 {
417 LOG (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n"); 417 LOG (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n");
418 copy = copy_message (msg, mid, rel); 418 copy = copy_message (msg, mid, rel);
@@ -521,12 +521,12 @@ send_destroy (struct CadetChannel *ch, int local_only)
521 if (NULL != ch->root) 521 if (NULL != ch->root)
522 GML_send_channel_destroy (ch->root, ch->lid_root); 522 GML_send_channel_destroy (ch->root, ch->lid_root);
523 else if (0 == ch->lid_root && GNUNET_NO == local_only) 523 else if (0 == ch->lid_root && GNUNET_NO == local_only)
524 GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); 524 GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL);
525 525
526 if (NULL != ch->dest) 526 if (NULL != ch->dest)
527 GML_send_channel_destroy (ch->dest, ch->lid_dest); 527 GML_send_channel_destroy (ch->dest, ch->lid_dest);
528 else if (0 == ch->lid_dest && GNUNET_NO == local_only) 528 else if (0 == ch->lid_dest && GNUNET_NO == local_only)
529 GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL); 529 GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL);
530} 530}
531 531
532 532
@@ -547,7 +547,7 @@ send_client_create (struct CadetChannel *ch)
547 opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0; 547 opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0;
548 opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0; 548 opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0;
549 GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt, 549 GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt,
550 GMT_get_destination (ch->t)); 550 GCT_get_destination (ch->t));
551 551
552} 552}
553 553
@@ -640,7 +640,7 @@ send_client_buffered_data (struct CadetChannel *ch,
640 * deliver missing messages 640 * deliver missing messages
641 */ 641 */
642 send_destroy (ch, GNUNET_YES); 642 send_destroy (ch, GNUNET_YES);
643 GMCH_destroy (ch); 643 GCCH_destroy (ch);
644 } 644 }
645 } 645 }
646 } 646 }
@@ -669,7 +669,7 @@ send_client_ack (struct CadetChannel *ch, int fwd)
669 } 669 }
670 LOG (GNUNET_ERROR_TYPE_DEBUG, 670 LOG (GNUNET_ERROR_TYPE_DEBUG,
671 " sending %s ack to client on channel %s\n", 671 " sending %s ack to client on channel %s\n",
672 GM_f2s (fwd), GMCH_2s (ch)); 672 GC_f2s (fwd), GCCH_2s (ch));
673 673
674 if (NULL == rel) 674 if (NULL == rel)
675 { 675 {
@@ -739,7 +739,7 @@ channel_retransmit_message (void *cls,
739 /* Message not found in the queue that we are going to use. */ 739 /* Message not found in the queue that we are going to use. */
740 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid); 740 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid);
741 741
742 GMCH_send_prebuilt_message (&payload->header, ch, fwd, copy); 742 GCCH_send_prebuilt_message (&payload->header, ch, fwd, copy);
743 GNUNET_STATISTICS_update (stats, "# data retransmitted", 1, GNUNET_NO); 743 GNUNET_STATISTICS_update (stats, "# data retransmitted", 1, GNUNET_NO);
744} 744}
745 745
@@ -798,7 +798,7 @@ ch_message_sent (void *cls,
798 struct CadetChannelReliability *rel; 798 struct CadetChannelReliability *rel;
799 799
800 LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n", 800 LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n",
801 GM_m2s (chq->type)); 801 GC_m2s (chq->type));
802 802
803 switch (chq->type) 803 switch (chq->type)
804 { 804 {
@@ -842,7 +842,7 @@ ch_message_sent (void *cls,
842 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: 842 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
843 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: 843 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
844 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: 844 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
845 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type)); 845 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GC_m2s (chq->type));
846 rel = chq->rel; 846 rel = chq->rel;
847 GNUNET_assert (rel->uniq == chq); 847 GNUNET_assert (rel->uniq == chq);
848 rel->uniq = NULL; 848 rel->uniq = NULL;
@@ -885,7 +885,7 @@ send_create (struct CadetChannel *ch)
885 msgcc.port = htonl (ch->port); 885 msgcc.port = htonl (ch->port);
886 msgcc.opt = htonl (channel_get_options (ch)); 886 msgcc.opt = htonl (channel_get_options (ch));
887 887
888 GMCH_send_prebuilt_message (&msgcc.header, ch, GNUNET_YES, NULL); 888 GCCH_send_prebuilt_message (&msgcc.header, ch, GNUNET_YES, NULL);
889} 889}
890 890
891 891
@@ -904,10 +904,10 @@ send_ack (struct CadetChannel *ch, int fwd, int reaction)
904 msg.header.size = htons (sizeof (msg)); 904 msg.header.size = htons (sizeof (msg));
905 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK); 905 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK);
906 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", 906 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n",
907 GM_f2s (fwd), GMCH_2s (ch)); 907 GC_f2s (fwd), GCCH_2s (ch));
908 908
909 msg.chid = htonl (ch->gid); 909 msg.chid = htonl (ch->gid);
910 GMCH_send_prebuilt_message (&msg.header, ch, !fwd, reaction ? &msg : NULL); 910 GCCH_send_prebuilt_message (&msg.header, ch, !fwd, reaction ? &msg : NULL);
911} 911}
912 912
913 913
@@ -924,7 +924,7 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg,
924 struct CadetChannel *ch, 924 struct CadetChannel *ch,
925 int force) 925 int force)
926{ 926{
927 GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL, 927 GNUNET_break (NULL == GCT_send_prebuilt_message (msg, ch->t, NULL,
928 force, NULL, NULL)); 928 force, NULL, NULL));
929} 929}
930 930
@@ -943,10 +943,10 @@ send_nack (struct CadetChannel *ch)
943 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); 943 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK);
944 LOG (GNUNET_ERROR_TYPE_DEBUG, 944 LOG (GNUNET_ERROR_TYPE_DEBUG,
945 " sending channel NACK for channel %s\n", 945 " sending channel NACK for channel %s\n",
946 GMCH_2s (ch)); 946 GCCH_2s (ch));
947 947
948 msg.chid = htonl (ch->gid); 948 msg.chid = htonl (ch->gid);
949 GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); 949 GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL);
950} 950}
951 951
952 952
@@ -983,7 +983,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel)
983 { 983 {
984 if (NULL != copy->chq->tq) 984 if (NULL != copy->chq->tq)
985 { 985 {
986 GMT_cancel (copy->chq->tq); 986 GCT_cancel (copy->chq->tq);
987 /* ch_message_sent will free copy->q */ 987 /* ch_message_sent will free copy->q */
988 } 988 }
989 else 989 else
@@ -996,7 +996,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel)
996 } 996 }
997 if (NULL != rel->uniq && NULL != rel->uniq->tq) 997 if (NULL != rel->uniq && NULL != rel->uniq->tq)
998 { 998 {
999 GMT_cancel (rel->uniq->tq); 999 GCT_cancel (rel->uniq->tq);
1000 /* ch_message_sent is called freeing uniq */ 1000 /* ch_message_sent is called freeing uniq */
1001 } 1001 }
1002 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 1002 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task)
@@ -1053,7 +1053,7 @@ channel_rel_free_sent (struct CadetChannelReliability *rel,
1053 /* Skip copies with mid < target */ 1053 /* Skip copies with mid < target */
1054 target = mid + i + 1; 1054 target = mid + i + 1;
1055 LOG (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target); 1055 LOG (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target);
1056 while (NULL != copy && GM_is_pid_bigger (target, copy->mid)) 1056 while (NULL != copy && GC_is_pid_bigger (target, copy->mid))
1057 copy = copy->next; 1057 copy = copy->next;
1058 1058
1059 /* Did we run out of copies? (previously freed, it's ok) */ 1059 /* Did we run out of copies? (previously freed, it's ok) */
@@ -1064,7 +1064,7 @@ channel_rel_free_sent (struct CadetChannelReliability *rel,
1064 } 1064 }
1065 1065
1066 /* Did we overshoot the target? (previously freed, it's ok) */ 1066 /* Did we overshoot the target? (previously freed, it's ok) */
1067 if (GM_is_pid_bigger (copy->mid, target)) 1067 if (GC_is_pid_bigger (copy->mid, target))
1068 { 1068 {
1069 LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid); 1069 LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid);
1070 continue; 1070 continue;
@@ -1125,7 +1125,7 @@ rel_message_free (struct CadetReliableMessage *copy, int update_time)
1125 rel->ch->pending_messages--; 1125 rel->ch->pending_messages--;
1126 if (NULL != copy->chq) 1126 if (NULL != copy->chq)
1127 { 1127 {
1128 GMT_cancel (copy->chq->tq); 1128 GCT_cancel (copy->chq->tq);
1129 /* copy->q is set to NULL by ch_message_sent */ 1129 /* copy->q is set to NULL by ch_message_sent */
1130 } 1130 }
1131 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); 1131 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy);
@@ -1134,7 +1134,7 @@ rel_message_free (struct CadetReliableMessage *copy, int update_time)
1134 1134
1135 if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) 1135 if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages)
1136 { 1136 {
1137 GMCH_destroy (rel->ch); 1137 GCCH_destroy (rel->ch);
1138 return GNUNET_YES; 1138 return GNUNET_YES;
1139 } 1139 }
1140 return GNUNET_NO; 1140 return GNUNET_NO;
@@ -1160,7 +1160,7 @@ channel_confirm (struct CadetChannel *ch, int fwd)
1160 return; 1160 return;
1161 } 1161 }
1162 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n", 1162 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n",
1163 GM_f2s (fwd), GMCH_2s (ch)); 1163 GC_f2s (fwd), GCCH_2s (ch));
1164 oldstate = ch->state; 1164 oldstate = ch->state;
1165 ch->state = CADET_CHANNEL_READY; 1165 ch->state = CADET_CHANNEL_READY;
1166 1166
@@ -1170,7 +1170,7 @@ channel_confirm (struct CadetChannel *ch, int fwd)
1170 rel->expected_delay = rel->retry_timer; 1170 rel->expected_delay = rel->retry_timer;
1171 LOG (GNUNET_ERROR_TYPE_DEBUG, " !! retry timer confirm %s\n", 1171 LOG (GNUNET_ERROR_TYPE_DEBUG, " !! retry timer confirm %s\n",
1172 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO)); 1172 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO));
1173 if (GMT_get_connections_buffer (ch->t) > 0 || GMT_is_loopback (ch->t)) 1173 if (GCT_get_connections_buffer (ch->t) > 0 || GCT_is_loopback (ch->t))
1174 send_client_ack (ch, fwd); 1174 send_client_ack (ch, fwd);
1175 1175
1176 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 1176 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task)
@@ -1180,7 +1180,7 @@ channel_confirm (struct CadetChannel *ch, int fwd)
1180 } 1180 }
1181 else if (NULL != rel->uniq) 1181 else if (NULL != rel->uniq)
1182 { 1182 {
1183 GMT_cancel (rel->uniq->tq); 1183 GCT_cancel (rel->uniq->tq);
1184 /* ch_message_sent will free and NULL uniq */ 1184 /* ch_message_sent will free and NULL uniq */
1185 } 1185 }
1186 else 1186 else
@@ -1224,7 +1224,7 @@ channel_save_copy (struct CadetChannel *ch,
1224 type = ntohs (msg->type); 1224 type = ntohs (msg->type);
1225 size = ntohs (msg->size); 1225 size = ntohs (msg->size);
1226 1226
1227 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type)); 1227 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GC_m2s (type));
1228 copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size); 1228 copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size);
1229 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy); 1229 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy);
1230 copy->mid = mid; 1230 copy->mid = mid;
@@ -1263,10 +1263,10 @@ channel_new (struct CadetTunnel3 *t,
1263 1263
1264 if (NULL != owner) 1264 if (NULL != owner)
1265 { 1265 {
1266 ch->gid = GMT_get_next_chid (t); 1266 ch->gid = GCT_get_next_chid (t);
1267 GML_channel_add (owner, lid_root, ch); 1267 GML_channel_add (owner, lid_root, ch);
1268 } 1268 }
1269 GMT_add_channel (t, ch); 1269 GCT_add_channel (t, ch);
1270 1270
1271 return ch; 1271 return ch;
1272} 1272}
@@ -1289,7 +1289,7 @@ handle_loopback (struct CadetChannel *ch,
1289 type = ntohs (msgh->type); 1289 type = ntohs (msgh->type);
1290 LOG (GNUNET_ERROR_TYPE_DEBUG, 1290 LOG (GNUNET_ERROR_TYPE_DEBUG,
1291 "Loopback %s %s message!\n", 1291 "Loopback %s %s message!\n",
1292 GM_f2s (fwd), GM_m2s (type)); 1292 GC_f2s (fwd), GC_m2s (type));
1293 1293
1294 switch (type) 1294 switch (type)
1295 { 1295 {
@@ -1297,30 +1297,30 @@ handle_loopback (struct CadetChannel *ch,
1297 /* Don't send hop ACK, wait for client to ACK */ 1297 /* Don't send hop ACK, wait for client to ACK */
1298 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n", 1298 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n",
1299 ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size)); 1299 ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size));
1300 GMCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); 1300 GCCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd);
1301 break; 1301 break;
1302 1302
1303 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: 1303 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
1304 GMCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); 1304 GCCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd);
1305 break; 1305 break;
1306 1306
1307 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: 1307 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
1308 GMCH_handle_create (ch->t, 1308 GCCH_handle_create (ch->t,
1309 (struct GNUNET_CADET_ChannelCreate *) msgh); 1309 (struct GNUNET_CADET_ChannelCreate *) msgh);
1310 break; 1310 break;
1311 1311
1312 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: 1312 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
1313 GMCH_handle_ack (ch, 1313 GCCH_handle_ack (ch,
1314 (struct GNUNET_CADET_ChannelManage *) msgh, 1314 (struct GNUNET_CADET_ChannelManage *) msgh,
1315 fwd); 1315 fwd);
1316 break; 1316 break;
1317 1317
1318 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: 1318 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
1319 GMCH_handle_nack (ch); 1319 GCCH_handle_nack (ch);
1320 break; 1320 break;
1321 1321
1322 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: 1322 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
1323 GMCH_handle_destroy (ch, 1323 GCCH_handle_destroy (ch,
1324 (struct GNUNET_CADET_ChannelManage *) msgh, 1324 (struct GNUNET_CADET_ChannelManage *) msgh,
1325 fwd); 1325 fwd);
1326 break; 1326 break;
@@ -1345,7 +1345,7 @@ handle_loopback (struct CadetChannel *ch,
1345 * @param ch Channel to destroy. 1345 * @param ch Channel to destroy.
1346 */ 1346 */
1347void 1347void
1348GMCH_destroy (struct CadetChannel *ch) 1348GCCH_destroy (struct CadetChannel *ch)
1349{ 1349{
1350 struct CadetClient *c; 1350 struct CadetClient *c;
1351 struct CadetTunnel3 *t; 1351 struct CadetTunnel3 *t;
@@ -1357,8 +1357,8 @@ GMCH_destroy (struct CadetChannel *ch)
1357 ch->destroy = 2; 1357 ch->destroy = 2;
1358 1358
1359 LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n", 1359 LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n",
1360 GMT_2s (ch->t), ch->gid); 1360 GCT_2s (ch->t), ch->gid);
1361 GMCH_debug (ch); 1361 GCCH_debug (ch);
1362 1362
1363 c = ch->root; 1363 c = ch->root;
1364 if (NULL != c) 1364 if (NULL != c)
@@ -1376,11 +1376,11 @@ GMCH_destroy (struct CadetChannel *ch)
1376 channel_rel_free_all (ch->dest_rel); 1376 channel_rel_free_all (ch->dest_rel);
1377 1377
1378 t = ch->t; 1378 t = ch->t;
1379 GMT_remove_channel (t, ch); 1379 GCT_remove_channel (t, ch);
1380 GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO); 1380 GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO);
1381 1381
1382 GNUNET_free (ch); 1382 GNUNET_free (ch);
1383 GMT_destroy_if_empty (t); 1383 GCT_destroy_if_empty (t);
1384} 1384}
1385 1385
1386 1386
@@ -1392,7 +1392,7 @@ GMCH_destroy (struct CadetChannel *ch)
1392 * @return ID used to identify the channel with the remote peer. 1392 * @return ID used to identify the channel with the remote peer.
1393 */ 1393 */
1394CADET_ChannelNumber 1394CADET_ChannelNumber
1395GMCH_get_id (const struct CadetChannel *ch) 1395GCCH_get_id (const struct CadetChannel *ch)
1396{ 1396{
1397 return ch->gid; 1397 return ch->gid;
1398} 1398}
@@ -1406,7 +1406,7 @@ GMCH_get_id (const struct CadetChannel *ch)
1406 * @return tunnel of the channel. 1406 * @return tunnel of the channel.
1407 */ 1407 */
1408struct CadetTunnel3 * 1408struct CadetTunnel3 *
1409GMCH_get_tunnel (const struct CadetChannel *ch) 1409GCCH_get_tunnel (const struct CadetChannel *ch)
1410{ 1410{
1411 return ch->t; 1411 return ch->t;
1412} 1412}
@@ -1421,7 +1421,7 @@ GMCH_get_tunnel (const struct CadetChannel *ch)
1421 * @return Free buffer space [0 - 64] 1421 * @return Free buffer space [0 - 64]
1422 */ 1422 */
1423unsigned int 1423unsigned int
1424GMCH_get_buffer (struct CadetChannel *ch, int fwd) 1424GCCH_get_buffer (struct CadetChannel *ch, int fwd)
1425{ 1425{
1426 struct CadetChannelReliability *rel; 1426 struct CadetChannelReliability *rel;
1427 1427
@@ -1447,7 +1447,7 @@ GMCH_get_buffer (struct CadetChannel *ch, int fwd)
1447 * @return #GNUNET_YES if client is allowed to send us data. 1447 * @return #GNUNET_YES if client is allowed to send us data.
1448 */ 1448 */
1449int 1449int
1450GMCH_get_allowed (struct CadetChannel *ch, int fwd) 1450GCCH_get_allowed (struct CadetChannel *ch, int fwd)
1451{ 1451{
1452 struct CadetChannelReliability *rel; 1452 struct CadetChannelReliability *rel;
1453 1453
@@ -1473,7 +1473,7 @@ GMCH_get_allowed (struct CadetChannel *ch, int fwd)
1473 * @return #GNUNET_YES in case it is. 1473 * @return #GNUNET_YES in case it is.
1474 */ 1474 */
1475int 1475int
1476GMCH_is_origin (struct CadetChannel *ch, int fwd) 1476GCCH_is_origin (struct CadetChannel *ch, int fwd)
1477{ 1477{
1478 struct CadetClient *c; 1478 struct CadetClient *c;
1479 1479
@@ -1491,7 +1491,7 @@ GMCH_is_origin (struct CadetChannel *ch, int fwd)
1491 * @return #GNUNET_YES in case it is. 1491 * @return #GNUNET_YES in case it is.
1492 */ 1492 */
1493int 1493int
1494GMCH_is_terminal (struct CadetChannel *ch, int fwd) 1494GCCH_is_terminal (struct CadetChannel *ch, int fwd)
1495{ 1495{
1496 struct CadetClient *c; 1496 struct CadetClient *c;
1497 1497
@@ -1509,7 +1509,7 @@ GMCH_is_terminal (struct CadetChannel *ch, int fwd)
1509 * @param fwd Is for FWD traffic? (ACK dest->owner) 1509 * @param fwd Is for FWD traffic? (ACK dest->owner)
1510 */ 1510 */
1511void 1511void
1512GMCH_send_data_ack (struct CadetChannel *ch, int fwd) 1512GCCH_send_data_ack (struct CadetChannel *ch, int fwd)
1513{ 1513{
1514 struct GNUNET_CADET_DataACK msg; 1514 struct GNUNET_CADET_DataACK msg;
1515 struct CadetChannelReliability *rel; 1515 struct CadetChannelReliability *rel;
@@ -1536,7 +1536,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd)
1536 { 1536 {
1537 LOG (GNUNET_ERROR_TYPE_DEBUG, 1537 LOG (GNUNET_ERROR_TYPE_DEBUG,
1538 "!! Type %s, expected DATA\n", 1538 "!! Type %s, expected DATA\n",
1539 GM_m2s (copy->type)); 1539 GC_m2s (copy->type));
1540 continue; 1540 continue;
1541 } 1541 }
1542 if (copy->mid == ack + 1) 1542 if (copy->mid == ack + 1)
@@ -1558,7 +1558,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd)
1558 "!!! ACK for %u, futures %llX\n", 1558 "!!! ACK for %u, futures %llX\n",
1559 ack, msg.futures); 1559 ack, msg.futures);
1560 1560
1561 GMCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); 1561 GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL);
1562 LOG (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n"); 1562 LOG (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n");
1563} 1563}
1564 1564
@@ -1570,7 +1570,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd)
1570 * @param fwd Is this about FWD traffic? (Root client). 1570 * @param fwd Is this about FWD traffic? (Root client).
1571 */ 1571 */
1572void 1572void
1573GMCH_allow_client (struct CadetChannel *ch, int fwd) 1573GCCH_allow_client (struct CadetChannel *ch, int fwd)
1574{ 1574{
1575 struct CadetChannelReliability *rel; 1575 struct CadetChannelReliability *rel;
1576 unsigned int buffer; 1576 unsigned int buffer;
@@ -1609,9 +1609,9 @@ GMCH_allow_client (struct CadetChannel *ch, int fwd)
1609 } 1609 }
1610 1610
1611 if (is_loopback (ch)) 1611 if (is_loopback (ch))
1612 buffer = GMCH_get_buffer (ch, fwd); 1612 buffer = GCCH_get_buffer (ch, fwd);
1613 else 1613 else
1614 buffer = GMT_get_connections_buffer (ch->t); 1614 buffer = GCT_get_connections_buffer (ch->t);
1615 1615
1616 if (0 == buffer) 1616 if (0 == buffer)
1617 { 1617 {
@@ -1630,7 +1630,7 @@ GMCH_allow_client (struct CadetChannel *ch, int fwd)
1630 * @param ch Channel. 1630 * @param ch Channel.
1631 */ 1631 */
1632void 1632void
1633GMCH_debug (struct CadetChannel *ch) 1633GCCH_debug (struct CadetChannel *ch)
1634{ 1634{
1635 if (NULL == ch) 1635 if (NULL == ch)
1636 { 1636 {
@@ -1638,7 +1638,7 @@ GMCH_debug (struct CadetChannel *ch)
1638 return; 1638 return;
1639 } 1639 }
1640 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n", 1640 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n",
1641 GMT_2s (ch->t), ch->gid, ch); 1641 GCT_2s (ch->t), ch->gid, ch);
1642 LOG (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n", 1642 LOG (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n",
1643 ch->root, ch->root_rel); 1643 ch->root, ch->root_rel);
1644 if (NULL != ch->root) 1644 if (NULL != ch->root)
@@ -1669,7 +1669,7 @@ GMCH_debug (struct CadetChannel *ch)
1669 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK) 1669 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK)
1670 */ 1670 */
1671void 1671void
1672GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) 1672GCCH_handle_local_ack (struct CadetChannel *ch, int fwd)
1673{ 1673{
1674 struct CadetChannelReliability *rel; 1674 struct CadetChannelReliability *rel;
1675 struct CadetClient *c; 1675 struct CadetClient *c;
@@ -1683,7 +1683,7 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd)
1683 if (GNUNET_YES == ch->destroy && 0 == rel->n_recv) 1683 if (GNUNET_YES == ch->destroy && 0 == rel->n_recv)
1684 { 1684 {
1685 send_destroy (ch, GNUNET_YES); 1685 send_destroy (ch, GNUNET_YES);
1686 GMCH_destroy (ch); 1686 GCCH_destroy (ch);
1687 } 1687 }
1688 /* if loopback is marked for destruction, no need to ACK to the other peer, 1688 /* if loopback is marked for destruction, no need to ACK to the other peer,
1689 * it requested the destruction and is already gone, therefore, else if. 1689 * it requested the destruction and is already gone, therefore, else if.
@@ -1692,13 +1692,13 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd)
1692 { 1692 {
1693 unsigned int buffer; 1693 unsigned int buffer;
1694 1694
1695 buffer = GMCH_get_buffer (ch, fwd); 1695 buffer = GCCH_get_buffer (ch, fwd);
1696 if (0 < buffer) 1696 if (0 < buffer)
1697 GMCH_allow_client (ch, fwd); 1697 GCCH_allow_client (ch, fwd);
1698 1698
1699 return; 1699 return;
1700 } 1700 }
1701 GMT_send_connection_acks (ch->t); 1701 GCT_send_connection_acks (ch->t);
1702} 1702}
1703 1703
1704 1704
@@ -1717,7 +1717,7 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd)
1717 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. 1717 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error.
1718 */ 1718 */
1719int 1719int
1720GMCH_handle_local_data (struct CadetChannel *ch, 1720GCCH_handle_local_data (struct CadetChannel *ch,
1721 struct CadetClient *c, 1721 struct CadetClient *c,
1722 struct GNUNET_MessageHeader *message, 1722 struct GNUNET_MessageHeader *message,
1723 int fwd) 1723 int fwd)
@@ -1758,19 +1758,19 @@ GMCH_handle_local_data (struct CadetChannel *ch,
1758 payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); 1758 payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA);
1759 payload->chid = htonl (ch->gid); 1759 payload->chid = htonl (ch->gid);
1760 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); 1760 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
1761 GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); 1761 GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL);
1762 1762
1763 if (is_loopback (ch)) 1763 if (is_loopback (ch))
1764 { 1764 {
1765 if (GMCH_get_buffer (ch, fwd) > 0) 1765 if (GCCH_get_buffer (ch, fwd) > 0)
1766 GMCH_allow_client (ch, fwd); 1766 GCCH_allow_client (ch, fwd);
1767 1767
1768 return GNUNET_OK; 1768 return GNUNET_OK;
1769 } 1769 }
1770 1770
1771 if (GMT_get_connections_buffer (ch->t) > 0) 1771 if (GCT_get_connections_buffer (ch->t) > 0)
1772 { 1772 {
1773 GMCH_allow_client (ch, fwd); 1773 GCCH_allow_client (ch, fwd);
1774 } 1774 }
1775 1775
1776 return GNUNET_OK; 1776 return GNUNET_OK;
@@ -1787,7 +1787,7 @@ GMCH_handle_local_data (struct CadetChannel *ch,
1787 * @param is_root Is the request coming from root? 1787 * @param is_root Is the request coming from root?
1788 */ 1788 */
1789void 1789void
1790GMCH_handle_local_destroy (struct CadetChannel *ch, 1790GCCH_handle_local_destroy (struct CadetChannel *ch,
1791 struct CadetClient *c, 1791 struct CadetClient *c,
1792 int is_root) 1792 int is_root)
1793{ 1793{
@@ -1808,7 +1808,7 @@ GMCH_handle_local_destroy (struct CadetChannel *ch,
1808 1808
1809 send_destroy (ch, GNUNET_NO); 1809 send_destroy (ch, GNUNET_NO);
1810 if (0 == ch->pending_messages) 1810 if (0 == ch->pending_messages)
1811 GMCH_destroy (ch); 1811 GCCH_destroy (ch);
1812} 1812}
1813 1813
1814 1814
@@ -1823,7 +1823,7 @@ GMCH_handle_local_destroy (struct CadetChannel *ch,
1823 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. 1823 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
1824 */ 1824 */
1825int 1825int
1826GMCH_handle_local_create (struct CadetClient *c, 1826GCCH_handle_local_create (struct CadetClient *c,
1827 struct GNUNET_CADET_ChannelMessage *msg) 1827 struct GNUNET_CADET_ChannelMessage *msg)
1828{ 1828{
1829 struct CadetChannel *ch; 1829 struct CadetChannel *ch;
@@ -1842,18 +1842,18 @@ GMCH_handle_local_create (struct CadetClient *c,
1842 return GNUNET_SYSERR; 1842 return GNUNET_SYSERR;
1843 } 1843 }
1844 1844
1845 peer = GMP_get (&msg->peer); 1845 peer = GCP_get (&msg->peer);
1846 GMP_add_tunnel (peer); 1846 GCP_add_tunnel (peer);
1847 t = GMP_get_tunnel (peer); 1847 t = GCP_get_tunnel (peer);
1848 1848
1849 if (GMP_get_short_id (peer) == myid) 1849 if (GCP_get_short_id (peer) == myid)
1850 { 1850 {
1851 GMT_change_cstate (t, CADET_TUNNEL3_READY); 1851 GCT_change_cstate (t, CADET_TUNNEL3_READY);
1852 } 1852 }
1853 else 1853 else
1854 { 1854 {
1855 /* FIXME change to a tunnel API, eliminate ch <-> peer connection */ 1855 /* FIXME change to a tunnel API, eliminate ch <-> peer connection */
1856 GMP_connect (peer); 1856 GCP_connect (peer);
1857 } 1857 }
1858 1858
1859 /* Create channel */ 1859 /* Create channel */
@@ -1872,7 +1872,7 @@ GMCH_handle_local_create (struct CadetClient *c,
1872 ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME; 1872 ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME;
1873 ch->root_rel->expected_delay.rel_value_us = 0; 1873 ch->root_rel->expected_delay.rel_value_us = 0;
1874 1874
1875 LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch)); 1875 LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GCCH_2s (ch));
1876 1876
1877 send_create (ch); 1877 send_create (ch);
1878 1878
@@ -1891,7 +1891,7 @@ GMCH_handle_local_create (struct CadetClient *c,
1891 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1891 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1892 */ 1892 */
1893void 1893void
1894GMCH_handle_data (struct CadetChannel *ch, 1894GCCH_handle_data (struct CadetChannel *ch,
1895 const struct GNUNET_CADET_Data *msg, 1895 const struct GNUNET_CADET_Data *msg,
1896 int fwd) 1896 int fwd)
1897{ 1897{
@@ -1942,11 +1942,11 @@ GMCH_handle_data (struct CadetChannel *ch,
1942 1942
1943 mid = ntohl (msg->mid); 1943 mid = ntohl (msg->mid);
1944 LOG (GNUNET_ERROR_TYPE_INFO, "<=== DATA %u %s on channel %s\n", 1944 LOG (GNUNET_ERROR_TYPE_INFO, "<=== DATA %u %s on channel %s\n",
1945 mid, GM_f2s (fwd), GMCH_2s (ch)); 1945 mid, GC_f2s (fwd), GCCH_2s (ch));
1946 1946
1947 if (GNUNET_NO == ch->reliable || 1947 if (GNUNET_NO == ch->reliable ||
1948 ( !GM_is_pid_bigger (rel->mid_recv, mid) && 1948 ( !GC_is_pid_bigger (rel->mid_recv, mid) &&
1949 GM_is_pid_bigger (rel->mid_recv + 64, mid) ) ) 1949 GC_is_pid_bigger (rel->mid_recv + 64, mid) ) )
1950 { 1950 {
1951 LOG (GNUNET_ERROR_TYPE_DEBUG, "RECV %u (%u)\n", 1951 LOG (GNUNET_ERROR_TYPE_DEBUG, "RECV %u (%u)\n",
1952 mid, ntohs (msg->header.size)); 1952 mid, ntohs (msg->header.size));
@@ -1975,13 +1975,13 @@ GMCH_handle_data (struct CadetChannel *ch,
1975 } 1975 }
1976 else 1976 else
1977 { 1977 {
1978 GNUNET_break_op (GM_is_pid_bigger (rel->mid_recv, mid)); 1978 GNUNET_break_op (GC_is_pid_bigger (rel->mid_recv, mid));
1979 LOG (GNUNET_ERROR_TYPE_WARNING, 1979 LOG (GNUNET_ERROR_TYPE_WARNING,
1980 "MID %u not expected (%u - %u), dropping!\n", 1980 "MID %u not expected (%u - %u), dropping!\n",
1981 mid, rel->mid_recv, rel->mid_recv + 63); 1981 mid, rel->mid_recv, rel->mid_recv + 63);
1982 } 1982 }
1983 1983
1984 GMCH_send_data_ack (ch, fwd); 1984 GCCH_send_data_ack (ch, fwd);
1985} 1985}
1986 1986
1987 1987
@@ -1996,7 +1996,7 @@ GMCH_handle_data (struct CadetChannel *ch,
1996 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1996 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1997 */ 1997 */
1998void 1998void
1999GMCH_handle_data_ack (struct CadetChannel *ch, 1999GCCH_handle_data_ack (struct CadetChannel *ch,
2000 const struct GNUNET_CADET_DataACK *msg, 2000 const struct GNUNET_CADET_DataACK *msg,
2001 int fwd) 2001 int fwd)
2002{ 2002{
@@ -2020,7 +2020,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch,
2020 } 2020 }
2021 2021
2022 ack = ntohl (msg->mid); 2022 ack = ntohl (msg->mid);
2023 LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u\n", GM_f2s (fwd), ack); 2023 LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u\n", GC_f2s (fwd), ack);
2024 2024
2025 if (GNUNET_YES == fwd) 2025 if (GNUNET_YES == fwd)
2026 { 2026 {
@@ -2039,7 +2039,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch,
2039 /* Free ACK'd copies: no need to retransmit those anymore FIXME refactor */ 2039 /* Free ACK'd copies: no need to retransmit those anymore FIXME refactor */
2040 for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next) 2040 for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next)
2041 { 2041 {
2042 if (GM_is_pid_bigger (copy->mid, ack)) 2042 if (GC_is_pid_bigger (copy->mid, ack))
2043 { 2043 {
2044 LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid); 2044 LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid);
2045 channel_rel_free_sent (rel, msg); 2045 channel_rel_free_sent (rel, msg);
@@ -2053,7 +2053,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch,
2053 } 2053 }
2054 2054
2055 /* ACK client if needed and possible */ 2055 /* ACK client if needed and possible */
2056 GMCH_allow_client (ch, fwd); 2056 GCCH_allow_client (ch, fwd);
2057 2057
2058 /* If some message was free'd, update the retransmission delay */ 2058 /* If some message was free'd, update the retransmission delay */
2059 if (GNUNET_YES == work) 2059 if (GNUNET_YES == work)
@@ -2096,7 +2096,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch,
2096 * @param msg Channel crate message. 2096 * @param msg Channel crate message.
2097 */ 2097 */
2098struct CadetChannel * 2098struct CadetChannel *
2099GMCH_handle_create (struct CadetTunnel3 *t, 2099GCCH_handle_create (struct CadetTunnel3 *t,
2100 const struct GNUNET_CADET_ChannelCreate *msg) 2100 const struct GNUNET_CADET_ChannelCreate *msg)
2101{ 2101{
2102 CADET_ChannelNumber chid; 2102 CADET_ChannelNumber chid;
@@ -2107,7 +2107,7 @@ GMCH_handle_create (struct CadetTunnel3 *t,
2107 2107
2108 reaction = GNUNET_NO; 2108 reaction = GNUNET_NO;
2109 chid = ntohl (msg->chid); 2109 chid = ntohl (msg->chid);
2110 ch = GMT_get_channel (t, chid); 2110 ch = GCT_get_channel (t, chid);
2111 if (NULL == ch) 2111 if (NULL == ch)
2112 { 2112 {
2113 /* Create channel */ 2113 /* Create channel */
@@ -2121,7 +2121,7 @@ GMCH_handle_create (struct CadetTunnel3 *t,
2121 new_channel = GNUNET_NO; 2121 new_channel = GNUNET_NO;
2122 } 2122 }
2123 2123
2124 if (GNUNET_YES == new_channel || GMT_is_loopback (t)) 2124 if (GNUNET_YES == new_channel || GCT_is_loopback (t))
2125 { 2125 {
2126 /* Find a destination client */ 2126 /* Find a destination client */
2127 ch->port = ntohl (msg->port); 2127 ch->port = ntohl (msg->port);
@@ -2139,7 +2139,7 @@ GMCH_handle_create (struct CadetTunnel3 *t,
2139 { 2139 {
2140 LOG (GNUNET_ERROR_TYPE_DEBUG, " not loopback: destroy now\n"); 2140 LOG (GNUNET_ERROR_TYPE_DEBUG, " not loopback: destroy now\n");
2141 send_nack (ch); 2141 send_nack (ch);
2142 GMCH_destroy (ch); 2142 GCCH_destroy (ch);
2143 } 2143 }
2144 return NULL; 2144 return NULL;
2145 } 2145 }
@@ -2183,10 +2183,10 @@ GMCH_handle_create (struct CadetTunnel3 *t,
2183 * @param ch Channel. 2183 * @param ch Channel.
2184 */ 2184 */
2185void 2185void
2186GMCH_handle_nack (struct CadetChannel *ch) 2186GCCH_handle_nack (struct CadetChannel *ch)
2187{ 2187{
2188 send_client_nack (ch); 2188 send_client_nack (ch);
2189 GMCH_destroy (ch); 2189 GCCH_destroy (ch);
2190} 2190}
2191 2191
2192 2192
@@ -2201,7 +2201,7 @@ GMCH_handle_nack (struct CadetChannel *ch)
2201 * #GNUNET_SYSERR if message on a one-ended channel (remote) 2201 * #GNUNET_SYSERR if message on a one-ended channel (remote)
2202 */ 2202 */
2203void 2203void
2204GMCH_handle_ack (struct CadetChannel *ch, 2204GCCH_handle_ack (struct CadetChannel *ch,
2205 const struct GNUNET_CADET_ChannelManage *msg, 2205 const struct GNUNET_CADET_ChannelManage *msg,
2206 int fwd) 2206 int fwd)
2207{ 2207{
@@ -2232,7 +2232,7 @@ GMCH_handle_ack (struct CadetChannel *ch,
2232 * #GNUNET_SYSERR if message on a one-ended channel (remote) 2232 * #GNUNET_SYSERR if message on a one-ended channel (remote)
2233 */ 2233 */
2234void 2234void
2235GMCH_handle_destroy (struct CadetChannel *ch, 2235GCCH_handle_destroy (struct CadetChannel *ch,
2236 const struct GNUNET_CADET_ChannelManage *msg, 2236 const struct GNUNET_CADET_ChannelManage *msg,
2237 int fwd) 2237 int fwd)
2238{ 2238{
@@ -2250,7 +2250,7 @@ GMCH_handle_destroy (struct CadetChannel *ch,
2250 fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; 2250 fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO;
2251 } 2251 }
2252 2252
2253 GMCH_debug (ch); 2253 GCCH_debug (ch);
2254 if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) 2254 if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) )
2255 { 2255 {
2256 /* Not for us (don't destroy twice a half-open loopback channel) */ 2256 /* Not for us (don't destroy twice a half-open loopback channel) */
@@ -2261,7 +2261,7 @@ GMCH_handle_destroy (struct CadetChannel *ch,
2261 if (0 == rel->n_recv) 2261 if (0 == rel->n_recv)
2262 { 2262 {
2263 send_destroy (ch, GNUNET_YES); 2263 send_destroy (ch, GNUNET_YES);
2264 GMCH_destroy (ch); 2264 GCCH_destroy (ch);
2265 } 2265 }
2266 else 2266 else
2267 { 2267 {
@@ -2287,7 +2287,7 @@ GMCH_handle_destroy (struct CadetChannel *ch,
2287 * @param existing_copy This is a retransmission, don't save a copy. 2287 * @param existing_copy This is a retransmission, don't save a copy.
2288 */ 2288 */
2289void 2289void
2290GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 2290GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2291 struct CadetChannel *ch, int fwd, 2291 struct CadetChannel *ch, int fwd,
2292 void *existing_copy) 2292 void *existing_copy)
2293{ 2293{
@@ -2296,9 +2296,9 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2296 2296
2297 type = ntohs (message->type); 2297 type = ntohs (message->type);
2298 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %s on channel %s\n", 2298 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %s on channel %s\n",
2299 GM_m2s (type), GM_f2s (fwd), GMCH_2s (ch)); 2299 GC_m2s (type), GC_f2s (fwd), GCCH_2s (ch));
2300 2300
2301 if (GMT_is_loopback (ch->t)) 2301 if (GCT_is_loopback (ch->t))
2302 { 2302 {
2303 handle_loopback (ch, message, fwd); 2303 handle_loopback (ch, message, fwd);
2304 return; 2304 return;
@@ -2311,7 +2311,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2311 2311
2312 payload = (struct GNUNET_CADET_Data *) message; 2312 payload = (struct GNUNET_CADET_Data *) message;
2313 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n", 2313 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n",
2314 GM_m2s (type), ntohl (payload->mid)); 2314 GC_m2s (type), ntohl (payload->mid));
2315 if (GNUNET_YES == ch->reliable) 2315 if (GNUNET_YES == ch->reliable)
2316 { 2316 {
2317 chq = GNUNET_new (struct CadetChannelQueue); 2317 chq = GNUNET_new (struct CadetChannelQueue);
@@ -2344,7 +2344,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2344 } 2344 }
2345 LOG (GNUNET_ERROR_TYPE_DEBUG, " new chq: %p\n", chq); 2345 LOG (GNUNET_ERROR_TYPE_DEBUG, " new chq: %p\n", chq);
2346 chq->copy->chq = chq; 2346 chq->copy->chq = chq;
2347 chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL, 2347 chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL,
2348 NULL != existing_copy, 2348 NULL != existing_copy,
2349 &ch_message_sent, chq); 2349 &ch_message_sent, chq);
2350 /* q itself is stored in copy */ 2350 /* q itself is stored in copy */
@@ -2374,7 +2374,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2374 { 2374 {
2375 if (NULL != chq->rel->uniq->tq) 2375 if (NULL != chq->rel->uniq->tq)
2376 { 2376 {
2377 GMT_cancel (chq->rel->uniq->tq); 2377 GCT_cancel (chq->rel->uniq->tq);
2378 /* ch_message_sent is called, freeing and NULLing uniq */ 2378 /* ch_message_sent is called, freeing and NULLing uniq */
2379 } 2379 }
2380 else 2380 else
@@ -2383,7 +2383,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2383 GNUNET_free (chq->rel->uniq); 2383 GNUNET_free (chq->rel->uniq);
2384 } 2384 }
2385 } 2385 }
2386 chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES, 2386 chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES,
2387 &ch_message_sent, chq); 2387 &ch_message_sent, chq);
2388 if (NULL == chq->tq) 2388 if (NULL == chq->tq)
2389 { 2389 {
@@ -2404,7 +2404,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2404 2404
2405 default: 2405 default:
2406 GNUNET_break (0); 2406 GNUNET_break (0);
2407 LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s unknown!\n", GM_m2s (type)); 2407 LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s unknown!\n", GC_m2s (type));
2408 fire_and_forget (message, ch, GNUNET_YES); 2408 fire_and_forget (message, ch, GNUNET_YES);
2409 } 2409 }
2410} 2410}
@@ -2418,7 +2418,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2418 * @return Static string with the channel IDs. 2418 * @return Static string with the channel IDs.
2419 */ 2419 */
2420const char * 2420const char *
2421GMCH_2s (const struct CadetChannel *ch) 2421GCCH_2s (const struct CadetChannel *ch)
2422{ 2422{
2423 static char buf[64]; 2423 static char buf[64];
2424 2424
@@ -2426,7 +2426,7 @@ GMCH_2s (const struct CadetChannel *ch)
2426 return "(NULL Channel)"; 2426 return "(NULL Channel)";
2427 2427
2428 sprintf (buf, "%s:%u gid:%X (%X / %X)", 2428 sprintf (buf, "%s:%u gid:%X (%X / %X)",
2429 GMT_2s (ch->t), ch->port, ch->gid, ch->lid_root, ch->lid_dest); 2429 GCT_2s (ch->t), ch->port, ch->gid, ch->lid_root, ch->lid_dest);
2430 2430
2431 return buf; 2431 return buf;
2432} 2432}