#include "gnunet_protocols.h"
#include "gnunet_resolver_service.h"
#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
-#include "plugin_transport.h"
+#include "gnunet_transport_plugin.h"
#include "transport.h"
#define DEBUG_UDP GNUNET_YES
*/
struct GNUNET_TRANSPORT_PluginEnvironment *env;
- /**
- * Handle to the network service.
- */
- struct GNUNET_SERVICE_Context *service;
-
/*
* Session of peers with whom we are currently connected
*/
#endif
/* Start the server process */
- proc = GNUNET_OS_start_process(NULL, NULL, "gnunet-nat-client", "gnunet-nat-client", plugin->external_address, address_as_string, port_as_string, NULL);
+ proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-nat-client", "gnunet-nat-client", plugin->external_address, address_as_string, port_as_string, NULL);
GNUNET_free(address_as_string);
GNUNET_free(port_as_string);
- GNUNET_OS_process_wait (proc);
- GNUNET_OS_process_close (proc);
- proc = NULL;
+ if (proc != NULL)
+ {
+ GNUNET_OS_process_wait (proc);
+ GNUNET_OS_process_close (proc);
+ proc = NULL;
+ }
}
/**
unsigned long long port;
struct GNUNET_TRANSPORT_PluginFunctions *api;
struct Plugin *plugin;
- struct GNUNET_SERVICE_Context *service;
int sockets_created;
int behind_nat;
int allow_nat;
char *external_address;
struct IPv4UdpAddress v4_address;
- service = GNUNET_SERVICE_start ("transport-udp", env->cfg);
- if (service == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _
- ("Failed to start service for `%s' transport plugin.\n"),
- "udp");
- return NULL;
- }
-
if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
"transport-udp",
"BEHIND_NAT"))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Require EXTERNAL_ADDRESS for service `%s' in configuration (either BEHIND_NAT or ALLOW_NAT set to YES)!\n"),
"transport-udp");
- GNUNET_SERVICE_stop (service);
return NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Require INTERNAL_ADDRESS for service `%s' in configuration!\n"),
"transport-udp");
- GNUNET_SERVICE_stop (service);
GNUNET_free_non_null(external_address);
return NULL;
}
"PORT",
port,
65535);
- GNUNET_SERVICE_stop (service);
GNUNET_free_non_null(external_address);
GNUNET_free_non_null(internal_address);
return NULL;
api->address_to_string = &udp_address_to_string;
api->check_address = &udp_check_address;
- plugin->service = service;
-
- GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-udp", "BINDTO", &plugin->bind_address);
-
- GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-udp", "BINDTO6", &plugin->bind6_address);
+ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-udp", "BINDTO", &plugin->bind_address))
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Binding udp plugin to specific address: `%s'\n", plugin->bind_address);
+ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-udp", "BINDTO6", &plugin->bind6_address))
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Binding udp plugin to specific address: `%s'\n", plugin->bind6_address);
if (plugin->behind_nat == GNUNET_NO)
{
plugin->hostname_dns = NULL;
}
- GNUNET_SERVICE_stop (plugin->service);
-
GNUNET_NETWORK_fdset_destroy (plugin->rs);
while (NULL != (lal = plugin->lal_head))
{