aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-06-28 14:34:55 +0000
committerBart Polot <bart@net.in.tum.de>2013-06-28 14:34:55 +0000
commitcf19b5082fe8de33e38957f54d28647635b46b60 (patch)
treee6e41da7d5cb14d9a342ef6533633ecb2f34b18d /src/exit
parent166d8f9122bf7ebbaa2a662d09a3fa4d34f6d092 (diff)
downloadgnunet-cf19b5082fe8de33e38957f54d28647635b46b60.tar.gz
gnunet-cf19b5082fe8de33e38957f54d28647635b46b60.zip
Replace mesh with new version
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c115
1 files changed, 47 insertions, 68 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 4e94ea596..f26ddf734 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -209,6 +209,12 @@ struct TunnelState
209 struct GNUNET_MESH_Tunnel *tunnel; 209 struct GNUNET_MESH_Tunnel *tunnel;
210 210
211 /** 211 /**
212 * Who is the other end of this tunnel.
213 * FIXME is this needed? Only used for debugging messages
214 */
215 struct GNUNET_PeerIdentity peer;
216
217 /**
212 * Active tunnel transmission request (or NULL). 218 * Active tunnel transmission request (or NULL).
213 */ 219 */
214 struct GNUNET_MESH_TransmitHandle *th; 220 struct GNUNET_MESH_TransmitHandle *th;
@@ -493,7 +499,6 @@ process_dns_result (void *cls,
493 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 499 ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel,
494 GNUNET_NO, 500 GNUNET_NO,
495 GNUNET_TIME_UNIT_FOREVER_REL, 501 GNUNET_TIME_UNIT_FOREVER_REL,
496 NULL,
497 sizeof (struct GNUNET_MessageHeader) + r, 502 sizeof (struct GNUNET_MessageHeader) + r,
498 &transmit_reply_to_mesh, 503 &transmit_reply_to_mesh,
499 ts); 504 ts);
@@ -506,18 +511,15 @@ process_dns_result (void *cls,
506 * @param cls closure, NULL 511 * @param cls closure, NULL
507 * @param tunnel connection to the other end 512 * @param tunnel connection to the other end
508 * @param tunnel_ctx pointer to our 'struct TunnelState *' 513 * @param tunnel_ctx pointer to our 'struct TunnelState *'
509 * @param sender who sent the message
510 * @param message the actual message 514 * @param message the actual message
511 * @param atsi performance data for the connection 515 *
512 * @return GNUNET_OK to keep the connection open, 516 * @return GNUNET_OK to keep the connection open,
513 * GNUNET_SYSERR to close it (signal serious error) 517 * GNUNET_SYSERR to close it (signal serious error)
514 */ 518 */
515static int 519static int
516receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 520receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
517 void **tunnel_ctx, 521 void **tunnel_ctx,
518 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 522 const struct GNUNET_MessageHeader *message)
519 const struct GNUNET_MessageHeader *message,
520 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
521{ 523{
522 struct TunnelState *ts = *tunnel_ctx; 524 struct TunnelState *ts = *tunnel_ctx;
523 const struct GNUNET_TUN_DnsHeader *dns; 525 const struct GNUNET_TUN_DnsHeader *dns;
@@ -782,7 +784,6 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
782 s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 784 s->th = GNUNET_MESH_notify_transmit_ready (tunnel,
783 GNUNET_NO /* corking */, 785 GNUNET_NO /* corking */,
784 GNUNET_TIME_UNIT_FOREVER_REL, 786 GNUNET_TIME_UNIT_FOREVER_REL,
785 NULL,
786 tnq->len, 787 tnq->len,
787 &send_to_peer_notify_callback, 788 &send_to_peer_notify_callback,
788 s); 789 s);
@@ -799,7 +800,6 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
799 s->th = GNUNET_MESH_notify_transmit_ready (tunnel, 800 s->th = GNUNET_MESH_notify_transmit_ready (tunnel,
800 GNUNET_NO /* corking */, 801 GNUNET_NO /* corking */,
801 GNUNET_TIME_UNIT_FOREVER_REL, 802 GNUNET_TIME_UNIT_FOREVER_REL,
802 NULL,
803 tnq->len, 803 tnq->len,
804 &send_to_peer_notify_callback, 804 &send_to_peer_notify_callback,
805 s); 805 s);
@@ -817,19 +817,19 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
817 * @param tnq message to queue 817 * @param tnq message to queue
818 */ 818 */
819static void 819static void
820send_packet_to_mesh_tunnel (struct GNUNET_MESH_Tunnel *mesh_tunnel, 820send_packet_to_mesh_tunnel (struct TunnelState *s,
821 struct TunnelMessageQueue *tnq) 821 struct TunnelMessageQueue *tnq)
822{ 822{
823 struct TunnelState *s; 823 struct GNUNET_MESH_Tunnel *mesh_tunnel;
824 824
825 s = GNUNET_MESH_tunnel_get_data (mesh_tunnel); 825 mesh_tunnel = s->tunnel;
826 GNUNET_assert (NULL != s); 826 GNUNET_assert (NULL != s);
827 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq); 827 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq);
828 if (NULL == s->th) 828 if (NULL == s->th)
829 s->th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel, 829 s->th = GNUNET_MESH_notify_transmit_ready (mesh_tunnel,
830 GNUNET_NO /* cork */, 830 GNUNET_NO /* cork */,
831 GNUNET_TIME_UNIT_FOREVER_REL, 831 GNUNET_TIME_UNIT_FOREVER_REL,
832 NULL, tnq->len, 832 tnq->len,
833 &send_to_peer_notify_callback, 833 &send_to_peer_notify_callback,
834 s); 834 s);
835} 835}
@@ -1019,8 +1019,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1019 memcpy (&i2v->icmp_header, 1019 memcpy (&i2v->icmp_header,
1020 icmp, 1020 icmp,
1021 pktlen); 1021 pktlen);
1022 send_packet_to_mesh_tunnel (state->tunnel, 1022 send_packet_to_mesh_tunnel (state, tnq);
1023 tnq);
1024} 1023}
1025 1024
1026 1025
@@ -1097,8 +1096,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1097 memcpy (&urm[1], 1096 memcpy (&urm[1],
1098 &udp[1], 1097 &udp[1],
1099 pktlen - sizeof (struct GNUNET_TUN_UdpHeader)); 1098 pktlen - sizeof (struct GNUNET_TUN_UdpHeader));
1100 send_packet_to_mesh_tunnel (state->tunnel, 1099 send_packet_to_mesh_tunnel (state, tnq);
1101 tnq);
1102} 1100}
1103 1101
1104 1102
@@ -1186,8 +1184,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1186 memcpy (&tdm->tcp_header, 1184 memcpy (&tdm->tcp_header,
1187 buf, 1185 buf,
1188 pktlen); 1186 pktlen);
1189 send_packet_to_mesh_tunnel (state->tunnel, 1187 send_packet_to_mesh_tunnel (state, tnq);
1190 tnq);
1191} 1188}
1192 1189
1193 1190
@@ -1796,18 +1793,15 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1796 * @param cls closure, NULL 1793 * @param cls closure, NULL
1797 * @param tunnel connection to the other end 1794 * @param tunnel connection to the other end
1798 * @param tunnel_ctx pointer to our 'struct TunnelState *' 1795 * @param tunnel_ctx pointer to our 'struct TunnelState *'
1799 * @param sender who sent the message
1800 * @param message the actual message 1796 * @param message the actual message
1801 * @param atsi performance data for the connection 1797 *
1802 * @return GNUNET_OK to keep the connection open, 1798 * @return GNUNET_OK to keep the connection open,
1803 * GNUNET_SYSERR to close it (signal serious error) 1799 * GNUNET_SYSERR to close it (signal serious error)
1804 */ 1800 */
1805static int 1801static int
1806receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 1802receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1807 void **tunnel_ctx GNUNET_UNUSED, 1803 void **tunnel_ctx GNUNET_UNUSED,
1808 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 1804 const struct GNUNET_MessageHeader *message)
1809 const struct GNUNET_MessageHeader *message,
1810 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
1811{ 1805{
1812 struct TunnelState *state = *tunnel_ctx; 1806 struct TunnelState *state = *tunnel_ctx;
1813 const struct GNUNET_EXIT_TcpServiceStartMessage *start; 1807 const struct GNUNET_EXIT_TcpServiceStartMessage *start;
@@ -1853,7 +1847,7 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1853 /* setup fresh connection */ 1847 /* setup fresh connection */
1854 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1855 "Received data from %s for forwarding to TCP service %s on port %u\n", 1849 "Received data from %s for forwarding to TCP service %s on port %u\n",
1856 GNUNET_i2s (sender), 1850 GNUNET_i2s (&state->peer),
1857 GNUNET_h2s (&start->service_descriptor), 1851 GNUNET_h2s (&start->service_descriptor),
1858 (unsigned int) ntohs (start->tcp_header.destination_port)); 1852 (unsigned int) ntohs (start->tcp_header.destination_port));
1859 if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor, 1853 if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor,
@@ -1884,18 +1878,15 @@ receive_tcp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1884 * @param cls closure, NULL 1878 * @param cls closure, NULL
1885 * @param tunnel connection to the other end 1879 * @param tunnel connection to the other end
1886 * @param tunnel_ctx pointer to our 'struct TunnelState *' 1880 * @param tunnel_ctx pointer to our 'struct TunnelState *'
1887 * @param sender who sent the message
1888 * @param message the actual message 1881 * @param message the actual message
1889 * @param atsi performance data for the connection 1882 *
1890 * @return GNUNET_OK to keep the connection open, 1883 * @return GNUNET_OK to keep the connection open,
1891 * GNUNET_SYSERR to close it (signal serious error) 1884 * GNUNET_SYSERR to close it (signal serious error)
1892 */ 1885 */
1893static int 1886static int
1894receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 1887receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1895 void **tunnel_ctx GNUNET_UNUSED, 1888 void **tunnel_ctx GNUNET_UNUSED,
1896 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 1889 const struct GNUNET_MessageHeader *message)
1897 const struct GNUNET_MessageHeader *message,
1898 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
1899{ 1890{
1900 struct TunnelState *state = *tunnel_ctx; 1891 struct TunnelState *state = *tunnel_ctx;
1901 const struct GNUNET_EXIT_TcpInternetStartMessage *start; 1892 const struct GNUNET_EXIT_TcpInternetStartMessage *start;
@@ -1984,7 +1975,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1984 char buf[INET6_ADDRSTRLEN]; 1975 char buf[INET6_ADDRSTRLEN];
1985 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1976 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1986 "Received data from %s for starting TCP stream to %s:%u\n", 1977 "Received data from %s for starting TCP stream to %s:%u\n",
1987 GNUNET_i2s (sender), 1978 GNUNET_i2s (&state->peer),
1988 inet_ntop (af, 1979 inet_ntop (af,
1989 &state->specifics.tcp_udp.ri.remote_address.address, 1980 &state->specifics.tcp_udp.ri.remote_address.address,
1990 buf, sizeof (buf)), 1981 buf, sizeof (buf)),
@@ -2008,18 +1999,15 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2008 * @param cls closure, NULL 1999 * @param cls closure, NULL
2009 * @param tunnel connection to the other end 2000 * @param tunnel connection to the other end
2010 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2001 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2011 * @param sender who sent the message
2012 * @param message the actual message 2002 * @param message the actual message
2013 * @param atsi performance data for the connection 2003 *
2014 * @return GNUNET_OK to keep the connection open, 2004 * @return GNUNET_OK to keep the connection open,
2015 * GNUNET_SYSERR to close it (signal serious error) 2005 * GNUNET_SYSERR to close it (signal serious error)
2016 */ 2006 */
2017static int 2007static int
2018receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2008receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2019 void **tunnel_ctx GNUNET_UNUSED, 2009 void **tunnel_ctx GNUNET_UNUSED,
2020 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 2010 const struct GNUNET_MessageHeader *message)
2021 const struct GNUNET_MessageHeader *message,
2022 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2023{ 2011{
2024 struct TunnelState *state = *tunnel_ctx; 2012 struct TunnelState *state = *tunnel_ctx;
2025 const struct GNUNET_EXIT_TcpDataMessage *data; 2013 const struct GNUNET_EXIT_TcpDataMessage *data;
@@ -2069,7 +2057,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2069 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2057 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2070 "Received additional %u bytes of data from %s for TCP stream to %s:%u\n", 2058 "Received additional %u bytes of data from %s for TCP stream to %s:%u\n",
2071 pkt_len, 2059 pkt_len,
2072 GNUNET_i2s (sender), 2060 GNUNET_i2s (&state->peer),
2073 inet_ntop (state->specifics.tcp_udp.ri.remote_address.af, 2061 inet_ntop (state->specifics.tcp_udp.ri.remote_address.af,
2074 &state->specifics.tcp_udp.ri.remote_address.address, 2062 &state->specifics.tcp_udp.ri.remote_address.address,
2075 buf, sizeof (buf)), 2063 buf, sizeof (buf)),
@@ -2244,18 +2232,15 @@ make_up_icmpv6_payload (struct TunnelState *state,
2244 * @param cls closure, NULL 2232 * @param cls closure, NULL
2245 * @param tunnel connection to the other end 2233 * @param tunnel connection to the other end
2246 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2234 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2247 * @param sender who sent the message
2248 * @param message the actual message 2235 * @param message the actual message
2249 * @param atsi performance data for the connection 2236 *
2250 * @return GNUNET_OK to keep the connection open, 2237 * @return GNUNET_OK to keep the connection open,
2251 * GNUNET_SYSERR to close it (signal serious error) 2238 * GNUNET_SYSERR to close it (signal serious error)
2252 */ 2239 */
2253static int 2240static int
2254receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2241receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2255 void **tunnel_ctx GNUNET_UNUSED, 2242 void **tunnel_ctx GNUNET_UNUSED,
2256 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 2243 const struct GNUNET_MessageHeader *message)
2257 const struct GNUNET_MessageHeader *message,
2258 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2259{ 2244{
2260 struct TunnelState *state = *tunnel_ctx; 2245 struct TunnelState *state = *tunnel_ctx;
2261 const struct GNUNET_EXIT_IcmpInternetMessage *msg; 2246 const struct GNUNET_EXIT_IcmpInternetMessage *msg;
@@ -2428,7 +2413,7 @@ receive_icmp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2428 char buf[INET6_ADDRSTRLEN]; 2413 char buf[INET6_ADDRSTRLEN];
2429 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2430 "Received ICMP data from %s for forwarding to %s\n", 2415 "Received ICMP data from %s for forwarding to %s\n",
2431 GNUNET_i2s (sender), 2416 GNUNET_i2s (&state->peer),
2432 inet_ntop (af, 2417 inet_ntop (af,
2433 &state->specifics.tcp_udp.ri.remote_address.address, 2418 &state->specifics.tcp_udp.ri.remote_address.address,
2434 buf, sizeof (buf))); 2419 buf, sizeof (buf)));
@@ -2498,18 +2483,15 @@ make_up_icmp_service_payload (struct TunnelState *state,
2498 * @param cls closure, NULL 2483 * @param cls closure, NULL
2499 * @param tunnel connection to the other end 2484 * @param tunnel connection to the other end
2500 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2485 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2501 * @param sender who sent the message
2502 * @param message the actual message 2486 * @param message the actual message
2503 * @param atsi performance data for the connection 2487 *
2504 * @return GNUNET_OK to keep the connection open, 2488 * @return GNUNET_OK to keep the connection open,
2505 * GNUNET_SYSERR to close it (signal serious error) 2489 * GNUNET_SYSERR to close it (signal serious error)
2506 */ 2490 */
2507static int 2491static int
2508receive_icmp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2492receive_icmp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2509 void **tunnel_ctx, 2493 void **tunnel_ctx,
2510 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 2494 const struct GNUNET_MessageHeader *message)
2511 const struct GNUNET_MessageHeader *message,
2512 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2513{ 2495{
2514 struct TunnelState *state = *tunnel_ctx; 2496 struct TunnelState *state = *tunnel_ctx;
2515 const struct GNUNET_EXIT_IcmpServiceMessage *msg; 2497 const struct GNUNET_EXIT_IcmpServiceMessage *msg;
@@ -2544,7 +2526,7 @@ receive_icmp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel
2544 pkt_len -= sizeof (struct GNUNET_EXIT_IcmpServiceMessage); 2526 pkt_len -= sizeof (struct GNUNET_EXIT_IcmpServiceMessage);
2545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2546 "Received data from %s for forwarding to ICMP service %s\n", 2528 "Received data from %s for forwarding to ICMP service %s\n",
2547 GNUNET_i2s (sender), 2529 GNUNET_i2s (&state->peer),
2548 GNUNET_h2s (&msg->service_descriptor)); 2530 GNUNET_h2s (&msg->service_descriptor));
2549 if (NULL == state->specifics.tcp_udp.serv) 2531 if (NULL == state->specifics.tcp_udp.serv)
2550 { 2532 {
@@ -2789,18 +2771,15 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address,
2789 * @param cls closure, NULL 2771 * @param cls closure, NULL
2790 * @param tunnel connection to the other end 2772 * @param tunnel connection to the other end
2791 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2773 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2792 * @param sender who sent the message
2793 * @param message the actual message 2774 * @param message the actual message
2794 * @param atsi performance data for the connection 2775 *
2795 * @return GNUNET_OK to keep the connection open, 2776 * @return GNUNET_OK to keep the connection open,
2796 * GNUNET_SYSERR to close it (signal serious error) 2777 * GNUNET_SYSERR to close it (signal serious error)
2797 */ 2778 */
2798static int 2779static int
2799receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2780receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2800 void **tunnel_ctx GNUNET_UNUSED, 2781 void **tunnel_ctx GNUNET_UNUSED,
2801 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 2782 const struct GNUNET_MessageHeader *message)
2802 const struct GNUNET_MessageHeader *message,
2803 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2804{ 2783{
2805 struct TunnelState *state = *tunnel_ctx; 2784 struct TunnelState *state = *tunnel_ctx;
2806 const struct GNUNET_EXIT_UdpInternetMessage *msg; 2785 const struct GNUNET_EXIT_UdpInternetMessage *msg;
@@ -2877,7 +2856,7 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2877 char buf[INET6_ADDRSTRLEN]; 2856 char buf[INET6_ADDRSTRLEN];
2878 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2879 "Received data from %s for forwarding to UDP %s:%u\n", 2858 "Received data from %s for forwarding to UDP %s:%u\n",
2880 GNUNET_i2s (sender), 2859 GNUNET_i2s (&state->peer),
2881 inet_ntop (af, 2860 inet_ntop (af,
2882 &state->specifics.tcp_udp.ri.remote_address.address, 2861 &state->specifics.tcp_udp.ri.remote_address.address,
2883 buf, sizeof (buf)), 2862 buf, sizeof (buf)),
@@ -2903,18 +2882,15 @@ receive_udp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2903 * @param cls closure, NULL 2882 * @param cls closure, NULL
2904 * @param tunnel connection to the other end 2883 * @param tunnel connection to the other end
2905 * @param tunnel_ctx pointer to our 'struct TunnelState *' 2884 * @param tunnel_ctx pointer to our 'struct TunnelState *'
2906 * @param sender who sent the message
2907 * @param message the actual message 2885 * @param message the actual message
2908 * @param atsi performance data for the connection 2886 *
2909 * @return GNUNET_OK to keep the connection open, 2887 * @return GNUNET_OK to keep the connection open,
2910 * GNUNET_SYSERR to close it (signal serious error) 2888 * GNUNET_SYSERR to close it (signal serious error)
2911 */ 2889 */
2912static int 2890static int
2913receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2891receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2914 void **tunnel_ctx, 2892 void **tunnel_ctx,
2915 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED, 2893 const struct GNUNET_MessageHeader *message)
2916 const struct GNUNET_MessageHeader *message,
2917 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2918{ 2894{
2919 struct TunnelState *state = *tunnel_ctx; 2895 struct TunnelState *state = *tunnel_ctx;
2920 const struct GNUNET_EXIT_UdpServiceMessage *msg; 2896 const struct GNUNET_EXIT_UdpServiceMessage *msg;
@@ -2946,7 +2922,7 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2946 pkt_len -= sizeof (struct GNUNET_EXIT_UdpServiceMessage); 2922 pkt_len -= sizeof (struct GNUNET_EXIT_UdpServiceMessage);
2947 LOG (GNUNET_ERROR_TYPE_DEBUG, 2923 LOG (GNUNET_ERROR_TYPE_DEBUG,
2948 "Received data from %s for forwarding to UDP service %s on port %u\n", 2924 "Received data from %s for forwarding to UDP service %s on port %u\n",
2949 GNUNET_i2s (sender), 2925 GNUNET_i2s (&state->peer),
2950 GNUNET_h2s (&msg->service_descriptor), 2926 GNUNET_h2s (&msg->service_descriptor),
2951 (unsigned int) ntohs (msg->destination_port)); 2927 (unsigned int) ntohs (msg->destination_port));
2952 if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor, 2928 if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor,
@@ -2978,17 +2954,17 @@ receive_udp_service (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2978 * @param cls closure 2954 * @param cls closure
2979 * @param tunnel new handle to the tunnel 2955 * @param tunnel new handle to the tunnel
2980 * @param initiator peer that started the tunnel 2956 * @param initiator peer that started the tunnel
2981 * @param atsi performance information for the tunnel 2957 * @param port destination port
2982 * @return initial tunnel context for the tunnel 2958 * @return initial tunnel context for the tunnel
2983 */ 2959 */
2984static void * 2960static void *
2985new_tunnel (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 2961new_tunnel (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2986 const struct GNUNET_PeerIdentity *initiator GNUNET_UNUSED, 2962 const struct GNUNET_PeerIdentity *initiator, uint32_t port)
2987 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
2988{ 2963{
2989 struct TunnelState *s = GNUNET_malloc (sizeof (struct TunnelState)); 2964 struct TunnelState *s = GNUNET_malloc (sizeof (struct TunnelState));
2990 2965
2991 s->is_dns = GNUNET_SYSERR; 2966 s->is_dns = GNUNET_SYSERR;
2967 s->peer = *initiator;
2992 GNUNET_STATISTICS_update (stats, 2968 GNUNET_STATISTICS_update (stats,
2993 gettext_noop ("# Inbound MESH tunnels created"), 2969 gettext_noop ("# Inbound MESH tunnels created"),
2994 1, GNUNET_NO); 2970 1, GNUNET_NO);
@@ -3338,7 +3314,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3338 {NULL, 0, 0} 3314 {NULL, 0, 0}
3339 }; 3315 };
3340 3316
3341 static GNUNET_MESH_ApplicationType apptypes[] = { 3317 static uint32_t apptypes[] = {
3342 GNUNET_APPLICATION_TYPE_END, 3318 GNUNET_APPLICATION_TYPE_END,
3343 GNUNET_APPLICATION_TYPE_END, 3319 GNUNET_APPLICATION_TYPE_END,
3344 GNUNET_APPLICATION_TYPE_END, 3320 GNUNET_APPLICATION_TYPE_END,
@@ -3413,7 +3389,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3413 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3414 _("No useful service enabled. Exiting.\n")); 3390 _("No useful service enabled. Exiting.\n"));
3415 GNUNET_SCHEDULER_shutdown (); 3391 GNUNET_SCHEDULER_shutdown ();
3416 return; 3392 return;
3417 } 3393 }
3418 3394
3419 dns_exit = NULL; 3395 dns_exit = NULL;
@@ -3436,18 +3412,21 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3436 3412
3437 3413
3438 app_idx = 0; 3414 app_idx = 0;
3439 if (GNUNET_YES == ipv4_exit) 3415 if (GNUNET_YES == ipv4_exit)
3440 { 3416 {
3417 // FIXME use regex to put info
3441 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV4_GATEWAY; 3418 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV4_GATEWAY;
3442 app_idx++; 3419 app_idx++;
3443 } 3420 }
3444 if (GNUNET_YES == ipv6_exit) 3421 if (GNUNET_YES == ipv6_exit)
3445 { 3422 {
3423 // FIXME use regex to put info
3446 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV6_GATEWAY; 3424 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV6_GATEWAY;
3447 app_idx++; 3425 app_idx++;
3448 } 3426 }
3449 if (NULL != dns_exit) 3427 if (NULL != dns_exit)
3450 { 3428 {
3429 // FIXME use regex to put info
3451 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER; 3430 apptypes[app_idx] = GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER;
3452 app_idx++; 3431 app_idx++;
3453 } 3432 }
@@ -3568,7 +3547,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3568 = GNUNET_MESH_connect (cfg, NULL, 3547 = GNUNET_MESH_connect (cfg, NULL,
3569 &new_tunnel, 3548 &new_tunnel,
3570 &clean_tunnel, handlers, 3549 &clean_tunnel, handlers,
3571 apptypes); 3550 apptypes); // FIXME use ports
3572 if (NULL == mesh_handle) 3551 if (NULL == mesh_handle)
3573 { 3552 {
3574 GNUNET_SCHEDULER_shutdown (); 3553 GNUNET_SCHEDULER_shutdown ();