aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_wlan.h')
-rw-r--r--src/transport/plugin_transport_wlan.h146
1 files changed, 30 insertions, 116 deletions
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h
index 7f6668cd3..5a88cb836 100644
--- a/src/transport/plugin_transport_wlan.h
+++ b/src/transport/plugin_transport_wlan.h
@@ -23,7 +23,6 @@
23 * @brief header for transport plugin and the helper for wlan 23 * @brief header for transport plugin and the helper for wlan
24 * @author David Brodski 24 * @author David Brodski
25 */ 25 */
26
27#ifndef PLUGIN_TRANSPORT_WLAN 26#ifndef PLUGIN_TRANSPORT_WLAN
28#define PLUGIN_TRANSPORT_WLAN 27#define PLUGIN_TRANSPORT_WLAN
29 28
@@ -35,81 +34,47 @@
35 */ 34 */
36#define MAC_ADDR_SIZE 6 35#define MAC_ADDR_SIZE 6
37 36
37/**
38 * A MAC Address.
39 */
38struct MacAddress 40struct MacAddress
39{ 41{
40 uint8_t mac[MAC_ADDR_SIZE]; 42 uint8_t mac[MAC_ADDR_SIZE];
41}; 43};
42 44
43struct Wlan_Helper_Control_Message
44{
45 struct GNUNET_MessageHeader hdr;
46 struct MacAddress mac;
47};
48
49 45
50/** 46/**
51 * Header for messages which need fragmentation 47 * Format of a WLAN Control Message.
52 */ 48 */
53struct WlanHeader 49struct Wlan_Helper_Control_Message
54{ 50{
55
56 struct GNUNET_MessageHeader header;
57
58 /**
59 * checksum/error correction
60 */
61 uint32_t crc GNUNET_PACKED;
62
63 /** 51 /**
64 * To whom are we talking to (set to our identity 52 * Message header. FIXME: type?
65 * if we are still waiting for the welcome message)
66 */ 53 */
67 struct GNUNET_PeerIdentity target; 54 struct GNUNET_MessageHeader hdr;
68 55
69 /** 56 /**
70 * Where the packet came from 57 * MAC Address. FIXME: of what?
71 */ 58 */
72 struct GNUNET_PeerIdentity source; 59 struct MacAddress mac;
73
74// followed by payload
75
76}; 60};
77 61
78/* Wlan IEEE80211 header default */
79//Informations (in German) http://www.umtslink.at/content/WLAN_macheader-196.html
80static 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
88};
89 62
90// gnunet bssid 63/**
64 * GNUnet bssid
65 */
91static const struct MacAddress mac_bssid = { 66static const struct MacAddress mac_bssid = {
92 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66} 67 {0x13, 0x22, 0x33, 0x44, 0x55, 0x66}
93}; 68};
94 69
95// broadcast mac 70
71/**
72 * Broadcast MAC
73 */
96static const struct MacAddress bc_all_mac = { 74static const struct MacAddress bc_all_mac = {
97 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} 75 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
98}; 76};
99 77
100/* this is the template radiotap header we send packets out with */
101
102static 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
111 0x01, // <-- antenna
112};
113 78
114struct Radiotap_Send 79struct Radiotap_Send
115{ 80{
@@ -119,7 +84,7 @@ struct Radiotap_Send
119 uint8_t rate; 84 uint8_t rate;
120 85
121 /** 86 /**
122 * antenna 87 * Antenna; the first antenna is 0.
123 */ 88 */
124 uint8_t antenna; 89 uint8_t antenna;
125 90
@@ -127,111 +92,60 @@ struct Radiotap_Send
127 * Transmit power expressed as unitless distance from max power set at factory calibration. 92 * Transmit power expressed as unitless distance from max power set at factory calibration.
128 * 0 is max power. Monotonically nondecreasing with lower power levels. 93 * 0 is max power. Monotonically nondecreasing with lower power levels.
129 */ 94 */
130
131 uint16_t tx_power; 95 uint16_t tx_power;
132}; 96};
133 97
134// bit field defines for ri_present
135
136#define has_noise 1
137#define has_power 2
138#define has_channel 4
139 98
140/** 99/**
141 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos 100 * struct to represent infos gathered form the radiotap fields, see RadiotapHeader for more Infos
142 */ 101 */
143
144struct Radiotap_rx 102struct Radiotap_rx
145{ 103{
104 /**
105 * FIXME: not initialized properly so far. (supposed to contain
106 * information about which of the fields below are actually valid).
107 */
146 uint32_t ri_present; 108 uint32_t ri_present;
109
147 /** 110 /**
148 * IEEE80211_RADIOTAP_TSFT 111 * IEEE80211_RADIOTAP_TSFT
149 */ 112 */
150 uint64_t ri_mactime; 113 uint64_t ri_mactime;
114
151 /** 115 /**
152 * from radiotap 116 * from radiotap
153 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL 117 * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
154 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL 118 * or IEEE80211_RADIOTAP_DB_ANTSIGNAL
155 */ 119 */
156 int32_t ri_power; 120 int32_t ri_power;
121
157 /** 122 /**
158 * either IEEE80211_RADIOTAP_DBM_ANTNOISE 123 * either IEEE80211_RADIOTAP_DBM_ANTNOISE
159 * or IEEE80211_RADIOTAP_DB_ANTNOISE 124 * or IEEE80211_RADIOTAP_DB_ANTNOISE
160 */ 125 */
161 int32_t ri_noise; 126 int32_t ri_noise;
127
162 /** 128 /**
163 * IEEE80211_RADIOTAP_CHANNEL 129 * IEEE80211_RADIOTAP_CHANNEL
164 */ 130 */
165 uint32_t ri_channel; 131 uint32_t ri_channel;
166 132
133 /**
134 * Frequency we use. FIXME: not properly initialized so far!
135 */
167 uint32_t ri_freq; 136 uint32_t ri_freq;
137
168 /** 138 /**
169 * IEEE80211_RADIOTAP_RATE * 50000 139 * IEEE80211_RADIOTAP_RATE * 50000
170 */ 140 */
171 uint32_t ri_rate; 141 uint32_t ri_rate;
142
172 /** 143 /**
173 * IEEE80211_RADIOTAP_ANTENNA 144 * IEEE80211_RADIOTAP_ANTENNA
174 */ 145 */
175 uint32_t ri_antenna; 146 uint32_t ri_antenna;
176}; 147};
177 148
178/**
179 * Radiotap Header
180 */
181struct RadiotapHeader
182{
183 /**
184 * radiotap version
185 */
186 u_int8_t version;
187
188 u_int8_t pad_version;
189
190 /**
191 * radiotap header length
192 */
193 uint16_t length GNUNET_PACKED;
194
195 /**
196 * bitmap, fields present
197 */
198 uint32_t bitmap GNUNET_PACKED;
199
200 /**
201 * timestamp
202 */
203 uint64_t timestamp GNUNET_PACKED;
204
205 /**
206 * radiotap flags
207 */
208 uint8_t flags;
209 149
210 /**
211 * wlan send rate
212 */
213 uint8_t rate;
214
215 // FIXME: unaligned here, is this OK?
216 /**
217 * Wlan channel
218 */
219 uint32_t channel GNUNET_PACKED;
220
221 /**
222 * antsignal
223 */
224 uint8_t antsignal;
225
226 /**
227 * antnoise
228 */
229 uint8_t antnoise;
230
231 /**
232 * antenna
233 */
234 uint8_t antenna;
235};
236 150
237#endif 151#endif