diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-11-07 11:18:11 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-11-07 11:18:11 +0000 |
commit | 6aa2127441cd5605b5823753f1ee735aaa0a3f52 (patch) | |
tree | 698803c08d80b0a1f72a48743ccf758a80225d48 /src | |
parent | 50fc263f0dec5918c7aa16972760991f2271a15c (diff) | |
download | gnunet-6aa2127441cd5605b5823753f1ee735aaa0a3f52.tar.gz gnunet-6aa2127441cd5605b5823753f1ee735aaa0a3f52.zip |
- internal api change: add channel direction autodetection in non-loopback channels
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 84 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.h | 28 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 2 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 65 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.h | 4 |
5 files changed, 148 insertions, 35 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 1617f9fa4..0c672a091 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -923,8 +923,7 @@ handle_loopback (struct MeshChannel *ch, | |||
923 | 923 | ||
924 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 924 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: |
925 | GMCH_handle_create (ch->t, | 925 | GMCH_handle_create (ch->t, |
926 | (struct GNUNET_MESH_ChannelCreate *) msgh, | 926 | (struct GNUNET_MESH_ChannelCreate *) msgh); |
927 | fwd); | ||
928 | break; | 927 | break; |
929 | 928 | ||
930 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: | 929 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: |
@@ -1444,12 +1443,16 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
1444 | return GNUNET_OK; | 1443 | return GNUNET_OK; |
1445 | } | 1444 | } |
1446 | 1445 | ||
1446 | |||
1447 | /** | 1447 | /** |
1448 | * Handler for mesh network payload traffic. | 1448 | * Handler for mesh network payload traffic. |
1449 | * | 1449 | * |
1450 | * @param ch Channel for the message. | 1450 | * @param ch Channel for the message. |
1451 | * @param msg Unencryted data message. | 1451 | * @param msg Unencryted data message. |
1452 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 1452 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
1453 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
1454 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
1455 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
1453 | */ | 1456 | */ |
1454 | void | 1457 | void |
1455 | GMCH_handle_data (struct MeshChannel *ch, | 1458 | GMCH_handle_data (struct MeshChannel *ch, |
@@ -1460,6 +1463,18 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
1460 | struct MeshClient *c; | 1463 | struct MeshClient *c; |
1461 | uint32_t mid; | 1464 | uint32_t mid; |
1462 | 1465 | ||
1466 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | ||
1467 | if (GNUNET_SYSERR == fwd) | ||
1468 | { | ||
1469 | if (NULL != ch->dest && NULL != ch->root) | ||
1470 | { | ||
1471 | /* It is a loopback channel after all... */ | ||
1472 | GNUNET_break (0); | ||
1473 | return; | ||
1474 | } | ||
1475 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; | ||
1476 | } | ||
1477 | |||
1463 | /* Initialize FWD/BCK data */ | 1478 | /* Initialize FWD/BCK data */ |
1464 | c = fwd ? ch->dest : ch->root; | 1479 | c = fwd ? ch->dest : ch->root; |
1465 | rel = fwd ? ch->dest_rel : ch->root_rel; | 1480 | rel = fwd ? ch->dest_rel : ch->root_rel; |
@@ -1520,7 +1535,10 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
1520 | * | 1535 | * |
1521 | * @param ch Channel on which we got this message. | 1536 | * @param ch Channel on which we got this message. |
1522 | * @param msg Data message. | 1537 | * @param msg Data message. |
1523 | * @param fwd Is this a fwd ACK? (dest->orig) | 1538 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
1539 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
1540 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
1541 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
1524 | */ | 1542 | */ |
1525 | void | 1543 | void |
1526 | GMCH_handle_data_ack (struct MeshChannel *ch, | 1544 | GMCH_handle_data_ack (struct MeshChannel *ch, |
@@ -1533,9 +1551,21 @@ GMCH_handle_data_ack (struct MeshChannel *ch, | |||
1533 | uint32_t ack; | 1551 | uint32_t ack; |
1534 | int work; | 1552 | int work; |
1535 | 1553 | ||
1554 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | ||
1555 | if (GNUNET_SYSERR == fwd) | ||
1556 | { | ||
1557 | if (NULL != ch->dest && NULL != ch->root) | ||
1558 | { | ||
1559 | /* It is a loopback channel after all... */ | ||
1560 | GNUNET_break (0); | ||
1561 | return; | ||
1562 | } | ||
1563 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; | ||
1564 | } | ||
1565 | |||
1536 | ack = ntohl (msg->mid); | 1566 | ack = ntohl (msg->mid); |
1537 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n", | 1567 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n", |
1538 | (GNUNET_YES == fwd) ? "FWD" : "BCK", ack); | 1568 | (GNUNET_YES == fwd) ? "FWD" : "BCK", ack); |
1539 | 1569 | ||
1540 | if (GNUNET_YES == fwd) | 1570 | if (GNUNET_YES == fwd) |
1541 | { | 1571 | { |
@@ -1602,14 +1632,14 @@ GMCH_handle_data_ack (struct MeshChannel *ch, | |||
1602 | /** | 1632 | /** |
1603 | * Handler for channel create messages. | 1633 | * Handler for channel create messages. |
1604 | * | 1634 | * |
1635 | * Does not have fwd parameter because it's always 'FWD': channel is incoming. | ||
1636 | * | ||
1605 | * @param t Tunnel this channel will be in. | 1637 | * @param t Tunnel this channel will be in. |
1606 | * @param msg Message. | 1638 | * @param msg Channel crate message. |
1607 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | ||
1608 | */ | 1639 | */ |
1609 | struct MeshChannel * | 1640 | struct MeshChannel * |
1610 | GMCH_handle_create (struct MeshTunnel3 *t, | 1641 | GMCH_handle_create (struct MeshTunnel3 *t, |
1611 | const struct GNUNET_MESH_ChannelCreate *msg, | 1642 | const struct GNUNET_MESH_ChannelCreate *msg) |
1612 | int fwd) | ||
1613 | { | 1643 | { |
1614 | MESH_ChannelNumber chid; | 1644 | MESH_ChannelNumber chid; |
1615 | struct MeshChannel *ch; | 1645 | struct MeshChannel *ch; |
@@ -1650,7 +1680,7 @@ GMCH_handle_create (struct MeshTunnel3 *t, | |||
1650 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n"); | 1680 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n"); |
1651 | 1681 | ||
1652 | GMCH_send_create (ch); | 1682 | GMCH_send_create (ch); |
1653 | channel_send_ack (ch, fwd); | 1683 | channel_send_ack (ch, GNUNET_YES); |
1654 | 1684 | ||
1655 | return ch; | 1685 | return ch; |
1656 | } | 1686 | } |
@@ -1661,13 +1691,28 @@ GMCH_handle_create (struct MeshTunnel3 *t, | |||
1661 | * | 1691 | * |
1662 | * @param ch Channel. | 1692 | * @param ch Channel. |
1663 | * @param msg Message. | 1693 | * @param msg Message. |
1664 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 1694 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
1695 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
1696 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
1697 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
1665 | */ | 1698 | */ |
1666 | void | 1699 | void |
1667 | GMCH_handle_ack (struct MeshChannel *ch, | 1700 | GMCH_handle_ack (struct MeshChannel *ch, |
1668 | const struct GNUNET_MESH_ChannelManage *msg, | 1701 | const struct GNUNET_MESH_ChannelManage *msg, |
1669 | int fwd) | 1702 | int fwd) |
1670 | { | 1703 | { |
1704 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | ||
1705 | if (GNUNET_SYSERR == fwd) | ||
1706 | { | ||
1707 | if (NULL != ch->dest && NULL != ch->root) | ||
1708 | { | ||
1709 | /* It is a loopback channel after all... */ | ||
1710 | GNUNET_break (0); | ||
1711 | return; | ||
1712 | } | ||
1713 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; | ||
1714 | } | ||
1715 | |||
1671 | channel_confirm (ch, !fwd); | 1716 | channel_confirm (ch, !fwd); |
1672 | } | 1717 | } |
1673 | 1718 | ||
@@ -1677,7 +1722,10 @@ GMCH_handle_ack (struct MeshChannel *ch, | |||
1677 | * | 1722 | * |
1678 | * @param ch Channel to be destroyed of. | 1723 | * @param ch Channel to be destroyed of. |
1679 | * @param msg Message. | 1724 | * @param msg Message. |
1680 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 1725 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
1726 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
1727 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
1728 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
1681 | */ | 1729 | */ |
1682 | void | 1730 | void |
1683 | GMCH_handle_destroy (struct MeshChannel *ch, | 1731 | GMCH_handle_destroy (struct MeshChannel *ch, |
@@ -1686,6 +1734,18 @@ GMCH_handle_destroy (struct MeshChannel *ch, | |||
1686 | { | 1734 | { |
1687 | struct MeshTunnel3 *t; | 1735 | struct MeshTunnel3 *t; |
1688 | 1736 | ||
1737 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | ||
1738 | if (GNUNET_SYSERR == fwd) | ||
1739 | { | ||
1740 | if (NULL != ch->dest && NULL != ch->root) | ||
1741 | { | ||
1742 | /* It is a loopback channel after all... */ | ||
1743 | GNUNET_break (0); | ||
1744 | return; | ||
1745 | } | ||
1746 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; | ||
1747 | } | ||
1748 | |||
1689 | GMCH_debug (ch); | 1749 | GMCH_debug (ch); |
1690 | if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) | 1750 | if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) |
1691 | { | 1751 | { |
diff --git a/src/mesh/gnunet-service-mesh_channel.h b/src/mesh/gnunet-service-mesh_channel.h index c81f28b07..66fe33340 100644 --- a/src/mesh/gnunet-service-mesh_channel.h +++ b/src/mesh/gnunet-service-mesh_channel.h | |||
@@ -240,7 +240,10 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
240 | * | 240 | * |
241 | * @param ch Channel for the message. | 241 | * @param ch Channel for the message. |
242 | * @param msg Unencryted data message. | 242 | * @param msg Unencryted data message. |
243 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 243 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
244 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
245 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
246 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
244 | */ | 247 | */ |
245 | void | 248 | void |
246 | GMCH_handle_data (struct MeshChannel *ch, | 249 | GMCH_handle_data (struct MeshChannel *ch, |
@@ -252,7 +255,10 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
252 | * | 255 | * |
253 | * @param ch Channel on which we got this message. | 256 | * @param ch Channel on which we got this message. |
254 | * @param msg Data message. | 257 | * @param msg Data message. |
255 | * @param fwd Is this a fwd ACK? (dest->orig) | 258 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
259 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
260 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
261 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
256 | */ | 262 | */ |
257 | void | 263 | void |
258 | GMCH_handle_data_ack (struct MeshChannel *ch, | 264 | GMCH_handle_data_ack (struct MeshChannel *ch, |
@@ -262,21 +268,24 @@ GMCH_handle_data_ack (struct MeshChannel *ch, | |||
262 | /** | 268 | /** |
263 | * Handler for channel create messages. | 269 | * Handler for channel create messages. |
264 | * | 270 | * |
271 | * Does not have fwd parameter because it's always 'FWD': channel is incoming. | ||
272 | * | ||
265 | * @param t Tunnel this channel will be in. | 273 | * @param t Tunnel this channel will be in. |
266 | * @param msg Message. | 274 | * @param msg Channel crate message. |
267 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | ||
268 | */ | 275 | */ |
269 | struct MeshChannel * | 276 | struct MeshChannel * |
270 | GMCH_handle_create (struct MeshTunnel3 *t, | 277 | GMCH_handle_create (struct MeshTunnel3 *t, |
271 | const struct GNUNET_MESH_ChannelCreate *msg, | 278 | const struct GNUNET_MESH_ChannelCreate *msg); |
272 | int fwd); | ||
273 | 279 | ||
274 | /** | 280 | /** |
275 | * Handler for channel ack messages. | 281 | * Handler for channel ack messages. |
276 | * | 282 | * |
277 | * @param ch Channel this channel is to be created in. | 283 | * @param ch Channel this channel is to be created in. |
278 | * @param msg Message. | 284 | * @param msg Message. |
279 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 285 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
286 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
287 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
288 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
280 | */ | 289 | */ |
281 | void | 290 | void |
282 | GMCH_handle_ack (struct MeshChannel *ch, | 291 | GMCH_handle_ack (struct MeshChannel *ch, |
@@ -288,7 +297,10 @@ GMCH_handle_ack (struct MeshChannel *ch, | |||
288 | * | 297 | * |
289 | * @param ch Channel this channel is to be destroyed of. | 298 | * @param ch Channel this channel is to be destroyed of. |
290 | * @param msg Message. | 299 | * @param msg Message. |
291 | * @param fwd Is this FWD traffic? #GNUNET_YES : #GNUNET_NO; | 300 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
301 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
302 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
303 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
292 | */ | 304 | */ |
293 | void | 305 | void |
294 | GMCH_handle_destroy (struct MeshChannel *ch, | 306 | GMCH_handle_destroy (struct MeshChannel *ch, |
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 1239d1459..d7f035d7e 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -1440,7 +1440,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1440 | return GNUNET_OK; | 1440 | return GNUNET_OK; |
1441 | } | 1441 | } |
1442 | fc->last_pid_recv = pid; | 1442 | fc->last_pid_recv = pid; |
1443 | GMT_handle_encrypted (c->t, msg, fwd); | 1443 | GMT_handle_encrypted (c->t, msg); |
1444 | GMC_send_ack (c, fwd); | 1444 | GMC_send_ack (c, fwd); |
1445 | return GNUNET_OK; | 1445 | return GNUNET_OK; |
1446 | } | 1446 | } |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index d46137cb9..c80dc3614 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -756,7 +756,10 @@ rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
756 | * | 756 | * |
757 | * @param t Tunnel on which the data came. | 757 | * @param t Tunnel on which the data came. |
758 | * @param msg Data message. | 758 | * @param msg Data message. |
759 | * @param fwd Is this FWD data? (root -> dest) | 759 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
760 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
761 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
762 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
760 | */ | 763 | */ |
761 | void | 764 | void |
762 | handle_data (struct MeshTunnel3 *t, | 765 | handle_data (struct MeshTunnel3 *t, |
@@ -797,6 +800,17 @@ handle_data (struct MeshTunnel3 *t, | |||
797 | GMCH_handle_data (ch, msg, fwd); | 800 | GMCH_handle_data (ch, msg, fwd); |
798 | } | 801 | } |
799 | 802 | ||
803 | |||
804 | /** | ||
805 | * Demultiplex data ACKs per channel and update appropriate channel buffer info. | ||
806 | * | ||
807 | * @param t Tunnel on which the DATA ACK came. | ||
808 | * @param msg DATA ACK message. | ||
809 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. | ||
810 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
811 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
812 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
813 | */ | ||
800 | void | 814 | void |
801 | handle_data_ack (struct MeshTunnel3 *t, | 815 | handle_data_ack (struct MeshTunnel3 *t, |
802 | const struct GNUNET_MESH_DataACK *msg, | 816 | const struct GNUNET_MESH_DataACK *msg, |
@@ -827,10 +841,16 @@ handle_data_ack (struct MeshTunnel3 *t, | |||
827 | GMCH_handle_data_ack (ch, msg, fwd); | 841 | GMCH_handle_data_ack (ch, msg, fwd); |
828 | } | 842 | } |
829 | 843 | ||
844 | |||
845 | /** | ||
846 | * Handle channel create. | ||
847 | * | ||
848 | * @param t Tunnel on which the data came. | ||
849 | * @param msg Data message. | ||
850 | */ | ||
830 | void | 851 | void |
831 | handle_ch_create (struct MeshTunnel3 *t, | 852 | handle_ch_create (struct MeshTunnel3 *t, |
832 | const struct GNUNET_MESH_ChannelCreate *msg, | 853 | const struct GNUNET_MESH_ChannelCreate *msg) |
833 | int fwd) | ||
834 | { | 854 | { |
835 | struct MeshChannel *ch; | 855 | struct MeshChannel *ch; |
836 | size_t size; | 856 | size_t size; |
@@ -852,11 +872,22 @@ handle_ch_create (struct MeshTunnel3 *t, | |||
852 | } | 872 | } |
853 | else | 873 | else |
854 | { | 874 | { |
855 | ch = GMCH_handle_create (t, msg, fwd); | 875 | ch = GMCH_handle_create (t, msg); |
856 | } | 876 | } |
857 | GMT_add_channel (t, ch); | 877 | GMT_add_channel (t, ch); |
858 | } | 878 | } |
859 | 879 | ||
880 | |||
881 | /** | ||
882 | * Handle a CHANNEL ACK (SYNACK/ACK). | ||
883 | * | ||
884 | * @param t Tunnel on which the CHANNEL ACK came. | ||
885 | * @param msg CHANNEL ACK message. | ||
886 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. | ||
887 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
888 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
889 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
890 | */ | ||
860 | void | 891 | void |
861 | handle_ch_ack (struct MeshTunnel3 *t, | 892 | handle_ch_ack (struct MeshTunnel3 *t, |
862 | const struct GNUNET_MESH_ChannelManage *msg, | 893 | const struct GNUNET_MESH_ChannelManage *msg, |
@@ -887,6 +918,18 @@ handle_ch_ack (struct MeshTunnel3 *t, | |||
887 | GMCH_handle_ack (ch, msg, fwd); | 918 | GMCH_handle_ack (ch, msg, fwd); |
888 | } | 919 | } |
889 | 920 | ||
921 | |||
922 | |||
923 | /** | ||
924 | * Handle a channel destruction message. | ||
925 | * | ||
926 | * @param t Tunnel on which the message came. | ||
927 | * @param msg Channel destroy message. | ||
928 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. | ||
929 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
930 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
931 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
932 | */ | ||
890 | void | 933 | void |
891 | handle_ch_destroy (struct MeshTunnel3 *t, | 934 | handle_ch_destroy (struct MeshTunnel3 *t, |
892 | const struct GNUNET_MESH_ChannelManage *msg, | 935 | const struct GNUNET_MESH_ChannelManage *msg, |
@@ -1017,7 +1060,10 @@ handle_pong (struct MeshTunnel3 *t, | |||
1017 | * | 1060 | * |
1018 | * @param t Tunnel this message came on. | 1061 | * @param t Tunnel this message came on. |
1019 | * @param msgh Message header. | 1062 | * @param msgh Message header. |
1020 | * @param fwd Is this message fwd? | 1063 | * @param fwd Is this message fwd? This only is meaningful in loopback channels. |
1064 | * #GNUNET_YES if message is FWD on the respective channel (loopback) | ||
1065 | * #GNUNET_NO if message is BCK on the respective channel (loopback) | ||
1066 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | ||
1021 | */ | 1067 | */ |
1022 | static void | 1068 | static void |
1023 | handle_decrypted (struct MeshTunnel3 *t, | 1069 | handle_decrypted (struct MeshTunnel3 *t, |
@@ -1044,8 +1090,7 @@ handle_decrypted (struct MeshTunnel3 *t, | |||
1044 | 1090 | ||
1045 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 1091 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: |
1046 | handle_ch_create (t, | 1092 | handle_ch_create (t, |
1047 | (struct GNUNET_MESH_ChannelCreate *) msgh, | 1093 | (struct GNUNET_MESH_ChannelCreate *) msgh); |
1048 | fwd); | ||
1049 | break; | 1094 | break; |
1050 | 1095 | ||
1051 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: | 1096 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: |
@@ -1078,12 +1123,10 @@ handle_decrypted (struct MeshTunnel3 *t, | |||
1078 | * | 1123 | * |
1079 | * @param t Tunnel this message came on. | 1124 | * @param t Tunnel this message came on. |
1080 | * @param msg Encrypted message. | 1125 | * @param msg Encrypted message. |
1081 | * @param fwd Is this message fwd? | ||
1082 | */ | 1126 | */ |
1083 | void | 1127 | void |
1084 | GMT_handle_encrypted (struct MeshTunnel3 *t, | 1128 | GMT_handle_encrypted (struct MeshTunnel3 *t, |
1085 | const struct GNUNET_MESH_Encrypted *msg, | 1129 | const struct GNUNET_MESH_Encrypted *msg) |
1086 | int fwd) | ||
1087 | { | 1130 | { |
1088 | size_t size = ntohs (msg->header.size); | 1131 | size_t size = ntohs (msg->header.size); |
1089 | size_t payload_size = size - sizeof (struct GNUNET_MESH_Encrypted); | 1132 | size_t payload_size = size - sizeof (struct GNUNET_MESH_Encrypted); |
@@ -1097,7 +1140,7 @@ GMT_handle_encrypted (struct MeshTunnel3 *t, | |||
1097 | while (off < decrypted_size) | 1140 | while (off < decrypted_size) |
1098 | { | 1141 | { |
1099 | msgh = (struct GNUNET_MessageHeader *) &cbuf[off]; | 1142 | msgh = (struct GNUNET_MessageHeader *) &cbuf[off]; |
1100 | handle_decrypted (t, msgh, fwd); | 1143 | handle_decrypted (t, msgh, GNUNET_SYSERR); |
1101 | off += ntohs (msgh->size); | 1144 | off += ntohs (msgh->size); |
1102 | } | 1145 | } |
1103 | } | 1146 | } |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h index 14d3eb934..aa4b90329 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.h +++ b/src/mesh/gnunet-service-mesh_tunnel.h | |||
@@ -220,12 +220,10 @@ GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid); | |||
220 | * | 220 | * |
221 | * @param t Tunnel this message came on. | 221 | * @param t Tunnel this message came on. |
222 | * @param msg Message header. | 222 | * @param msg Message header. |
223 | * @param fwd Is this message fwd? | ||
224 | */ | 223 | */ |
225 | void | 224 | void |
226 | GMT_handle_encrypted (struct MeshTunnel3 *t, | 225 | GMT_handle_encrypted (struct MeshTunnel3 *t, |
227 | const struct GNUNET_MESH_Encrypted *msg, | 226 | const struct GNUNET_MESH_Encrypted *msg); |
228 | int fwd); | ||
229 | 227 | ||
230 | /** | 228 | /** |
231 | * Demultiplex an encapsulated KX message by message type. | 229 | * Demultiplex an encapsulated KX message by message type. |