aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c56
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c68
-rw-r--r--src/transport/plugin_transport_wlan.c283
-rw-r--r--src/transport/plugin_transport_wlan.h78
4 files changed, 189 insertions, 296 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 3f17b04dd..cd545af65 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -77,49 +77,35 @@ static void
77stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) 77stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
78{ 78{
79 struct sendbuf *write_pout = cls; 79 struct sendbuf *write_pout = cls;
80 int sendsize; 80 const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *in;
81 struct GNUNET_MessageHeader newheader; 81 size_t payload_size;
82 char *to_data; 82 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader;
83 char *to_radiotap;
84 char *to_start;
85 83
86 sendsize = 84 in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
87 ntohs (hdr->size) - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) + 85 if ( (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type)) ||
88 sizeof (struct Radiotap_rx) + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + 86 (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs (hdr->size)) )
89 sizeof (struct GNUNET_MessageHeader);
90
91 if (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs (hdr->type))
92 { 87 {
93 fprintf (stderr, "Function stdin_send: wrong packet type\n"); 88 fprintf (stderr, "Function stdin_send: wrong packet type or size\n");
94 exit (1); 89 exit (1);
95 } 90 }
96 if ((sendsize + write_pout->size) > MAXLINE * 2) 91 payload_size = ntohs (hdr->size) - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage);
92 if ((payload_size + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_pout->size) > MAXLINE * 2)
97 { 93 {
98 fprintf (stderr, "Function stdin_send: Packet too big for buffer\n"); 94 fprintf (stderr, "Function stdin_send: Packet too big for buffer\n");
99 exit (1); 95 exit (1);
100 } 96 }
101 97 memset (&newheader, 0, sizeof (newheader));
102 newheader.size = htons (sendsize); 98 newheader.header.size = htons (payload_size + sizeof (newheader));
103 newheader.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); 99 newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
104 100 newheader.frame = in->frame;
105 to_start = write_pout->buf + write_pout->size; 101 memcpy (write_pout->buf + write_pout->size,
106 memcpy (to_start, &newheader, sizeof (struct GNUNET_MessageHeader)); 102 &newheader,
107 write_pout->size += sizeof (struct GNUNET_MessageHeader); 103 sizeof (newheader));
108 104 write_pout->size += sizeof (newheader);
109 to_radiotap = to_start + sizeof (struct GNUNET_MessageHeader); 105 memcpy (write_pout->buf + write_pout->size,
110 memset (to_radiotap, 0, sizeof (struct Radiotap_rx)); 106 &in[1],
111 write_pout->size += sizeof (struct Radiotap_rx); 107 payload_size);
112 108 write_pout->size += payload_size;
113 to_data = to_radiotap + sizeof (struct Radiotap_rx);
114 memcpy (to_data,
115 ((char *) hdr) +
116 sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) -
117 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
118 ntohs (hdr->size) - (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
119 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)));
120 write_pout->size +=
121 ntohs (hdr->size) - (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
122 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
123} 109}
124 110
125 111
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index 51b9ba32d..2ed81a24d 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -70,10 +70,10 @@
70 * Modifications to fit into the linux IEEE 802.11 stack, 70 * Modifications to fit into the linux IEEE 802.11 stack,
71 * Mike Kershaw (dragorn@kismetwireless.net) 71 * Mike Kershaw (dragorn@kismetwireless.net)
72 */ 72 */
73 73/*
74/**
75 * parts taken from aircrack-ng, parts changend. 74 * parts taken from aircrack-ng, parts changend.
76 */ 75 */
76
77#define _GNU_SOURCE 77#define _GNU_SOURCE
78#include <sys/socket.h> 78#include <sys/socket.h>
79#include <sys/ioctl.h> 79#include <sys/ioctl.h>
@@ -106,10 +106,6 @@
106#define ARPHRD_IEEE80211_PRISM 802 106#define ARPHRD_IEEE80211_PRISM 802
107#define ARPHRD_IEEE80211_FULL 803 107#define ARPHRD_IEEE80211_FULL 803
108 108
109/**
110 * size of 802.11 address
111 */
112#define IEEE80211_ADDR_LEN 6
113 109
114/** 110/**
115 * Maximum size of a message allowed in either direction. 111 * Maximum size of a message allowed in either direction.
@@ -368,18 +364,6 @@ struct SendBuffer
368 char buf[MAXLINE * 2]; 364 char buf[MAXLINE * 2];
369}; 365};
370 366
371/**
372 * Buffer for data read from stdin to be transmitted to the wirless card.
373 */
374static struct SendBuffer write_pout;
375
376/**
377 * Buffer for data read from the wireless card to be transmitted to stdout.
378 */
379static struct SendBuffer write_std;
380
381
382
383 367
384/** 368/**
385 * struct for storing the information of the hardware 369 * struct for storing the information of the hardware
@@ -458,6 +442,17 @@ struct ieee80211_radiotap_iterator
458}; 442};
459 443
460 444
445/**
446 * Buffer for data read from stdin to be transmitted to the wirless card.
447 */
448static struct SendBuffer write_pout;
449
450/**
451 * Buffer for data read from the wireless card to be transmitted to stdout.
452 */
453static struct SendBuffer write_std;
454
455
461 456
462/* specialized version of server_mst.c begins here */ 457/* specialized version of server_mst.c begins here */
463 458
@@ -520,7 +515,6 @@ struct MessageStreamTokenizer
520}; 515};
521 516
522 517
523
524/** 518/**
525 * Create a message stream tokenizer. 519 * Create a message stream tokenizer.
526 * 520 *
@@ -1095,12 +1089,13 @@ linux_get_channel (const struct HardwareInfos *dev)
1095 * @param dev pointer to the struct of the wlan card 1089 * @param dev pointer to the struct of the wlan card
1096 * @param buf buffer to read to 1090 * @param buf buffer to read to
1097 * @param buf_size size of the buffer 1091 * @param buf_size size of the buffer
1098 * @param ri radiotap_rx info 1092 * @param ri where to write radiotap_rx info
1099 * @return size read from the buffer 1093 * @return size read from the buffer
1100 */ 1094 */
1101static ssize_t 1095static ssize_t
1102linux_read (struct HardwareInfos *dev, unsigned char *buf, size_t buf_size, 1096linux_read (struct HardwareInfos *dev,
1103 struct Radiotap_rx *ri) 1097 unsigned char *buf, size_t buf_size,
1098 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri)
1104{ 1099{
1105 unsigned char tmpbuf[buf_size]; 1100 unsigned char tmpbuf[buf_size];
1106 ssize_t caplen; 1101 ssize_t caplen;
@@ -1701,33 +1696,30 @@ main (int argc, char *argv[])
1701 1696
1702 if (FD_ISSET (dev.fd_raw, &rfds)) 1697 if (FD_ISSET (dev.fd_raw, &rfds))
1703 { 1698 {
1704 struct GNUNET_MessageHeader *header; 1699 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
1705 struct Radiotap_rx *rxinfo;
1706 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *datastart;
1707 ssize_t ret; 1700 ssize_t ret;
1708 1701
1709 header = (struct GNUNET_MessageHeader *) write_std.buf; 1702 rrm = (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf;
1710 rxinfo = (struct Radiotap_rx *) &header[1];
1711 datastart = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &rxinfo[1];
1712 ret = 1703 ret =
1713 linux_read (&dev, (unsigned char *) datastart, 1704 linux_read (&dev, (unsigned char *) &rrm->frame,
1714 sizeof (write_std.buf) - sizeof (struct Radiotap_rx) - 1705 sizeof (write_std.buf)
1715 sizeof (struct GNUNET_MessageHeader), rxinfo); 1706 - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
1707 + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
1708 rrm);
1716 if (0 > ret) 1709 if (0 > ret)
1717 { 1710 {
1718 fprintf (stderr, "Read error from raw socket: %s\n", strerror (errno)); 1711 fprintf (stderr, "Read error from raw socket: %s\n", strerror (errno));
1719 break; 1712 break;
1720 } 1713 }
1721 if ((0 < ret) && (0 == mac_test (datastart, &dev))) 1714 if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
1722 { 1715 {
1723 write_std.size = 1716 write_std.size = ret
1724 ret + sizeof (struct GNUNET_MessageHeader) + 1717 + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
1725 sizeof (struct Radiotap_rx); 1718 - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
1726 header->size = htons (write_std.size); 1719 rrm->header.size = htons (write_std.size);
1727 header->type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); 1720 rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
1728 } 1721 }
1729 } 1722 }
1730
1731 } 1723 }
1732 /* Error handling, try to clean up a bit at least */ 1724 /* Error handling, try to clean up a bit at least */
1733 mst_destroy (stdin_mst); 1725 mst_destroy (stdin_mst);
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 1dc2713ed..7b709ce9d 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1,27 +1,28 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2010 2011 Christian Grothoff (and other contributing authors) 3 (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19*/
20 20
21/** 21/**
22 * @file transport/plugin_transport_wlan.c 22 * @file transport/plugin_transport_wlan.c
23 * @brief transport plugin for wlan 23 * @brief transport plugin for wlan
24 * @author David Brodski 24 * @author David Brodski
25 * @author Christian Grothoff
25 */ 26 */
26 27
27//TODO split rx and tx structures for better handling 28//TODO split rx and tx structures for better handling
@@ -294,7 +295,7 @@ struct Finish_send
294/** 295/**
295 * Queue of sessions, for the general session queue and the pending session queue 296 * Queue of sessions, for the general session queue and the pending session queue
296 */ 297 */
297//TODO DOXIGEN 298//TODO DOXYGEN
298struct Sessionqueue 299struct Sessionqueue
299{ 300{
300 struct Sessionqueue *next; 301 struct Sessionqueue *next;
@@ -305,10 +306,11 @@ struct Sessionqueue
305#endif 306#endif
306}; 307};
307 308
309
308/** 310/**
309 * Queue of fragmented messages, for the sending queue of the plugin 311 * Queue of fragmented messages, for the sending queue of the plugin
310 */ 312 */
311//TODO DOXIGEN 313//TODO DOXYGEN
312struct FragmentMessage_queue 314struct FragmentMessage_queue
313{ 315{
314 struct FragmentMessage_queue *next; 316 struct FragmentMessage_queue *next;
@@ -316,21 +318,24 @@ struct FragmentMessage_queue
316 struct FragmentMessage *content; 318 struct FragmentMessage *content;
317}; 319};
318 320
321
319/** 322/**
320 * Queue for the fragments received 323 * Queue for the fragments received
321 */ 324 */
322//TODO DOXIGEN 325//TODO DOXYGEN
323struct Receive_Fragment_Queue 326struct Receive_Fragment_Queue
324{ 327{
325 struct Receive_Fragment_Queue *next; 328 struct Receive_Fragment_Queue *next;
326 struct Receive_Fragment_Queue *prev; 329 struct Receive_Fragment_Queue *prev;
330
327 uint16_t num; 331 uint16_t num;
328 const char *msg; 332 // const char *msg;
329 uint16_t size; 333 // uint16_t size;
330 struct Radiotap_rx rxinfo; 334 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rx_msg;
331}; 335};
332 336
333//TODO DOXIGEN 337
338//TODO DOXYGEN
334struct MacEndpoint_id_fragment_triple 339struct MacEndpoint_id_fragment_triple
335{ 340{
336 struct MacEndpoint *endpoint; 341 struct MacEndpoint *endpoint;
@@ -338,7 +343,7 @@ struct MacEndpoint_id_fragment_triple
338 struct FragmentMessage *fm; 343 struct FragmentMessage *fm;
339}; 344};
340 345
341//TODO DOXIGEN 346//TODO DOXYGEN
342struct Plugin_Session_pair 347struct Plugin_Session_pair
343{ 348{
344 struct Plugin *plugin; 349 struct Plugin *plugin;
@@ -354,6 +359,9 @@ GNUNET_NETWORK_STRUCT_BEGIN
354struct WlanHeader 359struct WlanHeader
355{ 360{
356 361
362 /**
363 * Message type is GNUNET_MESSAGE_TYPE_WLAN_DATA.
364 */
357 struct GNUNET_MessageHeader header; 365 struct GNUNET_MessageHeader header;
358 366
359 /** 367 /**
@@ -457,26 +465,6 @@ struct AckSendQueue
457 465
458 466
459/** 467/**
460 * Session infos gathered from a messages
461 */
462struct Session_light
463{
464 /**
465 * the session this message belongs to
466 */
467 struct Session *session;
468 /**
469 * peer mac address
470 */
471 struct GNUNET_TRANSPORT_WLAN_MacAddress addr;
472
473 /**
474 * mac endpoint
475 */
476 struct MacEndpoint *macendpoint;
477};
478
479/**
480 * Session handle for connections. 468 * Session handle for connections.
481 */ 469 */
482struct Session 470struct Session
@@ -592,7 +580,7 @@ struct MacEndpoint
592 */ 580 */
593 int fragment_messages_out_count; 581 int fragment_messages_out_count;
594 582
595 //TODO DOXIGEN 583 //TODO DOXYGEN
596 uint8_t rate; 584 uint8_t rate;
597 uint16_t tx_power; 585 uint16_t tx_power;
598 uint8_t antenna; 586 uint8_t antenna;
@@ -2573,132 +2561,82 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
2573 * Function used for to process the data received from the wlan interface 2561 * Function used for to process the data received from the wlan interface
2574 * 2562 *
2575 * @param cls the plugin handle 2563 * @param cls the plugin handle
2576 * @param session_light pointer to the struct holding known informations
2577 * @param hdr hdr of the GNUNET_MessageHeader 2564 * @param hdr hdr of the GNUNET_MessageHeader
2578 * @param rxinfo pointer to the radiotap informations got with this packet FIXME: give ATS for info 2565 * @param rxinfo pointer to the radiotap informations got with this packet FIXME: give ATS info
2579 */ 2566 */
2580static void 2567static void
2581wlan_data_helper (void *cls, struct Session_light *session_light, 2568wlan_data_helper (void *cls,
2582 const struct GNUNET_MessageHeader *hdr, 2569 const struct GNUNET_MessageHeader *hdr,
2583 const struct Radiotap_rx *rxinfo) 2570 const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rxinfo)
2584{ 2571{
2585 struct Plugin *plugin = cls; 2572 struct Plugin *plugin = cls;
2586 struct FragmentMessage *fm; 2573 struct FragmentMessage *fm;
2587 struct FragmentMessage *fm2; 2574 struct FragmentMessage *fm2;
2588 struct GNUNET_PeerIdentity tmpsource; 2575 struct GNUNET_PeerIdentity tmpsource;
2576 struct MacEndpoint *macendpoint;
2577 struct Session *session;
2589 2578
2590 GNUNET_assert (plugin != NULL); 2579 // NOTE: session_light->addr = rxinfo->frame.addr2;
2580 macendpoint = get_macendpoint (plugin, &rxinfo->frame.addr2, GNUNET_YES);
2591 2581
2592 //ADVERTISEMENT 2582 switch (ntohs (hdr->type))
2593 if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_HELLO)
2594 { 2583 {
2595 2584 case GNUNET_MESSAGE_TYPE_HELLO:
2585 //ADVERTISEMENT
2596 //TODO better DOS protection, error handling 2586 //TODO better DOS protection, error handling
2597 //TODO test first than create session 2587 //TODO test first then create session
2598 GNUNET_assert (session_light != NULL);
2599
2600 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2601 "Func wlan_data_helper got GNUNET_MESSAGE_TYPE_HELLO size: %u; %s\n",
2602 ntohs (hdr->size), wlan_plugin_address_to_string (NULL,
2603 session_light->addr.
2604 mac, 6));
2605 if (session_light->macendpoint == NULL)
2606 {
2607 session_light->macendpoint =
2608 get_macendpoint (plugin, &session_light->addr, GNUNET_YES);
2609 }
2610
2611
2612 if (GNUNET_HELLO_get_id 2588 if (GNUNET_HELLO_get_id
2613 ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource) == GNUNET_OK) 2589 ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource) == GNUNET_OK)
2614 { 2590 {
2615 session_light->session = 2591 session = search_session (plugin, macendpoint, &tmpsource);
2616 search_session (plugin, session_light->macendpoint, &tmpsource); 2592 if (session == NULL)
2617 if (session_light->session == NULL)
2618 { 2593 {
2619 session_light->session = 2594 session = create_session (plugin, macendpoint, &tmpsource);
2620 create_session (plugin, session_light->macendpoint, &tmpsource);
2621 } 2595 }
2622 GNUNET_STATISTICS_update (plugin->env->stats, 2596 GNUNET_STATISTICS_update (plugin->env->stats,
2623 _("# wlan hello messages received"), 1, 2597 _("# wlan hello messages received"), 1,
2624 GNUNET_NO); 2598 GNUNET_NO);
2625 plugin->env->receive (plugin->env->cls, &session_light->session->target, 2599 plugin->env->receive (plugin->env->cls, &session->target,
2626 hdr, NULL, 0, session_light->session, 2600 hdr, NULL, 0, session,
2627 (const char *) &session_light->session->mac->addr, 2601 (const char *) &session->mac->addr,
2628 sizeof (session_light->session->mac->addr)); 2602 sizeof (session->mac->addr));
2629 } 2603 }
2630 else 2604 else
2631 { 2605 {
2632 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME, 2606 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME,
2633 "WLAN client not in session list and hello message is not okay\n"); 2607 "WLAN client not in session list and HELLO message is not okay\n");
2634 return; 2608 return;
2635 } 2609 }
2636 } 2610 break;
2637 2611 case GNUNET_MESSAGE_TYPE_FRAGMENT:
2638 //FRAGMENT 2612 macendpoint = get_macendpoint (plugin, &rxinfo->frame.addr2, GNUNET_YES);
2639
2640 else if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_FRAGMENT)
2641 {
2642
2643 GNUNET_assert (session_light != NULL);
2644 if (session_light->macendpoint == NULL)
2645 {
2646 session_light->macendpoint =
2647 get_macendpoint (plugin, &session_light->addr, GNUNET_YES);
2648 }
2649
2650 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2651 "Func wlan_data_helper got GNUNET_MESSAGE_TYPE_FRAGMENT with size: %u; mac endpoint %p: %s\n",
2652 ntohs (hdr->size), session_light->macendpoint,
2653 wlan_plugin_address_to_string (NULL,
2654 session_light->addr.mac,
2655 6));
2656 GNUNET_STATISTICS_update (plugin->env->stats, 2613 GNUNET_STATISTICS_update (plugin->env->stats,
2657 _("# wlan fragments received"), 1, GNUNET_NO); 2614 _("# wlan fragments received"), 1, GNUNET_NO);
2658 int ret = 2615 int ret =
2659 GNUNET_DEFRAGMENT_process_fragment (session_light->macendpoint->defrag, 2616 GNUNET_DEFRAGMENT_process_fragment (macendpoint->defrag,
2660 hdr); 2617 hdr);
2661 2618
2662 if (ret == GNUNET_NO) 2619 if (ret == GNUNET_NO)
2663 { 2620 {
2664 session_light->macendpoint->dups++; 2621 macendpoint->dups++;
2665 } 2622 }
2666 else if (ret == GNUNET_OK) 2623 else if (ret == GNUNET_OK)
2667 { 2624 {
2668 session_light->macendpoint->fragc++; 2625 macendpoint->fragc++;
2669 } 2626 }
2670 set_next_send (plugin); 2627 set_next_send (plugin);
2671 2628 break;
2672 } 2629 case GNUNET_MESSAGE_TYPE_FRAGMENT_ACK:
2673 2630 if (NULL == macendpoint)
2674 //ACK
2675
2676 else if (ntohs (hdr->type) == GNUNET_MESSAGE_TYPE_FRAGMENT_ACK)
2677 {
2678 GNUNET_assert (session_light != NULL);
2679 if (session_light->macendpoint == NULL)
2680 {
2681 session_light->macendpoint =
2682 get_macendpoint (plugin, &session_light->addr, GNUNET_NO);
2683 }
2684
2685 if (session_light->macendpoint == NULL)
2686 { 2631 {
2687 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2632 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2688 "Macendpoint does not exist for this GNUNET_MESSAGE_TYPE_FRAGMENT_ACK size: %u; %s\n", 2633 "Macendpoint does not exist for this GNUNET_MESSAGE_TYPE_FRAGMENT_ACK size: %u; %s\n",
2689 ntohs (hdr->size), wlan_plugin_address_to_string (NULL, 2634 ntohs (hdr->size), wlan_plugin_address_to_string (NULL,
2690 session_light->addr.mac, 2635 &rxinfo->frame.addr2.mac,
2691 6)); 2636 6));
2692 return; 2637 return;
2693 } 2638 }
2694 2639 fm = macendpoint->sending_messages_head;
2695 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2696 "Func wlan_data_helper got GNUNET_MESSAGE_TYPE_FRAGMENT_ACK size: %u; mac endpoint: %p; %s\n",
2697 ntohs (hdr->size), session_light->macendpoint,
2698 wlan_plugin_address_to_string (NULL,
2699 session_light->addr.mac,
2700 6));
2701 fm = session_light->macendpoint->sending_messages_head;
2702 while (fm != NULL) 2640 while (fm != NULL)
2703 { 2641 {
2704 fm2 = fm->next; 2642 fm2 = fm->next;
@@ -2710,9 +2648,9 @@ wlan_data_helper (void *cls, struct Session_light *session_light,
2710 { 2648 {
2711 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2649 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2712 "Got last ack, finished fragment message %p\n", fm); 2650 "Got last ack, finished fragment message %p\n", fm);
2713 session_light->macendpoint->acks++; 2651 macendpoint->acks++;
2714 fm->session->last_activity = GNUNET_TIME_absolute_get (); 2652 fm->session->last_activity = GNUNET_TIME_absolute_get ();
2715 session_light->macendpoint->last_activity = fm->session->last_activity; 2653 macendpoint->last_activity = fm->session->last_activity;
2716 free_fragment_message (plugin, fm); 2654 free_fragment_message (plugin, fm);
2717 check_fragment_queue (plugin); 2655 check_fragment_queue (plugin);
2718 return; 2656 return;
@@ -2721,24 +2659,15 @@ wlan_data_helper (void *cls, struct Session_light *session_light,
2721 { 2659 {
2722 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2660 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2723 "Got ack for: %p\n", fm); 2661 "Got ack for: %p\n", fm);
2724 session_light->macendpoint->acks++; 2662 macendpoint->acks++;
2725 return; 2663 return;
2726 } 2664 }
2727 if (ret == GNUNET_SYSERR)
2728 {
2729
2730 }
2731
2732 fm = fm2; 2665 fm = fm2;
2733 } 2666 }
2734
2735 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2667 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2736 "WLAN fragment not in fragment list\n"); 2668 "WLAN fragment not in fragment list\n");
2737 return; 2669 return;
2738 2670 default:
2739 }
2740 else
2741 {
2742 // TODO Wrong data? 2671 // TODO Wrong data?
2743 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, PLUGIN_LOG_NAME, 2672 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, PLUGIN_LOG_NAME,
2744 "WLAN packet inside the WLAN helper packet has not the right type: %u size: %u\n", 2673 "WLAN packet inside the WLAN helper packet has not the right type: %u size: %u\n",
@@ -2746,12 +2675,8 @@ wlan_data_helper (void *cls, struct Session_light *session_light,
2746 GNUNET_break (0); 2675 GNUNET_break (0);
2747 return; 2676 return;
2748 } 2677 }
2749
2750#if 0
2751 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2678 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2752 "Helper finished\n"); 2679 "Helper finished\n");
2753#endif
2754
2755} 2680}
2756 2681
2757/** 2682/**
@@ -2853,11 +2778,10 @@ wlan_process_helper (void *cls, void *client,
2853 const struct GNUNET_MessageHeader *hdr) 2778 const struct GNUNET_MessageHeader *hdr)
2854{ 2779{
2855 struct Plugin *plugin = cls; 2780 struct Plugin *plugin = cls;
2856 const struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *wlanIeeeHeader; 2781 const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rxinfo;
2857 struct Session_light *session_light = NULL; 2782 const struct GNUNET_TRANSPORT_WLAN_HelperControlMessage *cm;
2858 const struct Radiotap_rx *rxinfo;
2859 const struct GNUNET_MessageHeader *temp_hdr = NULL; 2783 const struct GNUNET_MessageHeader *temp_hdr = NULL;
2860 2784 const char *end;
2861 int datasize = 0; 2785 int datasize = 0;
2862 int pos; 2786 int pos;
2863 2787
@@ -2872,96 +2796,79 @@ wlan_process_helper (void *cls, void *client,
2872 _("# wlan WLAN_HELPER_DATA received"), 1, 2796 _("# wlan WLAN_HELPER_DATA received"), 1,
2873 GNUNET_NO); 2797 GNUNET_NO);
2874 //call wlan_process_helper with the message inside, later with wlan: analyze signal 2798 //call wlan_process_helper with the message inside, later with wlan: analyze signal
2875 if (ntohs (hdr->size) < 2799 if (ntohs (hdr->size) < sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage))
2876 sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) +
2877 2 * sizeof (struct GNUNET_MessageHeader) + sizeof (struct Radiotap_rx))
2878 { 2800 {
2879 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2801 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2880 "Size of packet is too small; size: %u min size: %u\n", 2802 "Size of packet is too small; size: %u\n",
2881 ntohs (hdr->size), 2803 ntohs (hdr->size));
2882 sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + 2804 GNUNET_break (0);
2883 sizeof (struct GNUNET_MessageHeader));
2884 //GNUNET_break (0);
2885 /* FIXME: restart SUID process */ 2805 /* FIXME: restart SUID process */
2886 return; 2806 return;
2887 } 2807 }
2888 2808
2889 rxinfo = (const struct Radiotap_rx *) &hdr[1]; 2809 rxinfo = (const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) hdr;
2890 wlanIeeeHeader = (const struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &rxinfo[1];
2891
2892 //process only if it is an broadcast or for this computer both with the gnunet bssid 2810 //process only if it is an broadcast or for this computer both with the gnunet bssid
2893
2894 //check for bssid 2811 //check for bssid
2895 if (memcmp 2812 if (memcmp
2896 (&wlanIeeeHeader->addr3, &mac_bssid_gnunet, 2813 (&rxinfo->frame.addr3, &mac_bssid_gnunet,
2897 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) 2814 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)
2898 { 2815 {
2899 //check for broadcast or mac 2816 //check for broadcast or mac
2900 if ((memcmp 2817 if ((memcmp
2901 (&wlanIeeeHeader->addr1, &bc_all_mac, 2818 (&rxinfo->frame.addr1, &bc_all_mac,
2902 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) || 2819 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0) ||
2903 (memcmp 2820 (memcmp
2904 (&wlanIeeeHeader->addr1, &(plugin->mac_address), 2821 (&rxinfo->frame.addr1, &plugin->mac_address,
2905 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)) 2822 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0))
2906 { 2823 {
2907 //if packet is from us return 2824 //if packet is from us return
2908 if ((memcmp 2825 if ((memcmp
2909 (&wlanIeeeHeader->addr2, &(plugin->mac_address), 2826 (&rxinfo->frame.addr2, &plugin->mac_address,
2910 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)) 2827 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0))
2911 { 2828 {
2829 /* not for us */
2912 return; 2830 return;
2913 } 2831 }
2914 // process the inner data 2832 datasize = ntohs (hdr->size) - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage);
2915
2916
2917 datasize =
2918 ntohs (hdr->size) - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) -
2919 sizeof (struct GNUNET_MessageHeader) - sizeof (struct Radiotap_rx);
2920
2921 session_light = GNUNET_malloc (sizeof (struct Session_light));
2922 session_light->addr = wlanIeeeHeader->addr2;
2923 //session_light->session = search_session(plugin,session_light->addr);
2924 GNUNET_STATISTICS_update (plugin->env->stats, 2833 GNUNET_STATISTICS_update (plugin->env->stats,
2925 _("# wlan messages for this client received"), 2834 _("# wlan messages for this client received"),
2926 1, GNUNET_NO); 2835 1, GNUNET_NO);
2927 2836 // FIXME: this is a job for SERVER_mst --
2837 // what we are doing here is not good for alignment...
2928 pos = 0; 2838 pos = 0;
2929 while (pos < datasize) 2839 end = (const char*) &rxinfo[1];
2840 while (pos < datasize - sizeof (struct GNUNET_MessageHeader))
2930 { 2841 {
2931 temp_hdr = (struct GNUNET_MessageHeader *) &wlanIeeeHeader[1] + pos; 2842 temp_hdr = (struct GNUNET_MessageHeader *) &end[pos];
2932 if (ntohs (temp_hdr->size) <= datasize + pos) 2843 if (ntohs (temp_hdr->size) <= datasize - pos)
2933 { 2844 {
2934 GNUNET_STATISTICS_update (plugin->env->stats, 2845 GNUNET_STATISTICS_update (plugin->env->stats,
2935 _ 2846 _
2936 ("# wlan messages inside WLAN_HELPER_DATA received"), 2847 ("# wlan messages inside WLAN_HELPER_DATA received"),
2937 1, GNUNET_NO); 2848 1, GNUNET_NO);
2938 wlan_data_helper (plugin, session_light, temp_hdr, rxinfo); 2849 wlan_data_helper (plugin, temp_hdr, rxinfo);
2939 } 2850 }
2940 else 2851 else
2941 { 2852 {
2942 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2853 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2943 "Size of packet is too small; size: %u > size of packet: %u\n", 2854 "Size of packet is too small; size: %u > size of packet: %u\n",
2944 ntohs (temp_hdr->size), datasize + pos); 2855 ntohs (temp_hdr->size), datasize - pos);
2945 } 2856 }
2946 pos += ntohs (temp_hdr->size); 2857 pos += ntohs (temp_hdr->size);
2947
2948 } 2858 }
2949
2950 //clean up
2951 GNUNET_free (session_light);
2952 } 2859 }
2953 else 2860 else
2954 { 2861 {
2955 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2862 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2956 "Func wlan_process_helper got wrong MAC: %s\n", 2863 "Func wlan_process_helper got wrong MAC: %s\n",
2957 macprinter (&wlanIeeeHeader->addr1)); 2864 macprinter (&rxinfo->frame.addr1));
2958 } 2865 }
2959 } 2866 }
2960 else 2867 else
2961 { 2868 {
2962 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2869 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2963 "Func wlan_process_helper got wrong BSSID: %s\n", 2870 "Func wlan_process_helper got wrong BSSID: %s\n",
2964 macprinter (&wlanIeeeHeader->addr2)); 2871 macprinter (&rxinfo->frame.addr2));
2965 } 2872 }
2966 break; 2873 break;
2967 case GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL: 2874 case GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL:
@@ -2972,7 +2879,8 @@ wlan_process_helper (void *cls, void *client,
2972 /* FIXME: restart SUID process */ 2879 /* FIXME: restart SUID process */
2973 return; 2880 return;
2974 } 2881 }
2975 memcpy (&plugin->mac_address, &hdr[1], sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 2882 cm = (const struct GNUNET_TRANSPORT_WLAN_HelperControlMessage *) hdr;
2883 plugin->mac_address = cm->mac;
2976 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2884 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2977 "Received WLAN_HELPER_CONTROL message with transport of address %s\n", 2885 "Received WLAN_HELPER_CONTROL message with transport of address %s\n",
2978 wlan_plugin_address_to_string (cls, &plugin->mac_address, 2886 wlan_plugin_address_to_string (cls, &plugin->mac_address,
@@ -2985,10 +2893,6 @@ wlan_process_helper (void *cls, void *client,
2985 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2893 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2986 "Func wlan_process_helper got unknown message with number %u, size %u\n", 2894 "Func wlan_process_helper got unknown message with number %u, size %u\n",
2987 ntohs (hdr->type), ntohs (hdr->size)); 2895 ntohs (hdr->type), ntohs (hdr->size));
2988
2989#if DEBUG_WLAN > 1
2990 hexdump (hdr, GNUNET_MIN (ntohs (hdr->size), 256));
2991#endif
2992 GNUNET_break (0); 2896 GNUNET_break (0);
2993 return; 2897 return;
2994 } 2898 }
@@ -3000,7 +2904,6 @@ wlan_process_helper (void *cls, void *client,
3000 * Exit point from the plugin. 2904 * Exit point from the plugin.
3001 * @param cls pointer to the api struct 2905 * @param cls pointer to the api struct
3002 */ 2906 */
3003
3004//FIXME cleanup 2907//FIXME cleanup
3005void * 2908void *
3006libgnunet_plugin_transport_wlan_done (void *cls) 2909libgnunet_plugin_transport_wlan_done (void *cls)
@@ -3029,8 +2932,6 @@ libgnunet_plugin_transport_wlan_done (void *cls)
3029 endpoint = endpoint_next; 2932 endpoint = endpoint_next;
3030 2933
3031 } 2934 }
3032
3033
3034 if (plugin->suid_tokenizer != NULL) 2935 if (plugin->suid_tokenizer != NULL)
3035 GNUNET_SERVER_mst_destroy (plugin->suid_tokenizer); 2936 GNUNET_SERVER_mst_destroy (plugin->suid_tokenizer);
3036 2937
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index c220c829d..3f8e82404 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -35,6 +35,7 @@
35#define MAC_ADDR_SIZE 6 35#define MAC_ADDR_SIZE 6
36 36
37GNUNET_NETWORK_STRUCT_BEGIN 37GNUNET_NETWORK_STRUCT_BEGIN
38
38/** 39/**
39 * A MAC Address. 40 * A MAC Address.
40 */ 41 */
@@ -59,24 +60,7 @@ struct GNUNET_TRANSPORT_WLAN_HelperControlMessage
59 */ 60 */
60 struct GNUNET_TRANSPORT_WLAN_MacAddress mac; 61 struct GNUNET_TRANSPORT_WLAN_MacAddress mac;
61}; 62};
62GNUNET_NETWORK_STRUCT_END
63
64/**
65 * GNUnet bssid
66 */
67static const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet = {
68 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
69};
70
71
72/**
73 * Broadcast MAC
74 */
75static const struct GNUNET_TRANSPORT_WLAN_MacAddress bc_all_mac = {
76 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
77};
78 63
79GNUNET_NETWORK_STRUCT_BEGIN
80 64
81/** 65/**
82 * generic definitions for IEEE 802.11 frames 66 * generic definitions for IEEE 802.11 frames
@@ -86,12 +70,12 @@ struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame
86 /** 70 /**
87 * 802.11 Frame Control field, 71 * 802.11 Frame Control field,
88 */ 72 */
89 uint16_t frame_control; 73 uint16_t frame_control GNUNET_PACKED;
90 74
91 /** 75 /**
92 * Microseconds to reserve link (duration), 0 by default 76 * Microseconds to reserve link (duration), 0 by default
93 */ 77 */
94 uint16_t duration; 78 uint16_t duration GNUNET_PACKED;
95 79
96 /** 80 /**
97 * Address 1: destination address in ad-hoc mode or AP, BSSID if station, 81 * Address 1: destination address in ad-hoc mode or AP, BSSID if station,
@@ -111,7 +95,7 @@ struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame
111 /** 95 /**
112 * 802.11 sequence control field. 96 * 802.11 sequence control field.
113 */ 97 */
114 uint16_t sequence_control; 98 uint16_t sequence_control GNUNET_PACKED;
115 99
116 /** 100 /**
117 * Link layer control (LLC). Set to a GNUnet-specific value. 101 * Link layer control (LLC). Set to a GNUnet-specific value.
@@ -150,7 +134,7 @@ struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage
150 * Transmit power expressed as unitless distance from max power set at factory calibration. 134 * Transmit power expressed as unitless distance from max power set at factory calibration.
151 * 0 is max power. Monotonically nondecreasing with lower power levels. 135 * 0 is max power. Monotonically nondecreasing with lower power levels.
152 */ 136 */
153 uint16_t tx_power; 137 uint16_t tx_power GNUNET_PACKED;
154 138
155 /** 139 /**
156 * IEEE Frame to transmit (the sender MAC address will be overwritten by the helper as it does not 140 * IEEE Frame to transmit (the sender MAC address will be overwritten by the helper as it does not
@@ -161,59 +145,89 @@ struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage
161 /* actual payload follows */ 145 /* actual payload follows */
162}; 146};
163 147
164GNUNET_NETWORK_STRUCT_END
165
166 148
167/** 149/**
150 * Message from the WLAN helper to the plugin: we have received the given message with the
151 * given performance characteristics.
152 */
153/**
168 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos 154 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos
169 */ 155 */
170struct Radiotap_rx 156struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage
171{ 157{
158
159 /**
160 * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'.
161 */
162 struct GNUNET_MessageHeader header;
163
172 /** 164 /**
173 * FIXME: not initialized properly so far. (supposed to contain 165 * FIXME: not initialized properly so far. (supposed to contain
174 * information about which of the fields below are actually valid). 166 * information about which of the fields below are actually valid).
175 */ 167 */
176 uint32_t ri_present; 168 uint32_t ri_present GNUNET_PACKED;
177 169
178 /** 170 /**
179 * IEEE80211_RADIOTAP_TSFT 171 * IEEE80211_RADIOTAP_TSFT
180 */ 172 */
181 uint64_t ri_mactime; 173 uint64_t ri_mactime GNUNET_PACKED;
182 174
183 /** 175 /**
184 * from radiotap 176 * from radiotap
185 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL 177 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
186 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL 178 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL
187 */ 179 */
188 int32_t ri_power; 180 int32_t ri_power GNUNET_PACKED;
189 181
190 /** 182 /**
191 * either IEEE80211_RADIOTAP_DBM_ANTNOISE 183 * either IEEE80211_RADIOTAP_DBM_ANTNOISE
192 * or IEEE80211_RADIOTAP_DB_ANTNOISE 184 * or IEEE80211_RADIOTAP_DB_ANTNOISE
193 */ 185 */
194 int32_t ri_noise; 186 int32_t ri_noise GNUNET_PACKED;
195 187
196 /** 188 /**
197 * IEEE80211_RADIOTAP_CHANNEL 189 * IEEE80211_RADIOTAP_CHANNEL
198 */ 190 */
199 uint32_t ri_channel; 191 uint32_t ri_channel GNUNET_PACKED;
200 192
201 /** 193 /**
202 * Frequency we use. FIXME: not properly initialized so far! 194 * Frequency we use. FIXME: not properly initialized so far!
203 */ 195 */
204 uint32_t ri_freq; 196 uint32_t ri_freq GNUNET_PACKED;
205 197
206 /** 198 /**
207 * IEEE80211_RADIOTAP_RATE * 50000 199 * IEEE80211_RADIOTAP_RATE * 50000
208 */ 200 */
209 uint32_t ri_rate; 201 uint32_t ri_rate GNUNET_PACKED;
210 202
211 /** 203 /**
212 * IEEE80211_RADIOTAP_ANTENNA 204 * IEEE80211_RADIOTAP_ANTENNA
213 */ 205 */
214 uint32_t ri_antenna; 206 uint32_t ri_antenna GNUNET_PACKED;
207
208 /**
209 * IEEE Frame.
210 */
211 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame;
212
213 /* followed by payload */
214};
215
216GNUNET_NETWORK_STRUCT_END
217
218/**
219 * GNUnet bssid
220 */
221static const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet = {
222 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
215}; 223};
216 224
217 225
226/**
227 * Broadcast MAC
228 */
229static const struct GNUNET_TRANSPORT_WLAN_MacAddress bc_all_mac = {
230 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
231};
218 232
219#endif 233#endif