static struct TunnelState *
create_tunnel_to_destination (struct DestinationEntry *de,
struct GNUNET_SERVER_Client *client,
+ int client_af,
uint64_t request_id)
{
struct TunnelState *ts;
1, GNUNET_NO);
GNUNET_assert (NULL == de->ts);
ts = GNUNET_malloc (sizeof (struct TunnelState));
+ ts->af = client_af;
if (NULL != client)
{
ts->request_id = request_id;
ts->destination.heap_node = NULL; /* copy is NOT in destination heap */
de->ts = ts;
ts->destination_container = de; /* we are referenced from de */
- ts->af = AF_UNSPEC; /* so far, unknown */
ts->tunnel = GNUNET_MESH_tunnel_create (mesh_handle,
ts,
&tunnel_peer_connect_handler,
available) or create a fresh one */
is_new = GNUNET_YES;
if (NULL == destination->ts)
- ts = create_tunnel_to_destination (destination, NULL, 0);
+ ts = create_tunnel_to_destination (destination, NULL, af, 0);
else
ts = destination->ts;
if (NULL == ts)
void *addr;
struct DestinationEntry *de;
GNUNET_HashCode key;
+ struct TunnelState *ts;
/* validate and parse request */
mlen = ntohs (message->size);
1, GNUNET_NO);
while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings)
expire_destination (de);
-
+
/* setup tunnel to destination */
- (void) create_tunnel_to_destination (de,
- (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
- msg->request_id);
+ ts = create_tunnel_to_destination (de,
+ (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
+ result_af,
+ msg->request_id);
+ switch (result_af)
+ {
+ case AF_INET:
+ ts->destination_ip.v4 = v4;
+ break;
+ case AF_INET6:
+ ts->destination_ip.v6 = v6;
+ break;
+ default:
+ GNUNET_assert (0);
+ }
/* we're done */
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
void *addr;
struct DestinationEntry *de;
GNUNET_HashCode key;
+ struct TunnelState *ts;
/* parse request */
msg = (const struct RedirectToServiceRequestMessage *) message;
GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value);
while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings)
expire_destination (de);
- (void) create_tunnel_to_destination (de,
- (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
- msg->request_id);
+ ts = create_tunnel_to_destination (de,
+ (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
+ result_af,
+ msg->request_id);
+ switch (result_af)
+ {
+ case AF_INET:
+ ts->destination_ip.v4 = v4;
+ break;
+ case AF_INET6:
+ ts->destination_ip.v6 = v6;
+ break;
+ default:
+ GNUNET_assert (0);
+ }
/* we're done */
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}