aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r--src/transport/plugin_transport_wlan.c78
1 files changed, 45 insertions, 33 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 8a4201863..d3c7d2150 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1992,7 +1992,7 @@ wlan_plugin_helper_read (void *cls,
1992 * @return GNUNET_YES if process was started, GNUNET_SYSERR on error 1992 * @return GNUNET_YES if process was started, GNUNET_SYSERR on error
1993 */ 1993 */
1994static int 1994static int
1995wlan_transport_start_wlan_helper(struct Plugin *plugin) 1995wlan_transport_start_wlan_helper(struct Plugin *plugin, int testmode)
1996{ 1996{
1997 1997
1998 plugin->server_stdout = GNUNET_DISK_pipe(GNUNET_YES, GNUNET_NO, GNUNET_YES); 1998 plugin->server_stdout = GNUNET_DISK_pipe(GNUNET_YES, GNUNET_NO, GNUNET_YES);
@@ -2010,7 +2010,7 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin)
2010 /* Start the server process */ 2010 /* Start the server process */
2011 plugin->server_proc = GNUNET_OS_start_process(plugin->server_stdin, 2011 plugin->server_proc = GNUNET_OS_start_process(plugin->server_stdin,
2012 plugin->server_stdout, "gnunet-transport-wlan-helper", 2012 plugin->server_stdout, "gnunet-transport-wlan-helper",
2013 "gnunet-transport-wlan-helper", plugin->interface, NULL); 2013 plugin->interface, testmode, NULL);
2014 if (plugin->server_proc == NULL) 2014 if (plugin->server_proc == NULL)
2015 { 2015 {
2016#if DEBUG_wlan 2016#if DEBUG_wlan
@@ -2038,6 +2038,27 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin)
2038} 2038}
2039 2039
2040 2040
2041/**
2042 * Exit point from the plugin.
2043 */
2044//TODO doxigen
2045//FIXME cleanup
2046void *
2047libgnunet_plugin_transport_wlan_done (void *cls)
2048{
2049 struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
2050 struct Plugin *plugin = api->cls;
2051
2052 GNUNET_assert(cls !=NULL);
2053
2054 if (plugin->consoltoken != NULL)
2055 GNUNET_SERVER_mst_destroy(plugin->consoltoken);
2056
2057 GNUNET_free_non_null(plugin->interface);
2058 GNUNET_free (plugin);
2059 GNUNET_free (api);
2060 return NULL;
2061}
2041 2062
2042/** 2063/**
2043 * Entry point for the plugin. 2064 * Entry point for the plugin.
@@ -2048,21 +2069,15 @@ wlan_transport_start_wlan_helper(struct Plugin *plugin)
2048void * 2069void *
2049libgnunet_plugin_transport_wlan_init (void *cls) 2070libgnunet_plugin_transport_wlan_init (void *cls)
2050{ 2071{
2051 struct GNUNET_SERVICE_Context *service; 2072 //struct GNUNET_SERVICE_Context *service;
2052 struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; 2073 struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
2053 struct GNUNET_TRANSPORT_PluginFunctions *api; 2074 struct GNUNET_TRANSPORT_PluginFunctions *api;
2054 struct Plugin *plugin; 2075 struct Plugin *plugin;
2076 int testmode;
2055 2077
2056 GNUNET_assert(cls !=NULL); 2078 GNUNET_assert(cls !=NULL);
2057 2079
2058 service = GNUNET_SERVICE_start ("transport-wlan", env->cfg); 2080 fprintf(stderr,"HERE");
2059 if (service == NULL){
2060 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2061 _("Failed to start service for `%s' transport plugin.\n"),
2062 "wlan");
2063 return NULL;
2064 }
2065
2066 plugin = GNUNET_malloc (sizeof (struct Plugin)); 2081 plugin = GNUNET_malloc (sizeof (struct Plugin));
2067 plugin->env = env; 2082 plugin->env = env;
2068 plugin->pendingsessions = 0; 2083 plugin->pendingsessions = 0;
@@ -2071,7 +2086,25 @@ libgnunet_plugin_transport_wlan_init (void *cls)
2071 plugin->server_read_task = GNUNET_SCHEDULER_NO_TASK; 2086 plugin->server_read_task = GNUNET_SCHEDULER_NO_TASK;
2072 plugin->server_write_delay_task = GNUNET_SCHEDULER_NO_TASK; 2087 plugin->server_write_delay_task = GNUNET_SCHEDULER_NO_TASK;
2073 2088
2074 wlan_transport_start_wlan_helper(plugin); 2089 testmode = GNUNET_NO;
2090 if (GNUNET_CONFIGURATION_have_value (env->cfg,
2091 "transport-wlan", "TESTMODE"))
2092 {
2093 testmode = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2094 "transport-wlan","TESTMODE");
2095 }
2096
2097 if (GNUNET_CONFIGURATION_have_value (env->cfg,
2098 "transport-wlan", "INTERFACE"))
2099 {
2100 if (GNUNET_CONFIGURATION_get_value_string (env->cfg,
2101 "transport-wlan","INTERFACE", &(plugin->interface)) != GNUNET_YES){
2102 libgnunet_plugin_transport_wlan_done(plugin);
2103 return NULL;
2104 }
2105 }
2106
2107 wlan_transport_start_wlan_helper(plugin, testmode);
2075 plugin->consoltoken = GNUNET_SERVER_mst_create(&wlan_process_helper,plugin); 2108 plugin->consoltoken = GNUNET_SERVER_mst_create(&wlan_process_helper,plugin);
2076 2109
2077 //plugin->sessions = GNUNET_malloc (sizeof (struct Sessionqueue)); 2110 //plugin->sessions = GNUNET_malloc (sizeof (struct Sessionqueue));
@@ -2091,25 +2124,4 @@ libgnunet_plugin_transport_wlan_init (void *cls)
2091 return api; 2124 return api;
2092} 2125}
2093 2126
2094
2095/**
2096 * Exit point from the plugin.
2097 */
2098//TODO doxigen
2099//FIXME cleanup
2100void *
2101libgnunet_plugin_transport_wlan_done (void *cls)
2102{
2103 struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
2104 struct Plugin *plugin = api->cls;
2105
2106 GNUNET_assert(cls !=NULL);
2107
2108 GNUNET_SERVER_mst_destroy(plugin->consoltoken);
2109
2110 GNUNET_free (plugin);
2111 GNUNET_free (api);
2112 return NULL;
2113}
2114
2115/* end of plugin_transport_wlan.c */ 2127/* end of plugin_transport_wlan.c */