diff options
author | Philipp Tölke <toelke@in.tum.de> | 2011-01-10 21:41:47 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2011-01-10 21:41:47 +0000 |
commit | 0a6ec77c1fa98c3c3b7bd5ea4cc6a4f645138354 (patch) | |
tree | d8d4d1efb6056f54dc76f20a674f5e4c22603618 /src/vpn/gnunet-daemon-vpn-helper.c | |
parent | 02530f44ebadfe7c7758cdbad94d7fcddf28827f (diff) | |
download | gnunet-0a6ec77c1fa98c3c3b7bd5ea4cc6a4f645138354.tar.gz gnunet-0a6ec77c1fa98c3c3b7bd5ea4cc6a4f645138354.zip |
let -vpn and -exit use mesh instead of core
Diffstat (limited to 'src/vpn/gnunet-daemon-vpn-helper.c')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 8c4eb593d..880a53b81 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <gnunet_common.h> | 27 | #include <gnunet_common.h> |
28 | #include <gnunet_client_lib.h> | 28 | #include <gnunet_client_lib.h> |
29 | #include <gnunet_os_lib.h> | 29 | #include <gnunet_os_lib.h> |
30 | #include <gnunet_core_service.h> | 30 | #include <gnunet_mesh_service.h> |
31 | #include <gnunet_protocols.h> | 31 | #include <gnunet_protocols.h> |
32 | #include <gnunet_server_lib.h> | 32 | #include <gnunet_server_lib.h> |
33 | #include <gnunet_container_lib.h> | 33 | #include <gnunet_container_lib.h> |
@@ -243,18 +243,28 @@ message_token(void *cls, | |||
243 | (port_in_ports(me->desc.ports, pkt6_udp->udp_hdr.dpt) || | 243 | (port_in_ports(me->desc.ports, pkt6_udp->udp_hdr.dpt) || |
244 | port_in_ports(me->additional_ports, pkt6_udp->udp_hdr.dpt))) | 244 | port_in_ports(me->additional_ports, pkt6_udp->udp_hdr.dpt))) |
245 | { | 245 | { |
246 | size_t size = sizeof(struct GNUNET_PeerIdentity) + sizeof(struct GNUNET_MessageHeader) + sizeof(GNUNET_HashCode) + ntohs(pkt6_udp->udp_hdr.len); | 246 | size_t size = sizeof(struct GNUNET_MESH_Tunnel*) + sizeof(struct GNUNET_MessageHeader) + sizeof(GNUNET_HashCode) + ntohs(pkt6_udp->udp_hdr.len); |
247 | struct GNUNET_PeerIdentity *cls = GNUNET_malloc(size); | 247 | struct GNUNET_MESH_Tunnel **cls = GNUNET_malloc(size); |
248 | struct GNUNET_MessageHeader *hdr = (struct GNUNET_MessageHeader*)(cls+1); | 248 | struct GNUNET_MessageHeader *hdr = (struct GNUNET_MessageHeader*)(cls+1); |
249 | GNUNET_HashCode* hc = (GNUNET_HashCode*)(hdr + 1); | 249 | GNUNET_HashCode* hc = (GNUNET_HashCode*)(hdr + 1); |
250 | memcpy(cls, &me->desc.peer, sizeof(struct GNUNET_PeerIdentity)); | 250 | |
251 | memcpy(hc, &me->desc.service_descriptor, sizeof(GNUNET_HashCode)); | 251 | memcpy(hc, &me->desc.service_descriptor, sizeof(GNUNET_HashCode)); |
252 | memcpy(hc+1, &pkt6_udp->udp_hdr, ntohs(pkt6_udp->udp_hdr.len)); | 252 | memcpy(hc+1, &pkt6_udp->udp_hdr, ntohs(pkt6_udp->udp_hdr.len)); |
253 | GNUNET_CORE_peer_request_connect(core_handle, | 253 | |
254 | GNUNET_TIME_UNIT_FOREVER_REL, | 254 | if (me->tunnel == NULL) |
255 | (struct GNUNET_PeerIdentity*)&me->desc.peer, | 255 | { |
256 | send_udp_to_peer, | 256 | *cls = GNUNET_MESH_peer_request_connect_all(mesh_handle, |
257 | cls); | 257 | GNUNET_TIME_UNIT_FOREVER_REL, |
258 | 1, | ||
259 | (struct GNUNET_PeerIdentity*)&me->desc.peer, | ||
260 | send_udp_to_peer, | ||
261 | NULL, | ||
262 | cls); | ||
263 | me->tunnel = *cls; | ||
264 | } | ||
265 | else | ||
266 | *cls = me->tunnel; | ||
267 | //FIXME: somehow call send_udp_to_peer | ||
258 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Queued to send to peer %x\n", *((unsigned int*)&me->desc.peer)); | 268 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Queued to send to peer %x\n", *((unsigned int*)&me->desc.peer)); |
259 | } | 269 | } |
260 | } | 270 | } |