From b4791cc5e8b3dc388883222f1d8fe561b7ca4bc3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 23 Mar 2012 08:39:18 +0000 Subject: -using cleaner message types for WLAN-HELPER IPC --- src/transport/gnunet-helper-transport-wlan-dummy.c | 10 ++-------- src/transport/gnunet-helper-transport-wlan.c | 4 ++-- src/transport/gnunet-transport-wlan-sender.c | 2 +- src/transport/plugin_transport_wlan.c | 8 ++++---- src/transport/plugin_transport_wlan.h | 4 ++-- 5 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src/transport') diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c index cd545af65..86e5d4684 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 0169a2da1..3b5e0b1ab 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 a6280bc7d..daa8f0269 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 0c60bd68c..13f414f30 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 96aa434ee..2b70fc0f5 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; -- cgit v1.2.3