char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
struct GNUNET_HashCode desc;
- GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc);
+ GNUNET_TUN_service_name_to_hash (name, &desc);
service->name = GNUNET_strdup (name);
memcpy (&key[0], &destination_port, sizeof (uint16_t));
memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
GNUNET_i2s (&state->peer),
GNUNET_h2s (&start->service_descriptor),
(unsigned int) ntohs (start->tcp_header.destination_port));
- if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor,
- ntohs (start->tcp_header.destination_port))))
+ if (NULL == (state->specifics.tcp_udp.serv =
+ find_service (tcp_services,
+ &start->service_descriptor,
+ ntohs (start->tcp_header.destination_port))))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("No service found for %s on port %d!\n"),
+ _("No service %s found for %s on port %d!\n"),
+ GNUNET_h2s (&start->service_descriptor),
"TCP",
ntohs (start->tcp_header.destination_port));
GNUNET_STATISTICS_update (stats,
GNUNET_i2s (&state->peer),
GNUNET_h2s (&msg->service_descriptor),
(unsigned int) ntohs (msg->destination_port));
- if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor,
- ntohs (msg->destination_port))))
+ if (NULL == (state->specifics.tcp_udp.serv =
+ find_service (udp_services,
+ &msg->service_descriptor,
+ ntohs (msg->destination_port))))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("No service found for %s on port %d!\n"),
+ _("No service %s found for %s on port %d!\n"),
+ GNUNET_h2s (&msg->service_descriptor),
"UDP",
ntohs (msg->destination_port));
GNUNET_STATISTICS_update (stats,
* @param channel new handle to the channel
* @param initiator peer that started the channel
* @param port destination port
+ * @param options channel options flags
* @return initial channel context for the channel
*/
static void *
new_channel (void *cls,
struct GNUNET_MESH_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port)
+ uint32_t port, enum GNUNET_MESH_ChannelOption options)
{
struct ChannelState *s = GNUNET_new (struct ChannelState);
char *hostname;
char *hostport;
struct LocalService *serv;
+ char *n;
+ size_t slen;
+
+ slen = strlen (name);
+ GNUNET_assert (slen >= 8);
+ n = GNUNET_strndup (name, slen - 8 /* remove .gnunet. */);
for (redirect = strtok (cpy, " "); redirect != NULL;
redirect = strtok (NULL, " "))
if (NULL == (hostname = strstr (redirect, ":")))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "option `%s' for domain `%s' is not formatted correctly!\n",
+ _("Option `%s' for domain `%s' is not formatted correctly!\n"),
redirect,
name);
continue;
if (NULL == (hostport = strstr (hostname, ":")))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "option `%s' for domain `%s' is not formatted correctly!\n",
- redirect,
- name);
+ _("Option `%s' for domain `%s' is not formatted correctly!\n"),
+ redirect,
+ name);
continue;
}
hostport[0] = '\0';
if (!((local_port > 0) && (local_port < 65536)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "`%s' is not a valid port number (for domain `%s')!", redirect,
- name);
+ _("`%s' is not a valid port number (for domain `%s')!"),
+ redirect,
+ name);
continue;
}
if (!((remote_port > 0) && (remote_port < 65536)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "`%s' is not a valid port number (for domain `%s')!", hostport,
+ _("`%s' is not a valid port number (for domain `%s')!"),
+ hostport,
name);
continue;
}
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("No addresses found for hostname `%s' of service `%s'!\n"),
hostname,
- name);
+ n);
GNUNET_free (serv);
continue;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Service `%s' configured for IPv4, but IPv4 is disabled!\n"),
- name);
+ n);
freeaddrinfo (res);
GNUNET_free (serv);
continue;
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Service `%s' configured for IPv4, but IPv4 is disabled!\n"),
- name);
+ n);
freeaddrinfo (res);
GNUNET_free (serv);
continue;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("No IP addresses found for hostname `%s' of service `%s'!\n"),
hostname,
- name);
+ n);
GNUNET_free (serv);
continue;
}
freeaddrinfo (res);
}
store_service ((IPPROTO_UDP == proto) ? udp_services : tcp_services,
- name,
+ n,
local_port,
serv);
}
+ GNUNET_free (n);
}
dns_exit = NULL;
if ( (GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_yesno (cfg_, "exit", "ENABLE_DNS")) &&
+ GNUNET_CONFIGURATION_get_value_yesno (cfg_, "exit", "EXIT_DNS")) &&
( (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, "exit",
"DNS_RESOLVER",
GNUNET_free_non_null (dns_exit);
dns_exit = NULL;
}
- if (NULL != dns_exit)
- dnsstub = GNUNET_DNSSTUB_start (dns_exit);
-
-
app_idx = 0;
if (GNUNET_YES == ipv4_exit)
{
- // FIXME use regex to put info
apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV4_GATEWAY;
app_idx++;
}
if (GNUNET_YES == ipv6_exit)
{
- // FIXME use regex to put info
apptypes[app_idx] = GNUNET_APPLICATION_TYPE_IPV6_GATEWAY;
app_idx++;
}
connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO);
connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
+ if (0 == app_idx)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("No useful service enabled. Exiting.\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
mesh_handle
= GNUNET_MESH_connect (cfg, NULL,
&new_channel,
&clean_channel, handlers,
- apptypes); // FIXME use ports
+ apptypes);
if (NULL == mesh_handle)
{
GNUNET_SCHEDULER_shutdown ();