diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-23 08:39:18 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-23 08:39:18 +0000 |
commit | b4791cc5e8b3dc388883222f1d8fe561b7ca4bc3 (patch) | |
tree | 1044ca0853ad9b4724b6bf061a14f52498b2d00f | |
parent | f289a44d046c3f7eae60944d85a1c928fc030c3d (diff) | |
download | gnunet-b4791cc5e8b3dc388883222f1d8fe561b7ca4bc3.tar.gz gnunet-b4791cc5e8b3dc388883222f1d8fe561b7ca4bc3.zip |
-using cleaner message types for WLAN-HELPER IPC
-rw-r--r-- | src/fs/fs_uri.c | 5 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 12 | ||||
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan-dummy.c | 10 | ||||
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan.c | 4 | ||||
-rw-r--r-- | src/transport/gnunet-transport-wlan-sender.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.h | 4 |
7 files changed, 21 insertions, 24 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index db9b7d166..b5b4e1299 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, | |||
1378 | { | 1378 | { |
1379 | char *ret; | 1379 | char *ret; |
1380 | char *name, *unique_name; | 1380 | char *name, *unique_name; |
1381 | int getinfo_result; | ||
1382 | 1381 | ||
1383 | if (uri->type != sks) | 1382 | if (uri->type != sks) |
1384 | return NULL; | 1383 | return NULL; |
1385 | getinfo_result = GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.namespace, | 1384 | (void) GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.namespace, |
1386 | NULL, NULL, &name, NULL); | 1385 | NULL, NULL, &name, NULL); |
1387 | unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &uri->data.sks.namespace, name, NULL); | 1386 | unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &uri->data.sks.namespace, name, NULL); |
1388 | GNUNET_free (name); | 1387 | GNUNET_free (name); |
1389 | GNUNET_asprintf (&ret, "%s: %s", unique_name, uri->data.sks.identifier); | 1388 | 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 06fd777e6..9c8824a4a 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -128,13 +128,17 @@ extern "C" | |||
128 | ******************************************************************************/ | 128 | ******************************************************************************/ |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Type of messages between the gnunet-wlan-helper and the daemon | 131 | * Type of data messages from the plugin to the gnunet-wlan-helper |
132 | * | ||
133 | */ | 132 | */ |
134 | #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA 40 | 133 | #define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39 |
135 | 134 | ||
136 | /** | 135 | /** |
137 | * Control messages between the gnunet-wlan-helper and the daemon | 136 | * Type of data messages from the gnunet-wlan-helper to the plugin |
137 | */ | ||
138 | #define GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER 40 | ||
139 | |||
140 | /** | ||
141 | * Control message between the gnunet-wlan-helper and the daemon (with the MAC). | ||
138 | */ | 142 | */ |
139 | #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL 41 | 143 | #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL 41 |
140 | 144 | ||
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) | |||
82 | struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader; | 82 | struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader; |
83 | 83 | ||
84 | in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; | 84 | in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; |
85 | if ( (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) || | 85 | if ( (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) || |
86 | (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs (hdr->size)) ) | 86 | (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs (hdr->size)) ) |
87 | { | 87 | { |
88 | fprintf (stderr, "Function stdin_send: wrong packet type or size\n"); | 88 | 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) | |||
96 | } | 96 | } |
97 | memset (&newheader, 0, sizeof (newheader)); | 97 | memset (&newheader, 0, sizeof (newheader)); |
98 | newheader.header.size = htons (payload_size + sizeof (newheader)); | 98 | newheader.header.size = htons (payload_size + sizeof (newheader)); |
99 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); | 99 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); |
100 | newheader.frame = in->frame; | 100 | newheader.frame = in->frame; |
101 | memcpy (write_pout->buf + write_pout->size, | 101 | memcpy (write_pout->buf + write_pout->size, |
102 | &newheader, | 102 | &newheader, |
@@ -116,12 +116,6 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
116 | uint16_t sendsize; | 116 | uint16_t sendsize; |
117 | 117 | ||
118 | sendsize = ntohs (hdr->size); | 118 | sendsize = ntohs (hdr->size); |
119 | |||
120 | if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) | ||
121 | { | ||
122 | fprintf (stderr, "Function file_in_send: wrong packet type\n"); | ||
123 | exit (1); | ||
124 | } | ||
125 | if ((sendsize + write_std->size) > MAXLINE * 2) | 119 | if ((sendsize + write_std->size) > MAXLINE * 2) |
126 | { | 120 | { |
127 | fprintf (stderr, "Function file_in_send: Packet too big for buffer\n"); | 121 | 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) | |||
1795 | sendsize = ntohs (hdr->size); | 1795 | sendsize = ntohs (hdr->size); |
1796 | if ( (sendsize < | 1796 | if ( (sendsize < |
1797 | sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || | 1797 | sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) || |
1798 | (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) ) | 1798 | (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ) |
1799 | { | 1799 | { |
1800 | fprintf (stderr, "Received malformed message\n"); | 1800 | fprintf (stderr, "Received malformed message\n"); |
1801 | exit (1); | 1801 | exit (1); |
@@ -2039,7 +2039,7 @@ main (int argc, char *argv[]) | |||
2039 | + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) | 2039 | + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) |
2040 | - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); | 2040 | - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame); |
2041 | rrm->header.size = htons (write_std.size); | 2041 | rrm->header.size = htons (write_std.size); |
2042 | rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); | 2042 | rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); |
2043 | } | 2043 | } |
2044 | } | 2044 | } |
2045 | } | 2045 | } |
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, | |||
58 | uint16_t size) | 58 | uint16_t size) |
59 | { | 59 | { |
60 | header->header.size = htons (size); | 60 | header->header.size = htons (size); |
61 | header->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); | 61 | header->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER); |
62 | header->rate = 255; | 62 | header->rate = 255; |
63 | header->tx_power = 0; | 63 | header->tx_power = 0; |
64 | header->antenna = 0; | 64 | 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, | |||
1221 | struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header, | 1221 | struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header, |
1222 | uint16_t size) | 1222 | uint16_t size) |
1223 | { | 1223 | { |
1224 | header->header.type = ntohs (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); | 1224 | header->header.type = ntohs (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER); |
1225 | header->header.size = ntohs (size); | 1225 | header->header.size = ntohs (size); |
1226 | if (endpoint != NULL) | 1226 | if (endpoint != NULL) |
1227 | { | 1227 | { |
@@ -2778,12 +2778,12 @@ wlan_process_helper (void *cls, void *client, | |||
2778 | GNUNET_assert (plugin != NULL); | 2778 | GNUNET_assert (plugin != NULL); |
2779 | switch (ntohs (hdr->type)) | 2779 | switch (ntohs (hdr->type)) |
2780 | { | 2780 | { |
2781 | case GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA: | 2781 | case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: |
2782 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, | 2782 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, |
2783 | "Func wlan_process_helper got GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA size: %u\n", | 2783 | "Got data message from helper with %u bytes\n", |
2784 | ntohs (hdr->size)); | 2784 | ntohs (hdr->size)); |
2785 | GNUNET_STATISTICS_update (plugin->env->stats, | 2785 | GNUNET_STATISTICS_update (plugin->env->stats, |
2786 | _("# wlan WLAN_HELPER_DATA received"), 1, | 2786 | _("# wlan data messages received"), 1, |
2787 | GNUNET_NO); | 2787 | GNUNET_NO); |
2788 | //call wlan_process_helper with the message inside, later with wlan: analyze signal | 2788 | //call wlan_process_helper with the message inside, later with wlan: analyze signal |
2789 | if (ntohs (hdr->size) < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)) | 2789 | 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 | |||
142 | { | 142 | { |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'. | 145 | * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER'. |
146 | */ | 146 | */ |
147 | struct GNUNET_MessageHeader header; | 147 | struct GNUNET_MessageHeader header; |
148 | 148 | ||
@@ -183,7 +183,7 @@ struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage | |||
183 | { | 183 | { |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'. | 186 | * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER'. |
187 | */ | 187 | */ |
188 | struct GNUNET_MessageHeader header; | 188 | struct GNUNET_MessageHeader header; |
189 | 189 | ||