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
26 #ifndef PLUGIN_TRANSPORT_WLAN
27 #define PLUGIN_TRANSPORT_WLAN
30 #include "gnunet_common.h"
33 * Number fo bytes in a mac address.
35 #define MAC_ADDR_SIZE 6
37 GNUNET_NETWORK_STRUCT_BEGIN
42 struct GNUNET_TRANSPORT_WLAN_MacAddress
44 uint8_t mac[MAC_ADDR_SIZE];
48 * Format of a WLAN Control Message.
50 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage
53 * Message header. Type is
54 * GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL
56 struct GNUNET_MessageHeader hdr;
59 * MAC Address of the local WLAN interface.
61 struct GNUNET_TRANSPORT_WLAN_MacAddress mac;
66 * generic definitions for IEEE 802.11 frames
68 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame
71 * 802.11 Frame Control field,
73 uint16_t frame_control GNUNET_PACKED;
76 * Microseconds to reserve link (duration), 0 by default
78 uint16_t duration GNUNET_PACKED;
81 * Address 1: destination address in ad-hoc mode or AP, BSSID if station,
83 struct GNUNET_TRANSPORT_WLAN_MacAddress addr1;
86 * Address 2: source address if in ad-hoc-mode or station, BSSID if AP
88 struct GNUNET_TRANSPORT_WLAN_MacAddress addr2;
91 * Address 3: BSSID in ad-hoc mode, Destination if station, source if AP
93 struct GNUNET_TRANSPORT_WLAN_MacAddress addr3;
96 * 802.11 sequence control field.
98 uint16_t sequence_control GNUNET_PACKED;
101 * Link layer control (LLC). Set to a GNUnet-specific value.
112 * Message from the plugin to the WLAN helper: send the given message with the
113 * given connection parameters.
115 struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage
119 * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'.
121 struct GNUNET_MessageHeader header;
129 * Antenna; the first antenna is 0.
134 * Transmit power expressed as unitless distance from max power set at factory calibration.
135 * 0 is max power. Monotonically nondecreasing with lower power levels.
137 uint16_t tx_power GNUNET_PACKED;
140 * IEEE Frame to transmit (the sender MAC address will be overwritten by the helper as it does not
141 * trust the plugin to set it correctly).
143 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame;
145 /* actual payload follows */
150 * Message from the WLAN helper to the plugin: we have received the given message with the
151 * given performance characteristics.
154 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos
156 struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage
160 * Type is 'GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA'.
162 struct GNUNET_MessageHeader header;
165 * FIXME: not initialized properly so far. (supposed to contain
166 * information about which of the fields below are actually valid).
168 uint32_t ri_present GNUNET_PACKED;
171 * IEEE80211_RADIOTAP_TSFT
173 uint64_t ri_mactime GNUNET_PACKED;
177 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
178 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL
180 int32_t ri_power GNUNET_PACKED;
183 * either IEEE80211_RADIOTAP_DBM_ANTNOISE
184 * or IEEE80211_RADIOTAP_DB_ANTNOISE
186 int32_t ri_noise GNUNET_PACKED;
189 * IEEE80211_RADIOTAP_CHANNEL
191 uint32_t ri_channel GNUNET_PACKED;
194 * Frequency we use. FIXME: not properly initialized so far!
196 uint32_t ri_freq GNUNET_PACKED;
199 * IEEE80211_RADIOTAP_RATE * 50000
201 uint32_t ri_rate GNUNET_PACKED;
204 * IEEE80211_RADIOTAP_ANTENNA
206 uint32_t ri_antenna GNUNET_PACKED;
211 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame;
213 /* followed by payload */
216 GNUNET_NETWORK_STRUCT_END
221 static const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet = {
222 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
229 static const struct GNUNET_TRANSPORT_WLAN_MacAddress bc_all_mac = {
230 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}