diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-21 17:51:51 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-21 17:51:51 +0100 |
commit | 308518cb6fbc4b635fccd87a770f66cc2e2816f3 (patch) | |
tree | 298ce9cf97c35e1447d119c270ceaa13d394275d /src/cadet/gnunet-service-cadet_channel.c | |
parent | 745cf54e655a9fb40a4ba3643de09a3471ca6ef6 (diff) | |
download | gnunet-308518cb6fbc4b635fccd87a770f66cc2e2816f3.tar.gz gnunet-308518cb6fbc4b635fccd87a770f66cc2e2816f3.zip |
some renaming, some code general code cleanup, some logging
Diffstat (limited to 'src/cadet/gnunet-service-cadet_channel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 1de6ea865..7b7c6e57c 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -451,7 +451,7 @@ add_destination (struct CadetChannel *ch, struct CadetClient *c) | |||
451 | } | 451 | } |
452 | 452 | ||
453 | /* Assign local id as destination */ | 453 | /* Assign local id as destination */ |
454 | ch->lid_dest = GML_get_next_chid (c); | 454 | ch->lid_dest = GML_get_next_ccn (c); |
455 | 455 | ||
456 | /* Store in client's hashmap */ | 456 | /* Store in client's hashmap */ |
457 | GML_channel_add (c, ch->lid_dest, ch); | 457 | GML_channel_add (c, ch->lid_dest, ch); |
@@ -517,7 +517,7 @@ send_destroy (struct CadetChannel *ch, int local_only) | |||
517 | 517 | ||
518 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); | 518 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
519 | msg.header.size = htons (sizeof (msg)); | 519 | msg.header.size = htons (sizeof (msg)); |
520 | msg.chid = ch->gid; | 520 | msg.ctn = ch->gid; |
521 | 521 | ||
522 | /* If root is not NULL, notify. | 522 | /* If root is not NULL, notify. |
523 | * If it's NULL, check lid_root. When a local destroy comes in, root | 523 | * If it's NULL, check lid_root. When a local destroy comes in, root |
@@ -886,7 +886,7 @@ send_create (struct CadetChannel *ch) | |||
886 | 886 | ||
887 | msgcc.header.size = htons (sizeof (msgcc)); | 887 | msgcc.header.size = htons (sizeof (msgcc)); |
888 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); | 888 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
889 | msgcc.chid = ch->gid; | 889 | msgcc.ctn = ch->gid; |
890 | msgcc.port = ch->port; | 890 | msgcc.port = ch->port; |
891 | msgcc.opt = htonl (channel_get_options (ch)); | 891 | msgcc.opt = htonl (channel_get_options (ch)); |
892 | 892 | ||
@@ -911,7 +911,7 @@ send_ack (struct CadetChannel *ch, int fwd) | |||
911 | " sending channel %s ack for channel %s\n", | 911 | " sending channel %s ack for channel %s\n", |
912 | GC_f2s (fwd), GCCH_2s (ch)); | 912 | GC_f2s (fwd), GCCH_2s (ch)); |
913 | 913 | ||
914 | msg.chid =ch->gid; | 914 | msg.ctn =ch->gid; |
915 | GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); | 915 | GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); |
916 | } | 916 | } |
917 | 917 | ||
@@ -951,7 +951,7 @@ send_nack (struct CadetChannel *ch) | |||
951 | " sending channel NACK for channel %s\n", | 951 | " sending channel NACK for channel %s\n", |
952 | GCCH_2s (ch)); | 952 | GCCH_2s (ch)); |
953 | 953 | ||
954 | msg.chid = ch->gid; | 954 | msg.ctn = ch->gid; |
955 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); | 955 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); |
956 | } | 956 | } |
957 | 957 | ||
@@ -1270,7 +1270,7 @@ channel_new (struct CadetTunnel *t, | |||
1270 | 1270 | ||
1271 | if (NULL != owner) | 1271 | if (NULL != owner) |
1272 | { | 1272 | { |
1273 | ch->gid = GCT_get_next_chid (t); | 1273 | ch->gid = GCT_get_next_ctn (t); |
1274 | GML_channel_add (owner, lid_root, ch); | 1274 | GML_channel_add (owner, lid_root, ch); |
1275 | } | 1275 | } |
1276 | GCT_add_channel (t, ch); | 1276 | GCT_add_channel (t, ch); |
@@ -1539,7 +1539,7 @@ GCCH_send_data_ack (struct CadetChannel *ch, int fwd) | |||
1539 | 1539 | ||
1540 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); | 1540 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); |
1541 | msg.header.size = htons (sizeof (msg)); | 1541 | msg.header.size = htons (sizeof (msg)); |
1542 | msg.chid = ch->gid; | 1542 | msg.ctn = ch->gid; |
1543 | msg.mid = htonl (ack); | 1543 | msg.mid = htonl (ack); |
1544 | 1544 | ||
1545 | msg.futures = 0LL; | 1545 | msg.futures = 0LL; |
@@ -1782,7 +1782,7 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1782 | GNUNET_memcpy (&payload[1], message, size); | 1782 | GNUNET_memcpy (&payload[1], message, size); |
1783 | payload->header.size = htons (p2p_size); | 1783 | payload->header.size = htons (p2p_size); |
1784 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); | 1784 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); |
1785 | payload->chid = ch->gid; | 1785 | payload->ctn = ch->gid; |
1786 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); | 1786 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); |
1787 | GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); | 1787 | GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); |
1788 | 1788 | ||
@@ -1852,14 +1852,14 @@ GCCH_handle_local_create (struct CadetClient *c, | |||
1852 | struct CadetChannel *ch; | 1852 | struct CadetChannel *ch; |
1853 | struct CadetTunnel *t; | 1853 | struct CadetTunnel *t; |
1854 | struct CadetPeer *peer; | 1854 | struct CadetPeer *peer; |
1855 | struct GNUNET_CADET_ClientChannelNumber chid; | 1855 | struct GNUNET_CADET_ClientChannelNumber ccn; |
1856 | 1856 | ||
1857 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", | 1857 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", |
1858 | GNUNET_i2s (&msg->peer), GNUNET_h2s (&msg->port)); | 1858 | GNUNET_i2s (&msg->peer), GNUNET_h2s (&msg->port)); |
1859 | chid = msg->channel_id; | 1859 | ccn = msg->ccn; |
1860 | 1860 | ||
1861 | /* Sanity check for duplicate channel IDs */ | 1861 | /* Sanity check for duplicate channel IDs */ |
1862 | if (NULL != GML_channel_get (c, chid)) | 1862 | if (NULL != GML_channel_get (c, ccn)) |
1863 | { | 1863 | { |
1864 | GNUNET_break (0); | 1864 | GNUNET_break (0); |
1865 | return GNUNET_SYSERR; | 1865 | return GNUNET_SYSERR; |
@@ -1880,7 +1880,7 @@ GCCH_handle_local_create (struct CadetClient *c, | |||
1880 | } | 1880 | } |
1881 | 1881 | ||
1882 | /* Create channel */ | 1882 | /* Create channel */ |
1883 | ch = channel_new (t, c, chid); | 1883 | ch = channel_new (t, c, ccn); |
1884 | if (NULL == ch) | 1884 | if (NULL == ch) |
1885 | { | 1885 | { |
1886 | GNUNET_break (0); | 1886 | GNUNET_break (0); |
@@ -2154,20 +2154,20 @@ struct CadetChannel * | |||
2154 | GCCH_handle_create (struct CadetTunnel *t, | 2154 | GCCH_handle_create (struct CadetTunnel *t, |
2155 | const struct GNUNET_CADET_ChannelOpenMessage *msg) | 2155 | const struct GNUNET_CADET_ChannelOpenMessage *msg) |
2156 | { | 2156 | { |
2157 | struct GNUNET_CADET_ClientChannelNumber chid; | 2157 | struct GNUNET_CADET_ClientChannelNumber ccn; |
2158 | struct GNUNET_CADET_ChannelTunnelNumber gid; | 2158 | struct GNUNET_CADET_ChannelTunnelNumber gid; |
2159 | struct CadetChannel *ch; | 2159 | struct CadetChannel *ch; |
2160 | struct CadetClient *c; | 2160 | struct CadetClient *c; |
2161 | int new_channel; | 2161 | int new_channel; |
2162 | const struct GNUNET_HashCode *port; | 2162 | const struct GNUNET_HashCode *port; |
2163 | 2163 | ||
2164 | gid = msg->chid; | 2164 | gid = msg->ctn; |
2165 | ch = GCT_get_channel (t, gid); | 2165 | ch = GCT_get_channel (t, gid); |
2166 | if (NULL == ch) | 2166 | if (NULL == ch) |
2167 | { | 2167 | { |
2168 | /* Create channel */ | 2168 | /* Create channel */ |
2169 | chid.channel_of_client = htonl (0); | 2169 | ccn.channel_of_client = htonl (0); |
2170 | ch = channel_new (t, NULL, chid); | 2170 | ch = channel_new (t, NULL, ccn); |
2171 | ch->gid = gid; | 2171 | ch->gid = gid; |
2172 | channel_set_options (ch, ntohl (msg->opt)); | 2172 | channel_set_options (ch, ntohl (msg->opt)); |
2173 | new_channel = GNUNET_YES; | 2173 | new_channel = GNUNET_YES; |
@@ -2180,7 +2180,7 @@ GCCH_handle_create (struct CadetTunnel *t, | |||
2180 | 2180 | ||
2181 | LOG (GNUNET_ERROR_TYPE_INFO, | 2181 | LOG (GNUNET_ERROR_TYPE_INFO, |
2182 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", | 2182 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", |
2183 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN), chid, port, | 2183 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN), ccn, port, |
2184 | GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size)); | 2184 | GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size)); |
2185 | 2185 | ||
2186 | if (GNUNET_YES == new_channel || GCT_is_loopback (t)) | 2186 | if (GNUNET_YES == new_channel || GCT_is_loopback (t)) |
@@ -2411,7 +2411,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2411 | { | 2411 | { |
2412 | struct GNUNET_CADET_ChannelOpenMessage *cc_msg; | 2412 | struct GNUNET_CADET_ChannelOpenMessage *cc_msg; |
2413 | cc_msg = (struct GNUNET_CADET_ChannelOpenMessage *) message; | 2413 | cc_msg = (struct GNUNET_CADET_ChannelOpenMessage *) message; |
2414 | SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid.cn)); | 2414 | SPRINTF (info, " 0x%08X", ntohl (cc_msg->ctn.cn)); |
2415 | break; | 2415 | break; |
2416 | } | 2416 | } |
2417 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: | 2417 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
@@ -2420,7 +2420,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2420 | { | 2420 | { |
2421 | struct GNUNET_CADET_ChannelManageMessage *m_msg; | 2421 | struct GNUNET_CADET_ChannelManageMessage *m_msg; |
2422 | m_msg = (struct GNUNET_CADET_ChannelManageMessage *) message; | 2422 | m_msg = (struct GNUNET_CADET_ChannelManageMessage *) message; |
2423 | SPRINTF (info, " 0x%08X", ntohl (m_msg->chid.cn)); | 2423 | SPRINTF (info, " 0x%08X", ntohl (m_msg->ctn.cn)); |
2424 | break; | 2424 | break; |
2425 | } | 2425 | } |
2426 | default: | 2426 | default: |