Check that you are not present in trail twice
[oweals/gnunet.git] / src / transport / plugin_transport_wlan.c
index c78cfc9e170c9e739bf41e48b79da014443f5fe6..0d72c1e0f3fad7147ace95c1eb73b1428470b979 100644 (file)
@@ -1,6 +1,6 @@
 /*
   This file is part of GNUnet
-  (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
+  (C) 2010-2014 Christian Grothoff (and other contributing authors)
 
   GNUnet is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published
 
 /**
  * @file transport/plugin_transport_wlan.c
- * @brief transport plugin for wlan
+ * @brief transport plugin for wlan and/or bluetooth
  * @author David Brodski
  * @author Christian Grothoff
+ *
+ * BUILD_WLAN or BUILD_BLUETOOTH must be defined such that the respective
+ * variant of this code is compiled.
  */
 #include "platform.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_util_lib.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet_transport_service.h"
 #include "gnunet_transport_plugin.h"
 #include "plugin_transport_wlan.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
 #include "gnunet_fragmentation_lib.h"
 #include "gnunet_constants.h"
 
+#if BUILD_WLAN
+/* begin case wlan */
+#define PLUGIN_NAME "wlan"
+#define CONFIG_NAME "transport-wlan"
+#define HELPER_NAME "gnunet-helper-transport-wlan"
+#define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
+#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_wlan_init
+#define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_wlan_done
 #define LOG(kind,...) GNUNET_log_from (kind, "transport-wlan",__VA_ARGS__)
 
-#define PLUGIN_NAME "wlan"
+/**
+ * time out of a mac endpoint
+ */
+#define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2)
 
 /**
- * Max size of packet (that we give to the WLAN driver for transmission)
+ * We reduce the frequence of HELLO beacons in relation to
+ * the number of MAC addresses currently visible to us.
+ * This is the multiplication factor.
  */
-#define WLAN_MTU 1430
+#define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
+
+
+/* end case wlan */
+#elif BUILD_BLUETOOTH
+/* begin case bluetooth */
+
+#define PLUGIN_NAME "bluetooth"
+#define CONFIG_NAME "transport-bluetooth"
+#define HELPER_NAME "gnunet-helper-transport-bluetooth"
+/* yes, this is correct, we use the same dummy driver as 'wlan' */
+#define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
+#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_bluetooth_init
+#define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_bluetooth_done
+#define LOG(kind,...) GNUNET_log_from (kind, "transport-bluetooth",__VA_ARGS__)
 
 /**
  * time out of a mac endpoint
  */
-#define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2)
+#define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 60)
+
 
 /**
  * We reduce the frequence of HELLO beacons in relation to
  * the number of MAC addresses currently visible to us.
  * This is the multiplication factor.
  */
-#define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
+#define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+
+/* end case bluetooth */
+#else
+#error need to build wlan or bluetooth
+#endif
+
+/**
+ * Max size of packet (that we give to the WLAN driver for transmission)
+ */
+#define WLAN_MTU 1430
+
+
 
 /**
  * Maximum number of messages in defragmentation queue per MAC
@@ -412,7 +453,7 @@ struct Plugin
   /**
    * The interface of the wlan card given to us by the user.
    */
-  char *interface;
+  char *wlan_interface;
 
   /**
    * Tokenizer for demultiplexing of data packets resulting from
@@ -661,7 +702,6 @@ send_ack (void *cls, uint32_t msg_id,
     GNUNET_break (0);
     return;
   }
-
   if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
@@ -682,7 +722,7 @@ send_ack (void *cls, uint32_t msg_id,
                          GNUNET_NO /* dropping ACKs is bad */,
                          NULL, NULL))
     GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              _("# WLAN ACKs sent"),
+                              _("# ACKs sent"),
                              1, GNUNET_NO);
 }
 
@@ -702,7 +742,7 @@ wlan_data_message_handler (void *cls,
   struct MacAndSession mas;
 
   GNUNET_STATISTICS_update (plugin->env->stats,
-                           _("# WLAN messages defragmented"),
+                           _("# Messages defragmented"),
                             1,
                            GNUNET_NO);
   mas.session = NULL;
@@ -731,6 +771,9 @@ wlan_plugin_disconnect_session (void *cls,
   plugin->env->session_end (plugin->env->cls,
                             session->address,
                             session);
+  notify_session_monitor (plugin,
+                          session,
+                          GNUNET_TRANSPORT_SS_DOWN);
   GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head,
                               endpoint->sessions_tail,
                                session);
@@ -740,7 +783,7 @@ wlan_plugin_disconnect_session (void *cls,
     session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   }
   GNUNET_STATISTICS_update (plugin->env->stats,
-                            _("# WLAN sessions allocated"),
+                            _("# Sessions allocated"),
                             -1,
                             GNUNET_NO);
   GNUNET_HELLO_address_free (session->address);
@@ -768,7 +811,7 @@ wlan_plugin_query_keepalive_factor (void *cls)
  * A session is timing out.  Clean up.
  *
  * @param cls pointer to the Session
- * @param tc pointer to the GNUNET_SCHEDULER_TaskContext
+ * @param tc unused
  */
 static void
 session_timeout (void *cls,
@@ -827,7 +870,7 @@ create_session (struct MacEndpoint *endpoint,
   struct Session *session;
 
   GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                            _("# WLAN sessions allocated"),
+                            _("# Sessions allocated"),
                             1,
                             GNUNET_NO);
   session = GNUNET_new (struct Session);
@@ -845,6 +888,9 @@ create_session (struct MacEndpoint *endpoint,
   session->timeout_task =
       GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout,
                                     session);
+  notify_session_monitor (endpoint->plugin,
+                          session,
+                          GNUNET_TRANSPORT_SS_UP);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Created new session %p for peer `%s' with endpoint %s\n",
        session,
@@ -913,10 +959,9 @@ transmit_fragment (void *cls,
 
   if (NULL == endpoint)
   {
-       GNUNET_break (0);
-       return;
+    GNUNET_break (0);
+    return;
   }
-
   msize = ntohs (hdr->size);
   size = sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) + msize;
   {
@@ -938,16 +983,16 @@ transmit_fragment (void *cls,
     fm->size_on_wire += size;
     if (NULL != fm->sh)
       GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                                _("# WLAN message fragments sent"),
+                                _("# message fragments sent"),
                                1,
                                 GNUNET_NO);
     else
       GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext);
     GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              "# bytes currently in WLAN buffers",
+                              "# bytes currently in buffers",
                               -msize, GNUNET_NO);
     GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              "# bytes transmitted via WLAN",
+                              "# bytes transmitted",
                               msize, GNUNET_NO);
   }
 }
@@ -964,7 +1009,7 @@ free_fragment_message (struct FragmentMessage *fm)
   struct MacEndpoint *endpoint = fm->macendpoint;
 
   GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                            _("# WLAN messages pending (with fragmentation)"),
+                            _("# messages pending (with fragmentation)"),
                            -1, GNUNET_NO);
   GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head,
                                endpoint->sending_messages_tail,
@@ -1044,13 +1089,13 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
   fm->macendpoint = endpoint;
   fm->target = *target;
   fm->size_payload = payload_size;
-  fm->size_on_wire = 0;
   fm->timeout = GNUNET_TIME_relative_to_absolute (timeout);
   fm->cont = cont;
   fm->cont_cls = cont_cls;
   /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */
   fm->fragcontext =
-    GNUNET_FRAGMENT_context_create (plugin->env->stats, WLAN_MTU,
+    GNUNET_FRAGMENT_context_create (plugin->env->stats,
+                                    WLAN_MTU,
                                    &plugin->tracker,
                                    endpoint->msg_delay,
                                    endpoint->ack_delay,
@@ -1078,7 +1123,7 @@ free_macendpoint (struct MacEndpoint *endpoint)
   struct Session *session;
 
   GNUNET_STATISTICS_update (plugin->env->stats,
-                           _("# WLAN MAC endpoints allocated"),
+                           _("# MAC endpoints allocated"),
                             -1,
                             GNUNET_NO);
   while (NULL != (session = endpoint->sessions_head))
@@ -1147,21 +1192,14 @@ create_macendpoint (struct Plugin *plugin,
   struct MacEndpoint *pos;
 
   for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
-  {
     if (0 == memcmp (mac, &pos->wlan_addr, sizeof (pos->wlan_addr)))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing MAC endpoint `%s'\n",
-        wlan_plugin_address_to_string (NULL,
-                                       &pos->wlan_addr.mac,
-                                       sizeof (pos->wlan_addr)));
       return pos;
-    }
-  }
   pos = GNUNET_new (struct MacEndpoint);
   pos->wlan_addr = (*mac);
   pos->plugin = plugin;
   pos->defrag =
-    GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU,
+    GNUNET_DEFRAGMENT_context_create (plugin->env->stats,
+                                      WLAN_MTU,
                                      MESSAGES_IN_DEFRAG_QUEUE_PER_MAC,
                                      pos,
                                      &wlan_data_message_handler,
@@ -1178,7 +1216,7 @@ create_macendpoint (struct Plugin *plugin,
                                pos);
   plugin->mac_count++;
   GNUNET_STATISTICS_update (plugin->env->stats,
-                            _("# WLAN MAC endpoints allocated"),
+                            _("# MAC endpoints allocated"),
                            1, GNUNET_NO);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "New MAC endpoint `%s'\n",
@@ -1200,7 +1238,11 @@ static enum GNUNET_ATS_Network_Type
 wlan_plugin_get_network (void *cls,
                          struct Session *session)
 {
+#if BUILD_WLAN
   return GNUNET_ATS_NET_WLAN;
+#else
+  return GNUNET_ATS_NET_BT;
+#endif
 }
 
 
@@ -1232,7 +1274,8 @@ wlan_plugin_get_session (void *cls,
        wlan_plugin_address_to_string (NULL,
                                       address->address,
                                       address->address_length));
-  endpoint = create_macendpoint (plugin, (struct WlanAddress *) address->address);
+  endpoint = create_macendpoint (plugin,
+                                 (struct WlanAddress *) address->address);
   return get_session (endpoint, &address->peer);
 }
 
@@ -1319,8 +1362,9 @@ wlan_plugin_send (void *cls,
   memcpy (&wlanheader[1], msgbuf, msgbuf_size);
 
   GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes currently in WLAN buffers",
-                            msgbuf_size, GNUNET_NO);
+                            "# bytes currently in buffers",
+                            msgbuf_size,
+                            GNUNET_NO);
 
   send_with_fragmentation (session->mac,
                           to,
@@ -1357,11 +1401,15 @@ process_data (void *cls,
   uint16_t msize;
 
   ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
+#if BUILD_WLAN
   ats.value = htonl (GNUNET_ATS_NET_WLAN);
+#else
+  ats.value = htonl (GNUNET_ATS_NET_BT);
+#endif
   msize = ntohs (hdr->size);
 
   GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes received via WLAN",
+                            "# bytes received",
                             msize, GNUNET_NO);
 
   switch (ntohs (hdr->type))
@@ -1390,16 +1438,21 @@ process_data (void *cls,
                                         sizeof (mas->endpoint->wlan_addr)));
 
     GNUNET_STATISTICS_update (plugin->env->stats,
-                             _("# HELLO messages received via WLAN"), 1,
+                             _("# HELLO messages received"), 1,
                              GNUNET_NO);
-
-    address = GNUNET_HELLO_address_allocate (&tmpsource, PLUGIN_NAME,
-        &mas->endpoint->wlan_addr, sizeof (mas->endpoint->wlan_addr),
-        GNUNET_HELLO_ADDRESS_INFO_INBOUND);
+    address = GNUNET_HELLO_address_allocate (&tmpsource,
+                                             PLUGIN_NAME,
+                                             &mas->endpoint->wlan_addr,
+                                             sizeof (mas->endpoint->wlan_addr),
+                                             GNUNET_HELLO_ADDRESS_INFO_INBOUND);
     plugin->env->receive (plugin->env->cls,
-        address, mas->session, hdr);
+                          address,
+                          mas->session,
+                          hdr);
     plugin->env->update_address_metrics (plugin->env->cls,
-        address, mas->session, &ats, 1);
+                                         address,
+                                         mas->session,
+                                         &ats, 1);
     GNUNET_HELLO_address_free (address);
     break;
   case GNUNET_MESSAGE_TYPE_FRAGMENT:
@@ -1415,7 +1468,7 @@ process_data (void *cls,
                                         &mas->endpoint->wlan_addr,
                                         sizeof (mas->endpoint->wlan_addr)));
     GNUNET_STATISTICS_update (plugin->env->stats,
-                              _("# fragments received via WLAN"),
+                              _("# fragments received"),
                               1,
                               GNUNET_NO);
     (void) GNUNET_DEFRAGMENT_process_fragment (mas->endpoint->defrag,
@@ -1427,7 +1480,8 @@ process_data (void *cls,
       GNUNET_break (0);
       break;
     }
-    GNUNET_STATISTICS_update (plugin->env->stats, _("# ACKs received via WLAN"),
+    GNUNET_STATISTICS_update (plugin->env->stats,
+                              _("# ACKs received"),
                              1, GNUNET_NO);
     for (fm = mas->endpoint->sending_messages_head; NULL != fm; fm = fm->next)
     {
@@ -1486,15 +1540,16 @@ process_data (void *cls,
                     sizeof (struct GNUNET_PeerIdentity)))
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG,
-          "WLAN data for `%s', not for me, ignoring\n",
+          "Data for `%s', not for me, ignoring\n",
           GNUNET_i2s (&wlanheader->target));
       break;
     }
     if (ntohl (wlanheader->crc) !=
-       GNUNET_CRYPTO_crc32_n (&wlanheader[1], msize - sizeof (struct WlanHeader)))
+       GNUNET_CRYPTO_crc32_n (&wlanheader[1],
+                               msize - sizeof (struct WlanHeader)))
     {
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               _("# WLAN DATA messages discarded due to CRC32 error"),
+                               _("# DATA messages discarded due to CRC32 error"),
                                 1,
                                GNUNET_NO);
       break;
@@ -1503,20 +1558,25 @@ process_data (void *cls,
     if (NULL == (xmas.session = lookup_session (mas->endpoint,
                                                 &wlanheader->sender)))
     {
-      xmas.session = create_session (mas->endpoint, &wlanheader->sender);
+      xmas.session = create_session (mas->endpoint,
+                                     &wlanheader->sender);
       address = GNUNET_HELLO_address_allocate (&wlanheader->sender,
                                                PLUGIN_NAME,
                                                &mas->endpoint->wlan_addr,
                                                sizeof (struct WlanAddress),
                                                GNUNET_HELLO_ADDRESS_INFO_NONE);
-      plugin->env->session_start (NULL, address, xmas.session, NULL, 0);
+      plugin->env->session_start (NULL,
+                                  address,
+                                  xmas.session,
+                                  NULL, 0);
       LOG (GNUNET_ERROR_TYPE_DEBUG,
           "Notifying transport about peer `%s''s new session %p \n",
-           GNUNET_i2s (&wlanheader->sender), xmas.session);
+           GNUNET_i2s (&wlanheader->sender),
+           xmas.session);
       GNUNET_HELLO_address_free (address);
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Processing %u bytes of WLAN DATA from peer `%s'\n",
+         "Processing %u bytes of DATA from peer `%s'\n",
         (unsigned int) msize,
         GNUNET_i2s (&wlanheader->sender));
     xmas.session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -1630,7 +1690,7 @@ handle_helper_message (void *cls, void *client,
         "Got data message from helper with %u bytes\n",
         msize);
     GNUNET_STATISTICS_update (plugin->env->stats,
-                              _("# DATA messages received via WLAN"), 1,
+                              _("# DATA messages received"), 1,
                               GNUNET_NO);
     if (msize < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage))
     {
@@ -1665,7 +1725,7 @@ handle_helper_message (void *cls, void *client,
     }
 
     GNUNET_STATISTICS_update (plugin->env->stats,
-                             _("# WLAN DATA messages processed"),
+                             _("# DATA messages processed"),
                              1, GNUNET_NO);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
         "Receiving %u bytes of data from MAC `%s'\n",
@@ -1728,7 +1788,7 @@ send_hello_beacon (void *cls,
                            GNUNET_YES /* can drop */,
                            NULL, NULL))
       GNUNET_STATISTICS_update (plugin->env->stats,
-                                _("# HELLO beacons sent via WLAN"),
+                                _("# HELLO beacons sent"),
                                1, GNUNET_NO);
   }
   plugin->beacon_task =
@@ -1830,7 +1890,7 @@ wlan_plugin_address_pretty_printer (void *cls,
  * @param cls pointer to the api struct
  */
 void *
-libgnunet_plugin_transport_wlan_done (void *cls)
+LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
 {
   struct WlanAddress wa;
   struct GNUNET_HELLO_Address *address;
@@ -1844,19 +1904,20 @@ libgnunet_plugin_transport_wlan_done (void *cls)
     GNUNET_free (api);
     return NULL;
   }
-
   if (GNUNET_YES == plugin->have_mac)
   {
     memset (&wa, 0, sizeof(wa));
     wa.options = htonl (plugin->options);
     wa.mac = plugin->mac_address;
     address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-        PLUGIN_NAME, &wa, sizeof (struct WlanAddress),
-        GNUNET_HELLO_ADDRESS_INFO_NONE);
+                                             PLUGIN_NAME,
+                                             &wa, sizeof (struct WlanAddress),
+                                             GNUNET_HELLO_ADDRESS_INFO_NONE);
 
-    plugin->env->notify_address (plugin->env->cls, GNUNET_NO, address);
+    plugin->env->notify_address (plugin->env->cls,
+                                 GNUNET_NO,
+                                 address);
     plugin->have_mac = GNUNET_NO;
-
     GNUNET_HELLO_address_free (address);
   }
 
@@ -1867,7 +1928,8 @@ libgnunet_plugin_transport_wlan_done (void *cls)
   }
   if (NULL != plugin->suid_helper)
   {
-    GNUNET_HELPER_stop (plugin->suid_helper, GNUNET_NO);
+    GNUNET_HELPER_stop (plugin->suid_helper,
+                        GNUNET_NO);
     plugin->suid_helper = NULL;
   }
   endpoint_next = plugin->mac_head;
@@ -1891,7 +1953,7 @@ libgnunet_plugin_transport_wlan_done (void *cls)
     GNUNET_SERVER_mst_destroy (plugin->helper_payload_tokenizer);
     plugin->helper_payload_tokenizer = NULL;
   }
-  GNUNET_free_non_null (plugin->interface);
+  GNUNET_free_non_null (plugin->wlan_interface);
   GNUNET_free (plugin);
   GNUNET_free (api);
   return NULL;
@@ -1923,7 +1985,7 @@ wlan_plugin_string_to_address (void *cls,
   char plugin[5];
   uint32_t options;
 
-  if ((NULL == addr) || (addrlen == 0))
+  if ((NULL == addr) || (0 == addrlen))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -1942,7 +2004,8 @@ wlan_plugin_string_to_address (void *cls,
   if (8 != SSCANF (addr,
                   "%4s.%u.%X:%X:%X:%X:%X:%X",
                   plugin, &options,
-                  &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
+                  &a[0], &a[1], &a[2],
+                   &a[3], &a[4], &a[5]))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -2007,7 +2070,7 @@ wlan_plugin_update_session_timeout (void *cls,
                                     const struct GNUNET_PeerIdentity *peer,
                                     struct Session *session)
 {
-  GNUNET_assert (session->timeout_task != GNUNET_SCHEDULER_NO_TASK);
+  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != session->timeout_task);
   session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
 }
 
@@ -2039,12 +2102,12 @@ wlan_plugin_update_inbound_delay (void *cls,
  * @return the `struct GNUNET_TRANSPORT_PluginFunctions *` or NULL on error
  */
 void *
-libgnunet_plugin_transport_wlan_init (void *cls)
+LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
 {
   struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
   struct GNUNET_TRANSPORT_PluginFunctions *api;
   struct Plugin *plugin;
-  char *interface;
+  char *wlan_interface;
   unsigned long long testmode;
   char *binary;
 
@@ -2064,47 +2127,55 @@ libgnunet_plugin_transport_wlan_init (void *cls)
   testmode = 0;
   /* check configuration */
   if ( (GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) &&
+       GNUNET_CONFIGURATION_have_value (env->cfg,
+                                         CONFIG_NAME,
+                                         "TESTMODE")) &&
        ( (GNUNET_SYSERR ==
-         GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan",
-                                                "TESTMODE", &testmode)) ||
+         GNUNET_CONFIGURATION_get_value_number (env->cfg,
+                                                 CONFIG_NAME,
+                                                "TESTMODE",
+                                                 &testmode)) ||
         (testmode > 2) ) )
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                              "transport-wlan", "TESTMODE");
+                              CONFIG_NAME,
+                               "TESTMODE");
     return NULL;
   }
-  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-transport-wlan");
+  binary = GNUNET_OS_get_libexec_binary_path (HELPER_NAME);
   if ( (0 == testmode) &&
        (GNUNET_YES !=
-        GNUNET_OS_check_helper_binary (binary, GNUNET_YES, NULL)) )
+        GNUNET_OS_check_helper_binary (binary,
+                                       GNUNET_YES,
+                                       NULL)) )
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
         _("Helper binary `%s' not SUID, cannot run WLAN transport\n"),
-        "gnunet-helper-transport-wlan");
+        HELPER_NAME);
     GNUNET_free (binary);
     return NULL;
   }
     GNUNET_free (binary);
   if (GNUNET_YES !=
       GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                             "transport-wlan",
+                                             CONFIG_NAME,
                                              "INTERFACE",
-                                             &interface))
+                                             &wlan_interface))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                              "transport-wlan", "INTERFACE");
+                              CONFIG_NAME,
+                               "INTERFACE");
     return NULL;
   }
 
   plugin = GNUNET_new (struct Plugin);
-  plugin->interface = interface;
+  plugin->wlan_interface = wlan_interface;
   plugin->env = env;
   GNUNET_STATISTICS_set (plugin->env->stats,
-                         _("# WLAN sessions allocated"),
+                         _("# sessions allocated"),
                          0, GNUNET_NO);
   GNUNET_STATISTICS_set (plugin->env->stats,
-                         _("# WLAN MAC endpoints allocated"),
+                         _("# MAC endpoints allocated"),
                          0, 0);
   GNUNET_BANDWIDTH_tracker_init (&plugin->tracker, NULL, NULL,
                                  GNUNET_BANDWIDTH_value_init (100 * 1024 *
@@ -2122,33 +2193,33 @@ libgnunet_plugin_transport_wlan_init (void *cls)
   switch ((unsigned int) testmode)
   {
   case 0: /* normal */
-    plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan";
-    plugin->helper_argv[1] = interface;
+    plugin->helper_argv[0] = (char *) HELPER_NAME;
+    plugin->helper_argv[1] = wlan_interface;
     plugin->helper_argv[2] = NULL;
     plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                              "gnunet-helper-transport-wlan",
+                                              HELPER_NAME,
                                               plugin->helper_argv,
                                               &handle_helper_message,
                                               NULL,
                                               plugin);
     break;
   case 1: /* testmode, peer 1 */
-    plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
+    plugin->helper_argv[0] = (char *) DUMMY_HELPER_NAME;
     plugin->helper_argv[1] = (char *) "1";
     plugin->helper_argv[2] = NULL;
     plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                              "gnunet-helper-transport-wlan-dummy",
+                                              DUMMY_HELPER_NAME,
                                               plugin->helper_argv,
                                               &handle_helper_message,
                                               NULL,
                                               plugin);
     break;
   case 2: /* testmode, peer 2 */
-    plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
+    plugin->helper_argv[0] = (char *) DUMMY_HELPER_NAME;
     plugin->helper_argv[1] = (char *) "2";
     plugin->helper_argv[2] = NULL;
     plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                              "gnunet-helper-transport-wlan-dummy",
+                                              DUMMY_HELPER_NAME,
                                               plugin->helper_argv,
                                               &handle_helper_message,
                                               NULL,