2 This file is part of GNUnet
3 (C) 2010, 2011 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
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
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file transport/plugin_transport_wlan.h
23 * @brief header for transport plugin and the helper for wlan
24 * @author David Brodski
27 #ifndef PLUGIN_TRANSPORT_WLAN
28 #define PLUGIN_TRANSPORT_WLAN
31 #include "gnunet_common.h"
34 * Number fo bytes in a mac address.
36 #define MAC_ADDR_SIZE 6
40 uint8_t mac[MAC_ADDR_SIZE];
43 struct Wlan_Helper_Control_Message
45 struct GNUNET_MessageHeader hdr;
46 struct MacAddress mac;
51 * Header for messages which need fragmentation
56 struct GNUNET_MessageHeader header;
59 * checksum/error correction
61 uint32_t crc GNUNET_PACKED;
64 * To whom are we talking to (set to our identity
65 * if we are still waiting for the welcome message)
67 struct GNUNET_PeerIdentity target;
70 * Where the packet came from
72 struct GNUNET_PeerIdentity source;
74 // followed by payload
78 /* Wlan IEEE80211 header default */
79 //Informations (in German) http://www.umtslink.at/content/WLAN_macheader-196.html
80 static const uint8_t u8aIeeeHeader[] = { 0x08, 0x01, // Frame Control 0x08= 00001000 -> | b1,2 = 0 -> Version 0;
81 // b3,4 = 10 -> Data; b5-8 = 0 -> Normal Data
82 // 0x01 = 00000001 -> | b1 = 1 to DS; b2 = 0 not from DS;
83 0x00, 0x00, // Duration/ID
84 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // mac1 - in this case receiver
85 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac2 - in this case sender
86 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac3 - in this case bssid
87 0x10, 0x86, //Sequence Control
91 static const struct MacAddress mac_bssid = {
92 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
96 static const struct MacAddress bc_all_mac = {
97 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
100 /* this is the template radiotap header we send packets out with */
102 static const uint8_t u8aRadiotapHeader[] = { 0x00, 0x00, // <-- radiotap version
103 0x19, 0x00, // <- radiotap header length
104 0x6f, 0x08, 0x00, 0x00, // <-- bitmap
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <-- timestamp
106 0x00, // <-- flags (Offset +0x10)
107 0x6c, // <-- rate (0ffset +0x11)
108 0x71, 0x09, 0xc0, 0x00, // <-- channel
109 0xde, // <-- antsignal
110 0x00, // <-- antnoise
127 * Transmit power expressed as unitless distance from max power set at factory calibration.
128 * 0 is max power. Monotonically nondecreasing with lower power levels.
134 // bit field defines for ri_present
138 #define has_channel 4
141 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos
148 * IEEE80211_RADIOTAP_TSFT
153 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
154 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL
158 * either IEEE80211_RADIOTAP_DBM_ANTNOISE
159 * or IEEE80211_RADIOTAP_DB_ANTNOISE
163 * IEEE80211_RADIOTAP_CHANNEL
169 * IEEE80211_RADIOTAP_RATE * 50000
173 * IEEE80211_RADIOTAP_ANTENNA
181 struct RadiotapHeader
188 u_int8_t pad_version;
191 * radiotap header length
193 uint16_t length GNUNET_PACKED;
196 * bitmap, fields present
198 uint32_t bitmap GNUNET_PACKED;
203 uint64_t timestamp GNUNET_PACKED;
215 // FIXME: unaligned here, is this OK?
219 uint32_t channel GNUNET_PACKED;