aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-23 08:39:18 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-23 08:39:18 +0000
commitb4791cc5e8b3dc388883222f1d8fe561b7ca4bc3 (patch)
tree1044ca0853ad9b4724b6bf061a14f52498b2d00f
parentf289a44d046c3f7eae60944d85a1c928fc030c3d (diff)
-using cleaner message types for WLAN-HELPER IPC
-rw-r--r--src/fs/fs_uri.c5
-rw-r--r--src/include/gnunet_protocols.h12
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c10
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c4
-rw-r--r--src/transport/gnunet-transport-wlan-sender.c2
-rw-r--r--src/transport/plugin_transport_wlan.c8
-rw-r--r--src/transport/plugin_transport_wlan.h4
7 files changed, 21 insertions, 24 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index db9b7d1669..b5b4e1299c 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -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);
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 06fd777e6d..9c8824a4ae 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -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
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index cd545af65d..86e5d4684e 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -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");
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index 0169a2da11..3b5e0b1aba 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -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);
}
}
}
diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c
index a6280bc7d8..daa8f02697 100644
--- a/src/transport/gnunet-transport-wlan-sender.c
+++ b/src/transport/gnunet-transport-wlan-sender.c
@@ -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;
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 0c60bd68c7..13f414f300 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -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))
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index 96aa434eed..2b70fc0f5c 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -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;