-using cleaner message types for WLAN-HELPER IPC
authorChristian Grothoff <christian@grothoff.org>
Fri, 23 Mar 2012 08:39:18 +0000 (08:39 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 23 Mar 2012 08:39:18 +0000 (08:39 +0000)
src/fs/fs_uri.c
src/include/gnunet_protocols.h
src/transport/gnunet-helper-transport-wlan-dummy.c
src/transport/gnunet-helper-transport-wlan.c
src/transport/gnunet-transport-wlan-sender.c
src/transport/plugin_transport_wlan.c
src/transport/plugin_transport_wlan.h

index db9b7d16699d6c0c0a7e31fa6449b6456002ed7c..b5b4e1299cbc3ef199946f7e682ee3c38a6fb90f 100644 (file)
@@ -1378,12 +1378,11 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg,
 {
   char *ret;
   char *name, *unique_name;
-  int getinfo_result;
 
   if (uri->type != sks)
     return NULL;
-  getinfo_result = GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.namespace,
-      NULL, NULL, &name, NULL);
+  (void) GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.namespace,
+                                   NULL, NULL, &name, NULL);
   unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &uri->data.sks.namespace, name, NULL);
   GNUNET_free (name);
   GNUNET_asprintf (&ret, "%s: %s", unique_name, uri->data.sks.identifier);
index 06fd777e6db359320296744073da2f9b02f20410..9c8824a4aee416a1bb3dd782d653dbf478dfc18d 100644 (file)
@@ -128,13 +128,17 @@ extern "C"
  ******************************************************************************/
 
 /**
- * Type of messages between the gnunet-wlan-helper and the daemon
- *
+ * Type of data messages from the plugin to the gnunet-wlan-helper 
  */
-#define GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA 40
+#define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39
 
 /**
- * Control messages between the gnunet-wlan-helper and the daemon
+ * Type of data messages from the gnunet-wlan-helper to the plugin
+ */
+#define GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER 40
+
+/**
+ * Control message between the gnunet-wlan-helper and the daemon (with the MAC).
  */
 #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL 41
 
index cd545af65d06561d9ac42861ff1d438ad2c636b7..86e5d4684e072d98544225b7cd59c11a175aa863 100644 (file)
@@ -82,7 +82,7 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
   struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader;
 
   in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
-  if ( (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) ||
+  if ( (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ||
        (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs (hdr->size)) )
   {
     fprintf (stderr, "Function stdin_send: wrong packet type or size\n");
@@ -96,7 +96,7 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
   }
   memset (&newheader, 0, sizeof (newheader));
   newheader.header.size = htons (payload_size + sizeof (newheader));
-  newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+  newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
   newheader.frame = in->frame;
   memcpy (write_pout->buf + write_pout->size,
          &newheader,
@@ -116,12 +116,6 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
   uint16_t sendsize;
 
   sendsize = ntohs (hdr->size);
-
-  if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type))
-  {
-    fprintf (stderr, "Function file_in_send: wrong packet type\n");
-    exit (1);
-  }
   if ((sendsize + write_std->size) > MAXLINE * 2)
   {
     fprintf (stderr, "Function file_in_send: Packet too big for buffer\n");
index 0169a2da116d5acf7f378889cf30a49f104d52cc..3b5e0b1aba5903c3cbca13f870f39440319c3251 100644 (file)
@@ -1795,7 +1795,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
   sendsize = ntohs (hdr->size);
   if ( (sendsize <
        sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) ||
-       (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) ) 
+       (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) 
   {
     fprintf (stderr, "Received malformed message\n");
     exit (1);
@@ -2039,7 +2039,7 @@ main (int argc, char *argv[])
          + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) 
          - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
         rrm->header.size = htons (write_std.size);
-        rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+        rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
       }
     }
   }
index a6280bc7d818bd0e951c47fddb54eee4113ac318..daa8f026970f60fbbe03f88713bc26ad50952dac 100644 (file)
@@ -58,7 +58,7 @@ getRadiotapHeader (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header,
                   uint16_t size)
 {
   header->header.size = htons (size);
-  header->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+  header->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER);
   header->rate = 255;
   header->tx_power = 0;
   header->antenna = 0;
index 0c60bd68c7f48fb6a52e8372cbc94797d0bcaee7..13f414f300687814e1f8f93bdd096f85c94b72fd 100644 (file)
@@ -1221,7 +1221,7 @@ getRadiotapHeader (struct Plugin *plugin, struct MacEndpoint *endpoint,
                    struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header,
                   uint16_t size)
 {
-  header->header.type = ntohs (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+  header->header.type = ntohs (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER);
   header->header.size = ntohs (size);
   if (endpoint != NULL)
   {
@@ -2778,12 +2778,12 @@ wlan_process_helper (void *cls, void *client,
   GNUNET_assert (plugin != NULL);
   switch (ntohs (hdr->type))
   {
-  case GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA:
+  case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER:
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
-                     "Func wlan_process_helper got GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA size: %u\n",
+                     "Got data message from helper with %u bytes\n",
                      ntohs (hdr->size));
     GNUNET_STATISTICS_update (plugin->env->stats,
-                              _("# wlan WLAN_HELPER_DATA received"), 1,
+                              _("# wlan data messages received"), 1,
                               GNUNET_NO);
     //call wlan_process_helper with the message inside, later with wlan: analyze signal
     if (ntohs (hdr->size) < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage))
index 96aa434eed3adeb9a50887e06e824da843e7b8e7..2b70fc0f5c1686581656309d160fd451d6f9e4ac 100644 (file)
@@ -142,7 +142,7 @@ struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage
 {
 
   /**
-   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'.
+   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER'.
    */
   struct GNUNET_MessageHeader header;
 
@@ -183,7 +183,7 @@ struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage
 {
 
   /**
-   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'.
+   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER'.
    */
   struct GNUNET_MessageHeader header;