diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-09 01:30:25 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-09 01:30:25 +0000 |
commit | 50f061e6ca2df0c9473b87f79beb5225b1400f03 (patch) | |
tree | 91cf82a441f21eabe4c7c86bc68fb63a86c647a2 | |
parent | 851a84b96ab44bb1ad49443942e5934ca387eced (diff) | |
download | gnunet-50f061e6ca2df0c9473b87f79beb5225b1400f03.tar.gz gnunet-50f061e6ca2df0c9473b87f79beb5225b1400f03.zip |
- sync
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 62 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 28 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.h | 15 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 126 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.h | 31 |
5 files changed, 180 insertions, 82 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 0d7dfc5f0..7c3cb08bb 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "gnunet-service-mesh_connection.h" | 32 | #include "gnunet-service-mesh_connection.h" |
33 | #include "gnunet-service-mesh_peer.h" | 33 | #include "gnunet-service-mesh_peer.h" |
34 | #include "gnunet-service-mesh_tunnel.h" | ||
34 | #include "mesh_protocol_enc.h" | 35 | #include "mesh_protocol_enc.h" |
35 | #include "mesh_path.h" | 36 | #include "mesh_path.h" |
36 | 37 | ||
@@ -314,7 +315,6 @@ GMC_state2s (enum MeshConnectionState s) | |||
314 | } | 315 | } |
315 | 316 | ||
316 | 317 | ||
317 | |||
318 | /** | 318 | /** |
319 | * Initialize a Flow Control structure to the initial state. | 319 | * Initialize a Flow Control structure to the initial state. |
320 | * | 320 | * |
@@ -726,8 +726,6 @@ connection_cancel_queues (struct MeshConnection *c, int fwd) | |||
726 | } | 726 | } |
727 | 727 | ||
728 | 728 | ||
729 | |||
730 | |||
731 | /** | 729 | /** |
732 | * Function called if a connection has been stalled for a while, | 730 | * Function called if a connection has been stalled for a while, |
733 | * possibly due to a missed ACK. Poll the neighbor about its ACK status. | 731 | * possibly due to a missed ACK. Poll the neighbor about its ACK status. |
@@ -951,6 +949,23 @@ register_neighbors (struct MeshConnection *c) | |||
951 | } | 949 | } |
952 | 950 | ||
953 | 951 | ||
952 | /** | ||
953 | * | ||
954 | */ | ||
955 | static void | ||
956 | unregister_neighbors (struct MeshConnection *c) | ||
957 | { | ||
958 | struct MeshPeer *peer; | ||
959 | |||
960 | peer = connection_get_next_hop (c); | ||
961 | GMP_remove_connection (peer, c); | ||
962 | |||
963 | peer = connection_get_prev_hop (c); | ||
964 | GMP_remove_connection (peer, c); | ||
965 | |||
966 | } | ||
967 | |||
968 | |||
954 | /******************************************************************************/ | 969 | /******************************************************************************/ |
955 | /******************************** API ***********************************/ | 970 | /******************************** API ***********************************/ |
956 | /******************************************************************************/ | 971 | /******************************************************************************/ |
@@ -1647,7 +1662,7 @@ GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1647 | return GNUNET_OK; | 1662 | return GNUNET_OK; |
1648 | 1663 | ||
1649 | GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO); | 1664 | GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO); |
1650 | send_prebuilt_message_connection (message, c, NULL, fwd); | 1665 | GMC_send_prebuilt_message (message, c, NULL, fwd); |
1651 | 1666 | ||
1652 | return GNUNET_OK; | 1667 | return GNUNET_OK; |
1653 | } | 1668 | } |
@@ -1672,17 +1687,17 @@ send_ack (struct MeshConnection *c, struct MeshChannel *ch, int fwd) | |||
1672 | if (NULL == c || GMC_is_terminal (c, fwd)) | 1687 | if (NULL == c || GMC_is_terminal (c, fwd)) |
1673 | { | 1688 | { |
1674 | LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all connections\n"); | 1689 | LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all connections\n"); |
1675 | buffer = tunnel_get_buffer (NULL == c ? ch->t : c->t, fwd); | 1690 | buffer = GMT_get_buffer (NULL == c ? ch->t : c->t, fwd); |
1676 | } | 1691 | } |
1677 | else | 1692 | else |
1678 | { | 1693 | { |
1679 | LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n"); | 1694 | LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n"); |
1680 | buffer = connection_get_buffer (c, fwd); | 1695 | buffer = GMC_get_buffer (c, fwd); |
1681 | } | 1696 | } |
1682 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer); | 1697 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer); |
1683 | 1698 | ||
1684 | if ( (NULL != ch && channel_is_origin (ch, fwd)) || | 1699 | if ( (NULL != ch && GMCH_is_origin (ch, fwd)) || |
1685 | (NULL != c && connection_is_origin (c, fwd)) ) | 1700 | (NULL != c && GMC_is_origin (c, fwd)) ) |
1686 | { | 1701 | { |
1687 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); | 1702 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); |
1688 | if (0 < buffer) | 1703 | if (0 < buffer) |
@@ -1763,7 +1778,6 @@ GMC_new (const struct GNUNET_HashCode *cid, | |||
1763 | unsigned int own_pos) | 1778 | unsigned int own_pos) |
1764 | { | 1779 | { |
1765 | struct MeshConnection *c; | 1780 | struct MeshConnection *c; |
1766 | unsigned int own_pos; | ||
1767 | 1781 | ||
1768 | c = GNUNET_new (struct MeshConnection); | 1782 | c = GNUNET_new (struct MeshConnection); |
1769 | c->id = *cid; | 1783 | c->id = *cid; |
@@ -1795,7 +1809,7 @@ GMC_new (const struct GNUNET_HashCode *cid, | |||
1795 | } | 1809 | } |
1796 | 1810 | ||
1797 | 1811 | ||
1798 | static void | 1812 | void |
1799 | GMC_destroy (struct MeshConnection *c) | 1813 | GMC_destroy (struct MeshConnection *c) |
1800 | { | 1814 | { |
1801 | struct MeshPeer *peer; | 1815 | struct MeshPeer *peer; |
@@ -1803,9 +1817,8 @@ GMC_destroy (struct MeshConnection *c) | |||
1803 | if (NULL == c) | 1817 | if (NULL == c) |
1804 | return; | 1818 | return; |
1805 | 1819 | ||
1806 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s[%X]\n", | 1820 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", |
1807 | peer2s (c->t->peer), | 1821 | GNUNET_h2s (&c->id)); |
1808 | c->id); | ||
1809 | 1822 | ||
1810 | /* Cancel all traffic */ | 1823 | /* Cancel all traffic */ |
1811 | connection_cancel_queues (c, GNUNET_YES); | 1824 | connection_cancel_queues (c, GNUNET_YES); |
@@ -1817,17 +1830,12 @@ GMC_destroy (struct MeshConnection *c) | |||
1817 | if (GNUNET_SCHEDULER_NO_TASK != c->bck_maintenance_task) | 1830 | if (GNUNET_SCHEDULER_NO_TASK != c->bck_maintenance_task) |
1818 | GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); | 1831 | GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); |
1819 | 1832 | ||
1820 | /* Deregister from neighbors */ | 1833 | /* Unregister from neighbors */ |
1821 | peer = connection_get_next_hop (c); | 1834 | unregister_neighbors (c); |
1822 | if (NULL != peer && NULL != peer->connections) | ||
1823 | GNUNET_CONTAINER_multihashmap_remove (peer->connections, &c->id, c); | ||
1824 | peer = connection_get_prev_hop (c); | ||
1825 | if (NULL != peer && NULL != peer->connections) | ||
1826 | GNUNET_CONTAINER_multihashmap_remove (peer->connections, &c->id, c); | ||
1827 | 1835 | ||
1828 | /* Delete */ | 1836 | /* Delete */ |
1829 | GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); | 1837 | GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); |
1830 | GNUNET_CONTAINER_DLL_remove (c->t->connection_head, c->t->connection_tail, c); | 1838 | GMT_remove_connection (c->t, c); |
1831 | GNUNET_free (c); | 1839 | GNUNET_free (c); |
1832 | } | 1840 | } |
1833 | 1841 | ||
@@ -1909,7 +1917,6 @@ GMC_notify_broken (struct MeshConnection *c, | |||
1909 | struct MeshPeer *peer, | 1917 | struct MeshPeer *peer, |
1910 | struct GNUNET_PeerIdentity *my_full_id) | 1918 | struct GNUNET_PeerIdentity *my_full_id) |
1911 | { | 1919 | { |
1912 | struct MeshConnection *c = value; | ||
1913 | struct GNUNET_MESH_ConnectionBroken msg; | 1920 | struct GNUNET_MESH_ConnectionBroken msg; |
1914 | int fwd; | 1921 | int fwd; |
1915 | 1922 | ||
@@ -1920,18 +1927,18 @@ GMC_notify_broken (struct MeshConnection *c, | |||
1920 | { | 1927 | { |
1921 | /* Local shutdown, no one to notify about this. */ | 1928 | /* Local shutdown, no one to notify about this. */ |
1922 | GMC_destroy (c); | 1929 | GMC_destroy (c); |
1923 | return GNUNET_YES; | 1930 | return; |
1924 | } | 1931 | } |
1925 | 1932 | ||
1926 | msg.header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); | 1933 | msg.header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); |
1927 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); | 1934 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); |
1928 | msg.cid = c->id; | 1935 | msg.cid = c->id; |
1929 | msg.peer1 = *my_full_id; | 1936 | msg.peer1 = *my_full_id; |
1930 | msg.peer2 = *GNUNET_PEER_resolve2 (peer->id); | 1937 | msg.peer2 = *GMP_get_id (peer); |
1931 | GMC_send_prebuilt_message (&msg.header, c, NULL, fwd); | 1938 | GMC_send_prebuilt_message (&msg.header, c, NULL, fwd); |
1932 | c->destroy = GNUNET_YES; | 1939 | c->destroy = GNUNET_YES; |
1933 | 1940 | ||
1934 | return GNUNET_YES; | 1941 | return; |
1935 | } | 1942 | } |
1936 | 1943 | ||
1937 | 1944 | ||
@@ -2084,9 +2091,8 @@ GMC_send_destroy (struct MeshConnection *c) | |||
2084 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);; | 2091 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);; |
2085 | msg.cid = c->id; | 2092 | msg.cid = c->id; |
2086 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2093 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2087 | " sending connection destroy for connection %s[%X]\n", | 2094 | " sending connection destroy for connection %s\n", |
2088 | peer2s (c->t->peer), | 2095 | GNUNET_h2s (&c->id)); |
2089 | c->id); | ||
2090 | 2096 | ||
2091 | if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES)) | 2097 | if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES)) |
2092 | GMC_send_prebuilt_message (&msg.header, c, NULL, GNUNET_YES); | 2098 | GMC_send_prebuilt_message (&msg.header, c, NULL, GNUNET_YES); |
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 6c8963864..05fb90f39 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1541,6 +1541,34 @@ GMP_add_connection (struct MeshPeer *peer, | |||
1541 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1541 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1542 | } | 1542 | } |
1543 | 1543 | ||
1544 | |||
1545 | int | ||
1546 | GMP_remove_connection (struct MeshPeer *peer, | ||
1547 | const struct MeshConnection *c) | ||
1548 | { | ||
1549 | if (NULL == peer || NULL == peer->connections) | ||
1550 | { | ||
1551 | GNUNET_break (0); | ||
1552 | return GNUNET_SYSERR; | ||
1553 | } | ||
1554 | return GNUNET_CONTAINER_multihashmap_remove (peer->connections, | ||
1555 | GMC_get_id (c), | ||
1556 | c); | ||
1557 | } | ||
1558 | |||
1559 | /** | ||
1560 | * Get the Full ID of a peer. | ||
1561 | * | ||
1562 | * @param peer Peer to get from. | ||
1563 | * | ||
1564 | * @return Full ID of peer. | ||
1565 | */ | ||
1566 | struct GNUNET_PeerIdentity * | ||
1567 | GMP_get_id (const struct MeshPeer *peer) | ||
1568 | { | ||
1569 | return GNUNET_PEER_resolve2 (peer->id); | ||
1570 | } | ||
1571 | |||
1544 | /** | 1572 | /** |
1545 | * Get the static string for a peer ID. | 1573 | * Get the static string for a peer ID. |
1546 | * | 1574 | * |
diff --git a/src/mesh/gnunet-service-mesh_peer.h b/src/mesh/gnunet-service-mesh_peer.h index 3a336fb37..b5c165e9a 100644 --- a/src/mesh/gnunet-service-mesh_peer.h +++ b/src/mesh/gnunet-service-mesh_peer.h | |||
@@ -40,6 +40,8 @@ extern "C" | |||
40 | #include "platform.h" | 40 | #include "platform.h" |
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | 42 | ||
43 | #include "gnunet-service-mesh_connection.h" | ||
44 | |||
43 | /** | 45 | /** |
44 | * Struct containing all information regarding a given peer | 46 | * Struct containing all information regarding a given peer |
45 | */ | 47 | */ |
@@ -115,6 +117,19 @@ GMP_is_neighbor (const struct MeshPeer *peer); | |||
115 | int | 117 | int |
116 | GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c); | 118 | GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c); |
117 | 119 | ||
120 | int | ||
121 | GMP_remove_connection (struct MeshPeer *peer, struct MeshConnection *c); | ||
122 | |||
123 | /** | ||
124 | * Get the Full ID of a peer. | ||
125 | * | ||
126 | * @param peer Peer to get from. | ||
127 | * | ||
128 | * @return Full ID of peer. | ||
129 | */ | ||
130 | struct GNUNET_PeerIdentity * | ||
131 | GMP_get_id (const struct MeshPeer *peer); | ||
132 | |||
118 | /** | 133 | /** |
119 | * Get the static string for a peer ID. | 134 | * Get the static string for a peer ID. |
120 | * | 135 | * |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 62545b35c..8a240f4a8 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -290,58 +290,6 @@ tunnel_get_connection (struct MeshTunnel3 *t, int fwd) | |||
290 | 290 | ||
291 | 291 | ||
292 | /** | 292 | /** |
293 | * Get the total buffer space for a tunnel. | ||
294 | * | ||
295 | * @param t Tunnel. | ||
296 | * @param fwd Is this for FWD traffic? | ||
297 | * | ||
298 | * @return Buffer space offered by all connections in the tunnel. | ||
299 | */ | ||
300 | static unsigned int | ||
301 | tunnel_get_buffer (struct MeshTunnel3 *t, int fwd) | ||
302 | { | ||
303 | struct MeshTConnection *iter; | ||
304 | unsigned int buffer; | ||
305 | |||
306 | iter = t->connection_head; | ||
307 | buffer = 0; | ||
308 | |||
309 | /* If terminal, return biggest channel buffer */ | ||
310 | if (NULL == iter || GMC_is_terminal (iter->c, fwd)) | ||
311 | { | ||
312 | struct MeshTChannel *iter_ch; | ||
313 | unsigned int ch_buf; | ||
314 | |||
315 | if (NULL == t->channel_head) | ||
316 | return 64; | ||
317 | |||
318 | for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = iter_ch->next) | ||
319 | { | ||
320 | ch_buf = GMCH_get_buffer (iter_ch->ch, fwd); | ||
321 | if (ch_buf > buffer) | ||
322 | buffer = ch_buf; | ||
323 | } | ||
324 | return buffer; | ||
325 | } | ||
326 | |||
327 | /* If not terminal, return sum of connection buffers */ | ||
328 | while (NULL != iter) | ||
329 | { | ||
330 | if (GMC_get_state (iter->c) != MESH_CONNECTION_READY) | ||
331 | { | ||
332 | iter = iter->next; | ||
333 | continue; | ||
334 | } | ||
335 | |||
336 | buffer += GMC_get_buffer (iter->c, fwd); | ||
337 | iter = iter->next; | ||
338 | } | ||
339 | |||
340 | return buffer; | ||
341 | } | ||
342 | |||
343 | |||
344 | /** | ||
345 | * Send all cached messages that we can, tunnel is online. | 293 | * Send all cached messages that we can, tunnel is online. |
346 | * | 294 | * |
347 | * @param t Tunnel that holds the messages. | 295 | * @param t Tunnel that holds the messages. |
@@ -357,7 +305,7 @@ tunnel_send_queued_data (struct MeshTunnel3 *t, int fwd) | |||
357 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 305 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
358 | "tunnel_send_queued_data on tunnel %s\n", | 306 | "tunnel_send_queued_data on tunnel %s\n", |
359 | GMP_2s (t->peer)); | 307 | GMP_2s (t->peer)); |
360 | room = tunnel_get_buffer (t, fwd); | 308 | room = GMT_get_buffer (t, fwd); |
361 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); | 309 | LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); |
362 | for (tq = t->tq_head; NULL != tq && room > 0; tq = next) | 310 | for (tq = t->tq_head; NULL != tq && room > 0; tq = next) |
363 | { | 311 | { |
@@ -741,6 +689,27 @@ GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | |||
741 | 689 | ||
742 | 690 | ||
743 | /** | 691 | /** |
692 | * Remove a connection from a tunnel. | ||
693 | * | ||
694 | * @param t Tunnel. | ||
695 | * @param c Connection. | ||
696 | */ | ||
697 | void | ||
698 | GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | ||
699 | { | ||
700 | struct MeshTConnection *aux; | ||
701 | |||
702 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | ||
703 | if (aux->c == c) | ||
704 | { | ||
705 | GNUNET_CONTAINER_DLL_remove (t->connection_head, t->connection_tail, aux); | ||
706 | GNUNET_free (aux); | ||
707 | return; | ||
708 | } | ||
709 | } | ||
710 | |||
711 | |||
712 | /** | ||
744 | * Tunnel is empty: destroy it. | 713 | * Tunnel is empty: destroy it. |
745 | * | 714 | * |
746 | * Notifies all connections about the destruction. | 715 | * Notifies all connections about the destruction. |
@@ -983,6 +952,57 @@ GMT_count_channels (struct MeshTunnel3 *t) | |||
983 | 952 | ||
984 | 953 | ||
985 | /** | 954 | /** |
955 | * Get the total buffer space for a tunnel. | ||
956 | * | ||
957 | * @param t Tunnel. | ||
958 | * @param fwd Is this for FWD traffic? | ||
959 | * | ||
960 | * @return Buffer space offered by all connections in the tunnel. | ||
961 | */ | ||
962 | unsigned int | ||
963 | GMT_get_buffer (struct MeshTunnel3 *t, int fwd) | ||
964 | { | ||
965 | struct MeshTConnection *iter; | ||
966 | unsigned int buffer; | ||
967 | |||
968 | iter = t->connection_head; | ||
969 | buffer = 0; | ||
970 | |||
971 | /* If terminal, return biggest channel buffer */ | ||
972 | if (NULL == iter || GMC_is_terminal (iter->c, fwd)) | ||
973 | { | ||
974 | struct MeshTChannel *iter_ch; | ||
975 | unsigned int ch_buf; | ||
976 | |||
977 | if (NULL == t->channel_head) | ||
978 | return 64; | ||
979 | |||
980 | for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = iter_ch->next) | ||
981 | { | ||
982 | ch_buf = GMCH_get_buffer (iter_ch->ch, fwd); | ||
983 | if (ch_buf > buffer) | ||
984 | buffer = ch_buf; | ||
985 | } | ||
986 | return buffer; | ||
987 | } | ||
988 | |||
989 | /* If not terminal, return sum of connection buffers */ | ||
990 | while (NULL != iter) | ||
991 | { | ||
992 | if (GMC_get_state (iter->c) != MESH_CONNECTION_READY) | ||
993 | { | ||
994 | iter = iter->next; | ||
995 | continue; | ||
996 | } | ||
997 | |||
998 | buffer += GMC_get_buffer (iter->c, fwd); | ||
999 | iter = iter->next; | ||
1000 | } | ||
1001 | |||
1002 | return buffer; | ||
1003 | } | ||
1004 | |||
1005 | /** | ||
986 | * Sends an already built message on a tunnel, choosing the best connection. | 1006 | * Sends an already built message on a tunnel, choosing the best connection. |
987 | * | 1007 | * |
988 | * @param message Message to send. Function modifies it. | 1008 | * @param message Message to send. Function modifies it. |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h index 76b867cbc..afa0ee169 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.h +++ b/src/mesh/gnunet-service-mesh_tunnel.h | |||
@@ -41,7 +41,7 @@ extern "C" | |||
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | 42 | ||
43 | #include "gnunet-service-mesh_channel.h" | 43 | #include "gnunet-service-mesh_channel.h" |
44 | 44 | #include "gnunet-service-mesh_connection.h" | |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * All the states a tunnel can be in. | 47 | * All the states a tunnel can be in. |
@@ -142,6 +142,24 @@ GMT_destroy (struct MeshTunnel3 *t); | |||
142 | void | 142 | void |
143 | GMT_change_state (struct MeshTunnel3* t, enum MeshTunnelState state); | 143 | GMT_change_state (struct MeshTunnel3* t, enum MeshTunnelState state); |
144 | 144 | ||
145 | /** | ||
146 | * Add a connection to a tunnel. | ||
147 | * | ||
148 | * @param t Tunnel. | ||
149 | * @param c Connection. | ||
150 | */ | ||
151 | void | ||
152 | GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c); | ||
153 | |||
154 | |||
155 | /** | ||
156 | * Remove a connection from a tunnel. | ||
157 | * | ||
158 | * @param t Tunnel. | ||
159 | * @param c Connection. | ||
160 | */ | ||
161 | void | ||
162 | GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c); | ||
145 | 163 | ||
146 | /** | 164 | /** |
147 | * Cache a message to be sent once tunnel is online. | 165 | * Cache a message to be sent once tunnel is online. |
@@ -177,6 +195,17 @@ GMT_count_connections (struct MeshTunnel3 *t); | |||
177 | unsigned int | 195 | unsigned int |
178 | GMT_count_channels (struct MeshTunnel3 *t); | 196 | GMT_count_channels (struct MeshTunnel3 *t); |
179 | 197 | ||
198 | /** | ||
199 | * Get the total buffer space for a tunnel. | ||
200 | * | ||
201 | * @param t Tunnel. | ||
202 | * @param fwd Is this for FWD traffic? | ||
203 | * | ||
204 | * @return Buffer space offered by all connections in the tunnel. | ||
205 | */ | ||
206 | unsigned int | ||
207 | GMT_get_buffer (struct MeshTunnel3 *t, int fwd); | ||
208 | |||
180 | #if 0 /* keep Emacsens' auto-indent happy */ | 209 | #if 0 /* keep Emacsens' auto-indent happy */ |
181 | { | 210 | { |
182 | #endif | 211 | #endif |