diff options
author | David Brodski <david@brodski.eu> | 2011-07-12 21:34:34 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2011-07-12 21:34:34 +0000 |
commit | c584d8950bda4b27ccc2fa03de2cee23a8ae56d2 (patch) | |
tree | 8156e7a7557b9578f99f973805fa329b5dfeeb81 /src/transport/plugin_transport_wlan.h | |
parent | ad04126c71ef4de17657391ecc656d5bfd32f5fd (diff) | |
download | gnunet-c584d8950bda4b27ccc2fa03de2cee23a8ae56d2.tar.gz gnunet-c584d8950bda4b27ccc2fa03de2cee23a8ae56d2.zip |
one wlan card is now usable with more than one peer, wlan header format changed so be careful and do not mix protocol versions. Some cleanup and formating.
Diffstat (limited to 'src/transport/plugin_transport_wlan.h')
-rw-r--r-- | src/transport/plugin_transport_wlan.h | 157 |
1 files changed, 80 insertions, 77 deletions
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h index 3baa4d79d..5c86c5bd0 100644 --- a/src/transport/plugin_transport_wlan.h +++ b/src/transport/plugin_transport_wlan.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.h | 22 | * @file transport/plugin_transport_wlan.h |
@@ -30,8 +30,6 @@ | |||
30 | #include <stdint.h> | 30 | #include <stdint.h> |
31 | #include "gnunet_common.h" | 31 | #include "gnunet_common.h" |
32 | 32 | ||
33 | |||
34 | |||
35 | struct MacAddress | 33 | struct MacAddress |
36 | { | 34 | { |
37 | u_int8_t mac[6]; | 35 | u_int8_t mac[6]; |
@@ -89,67 +87,71 @@ struct WlanHeader | |||
89 | */ | 87 | */ |
90 | struct GNUNET_PeerIdentity target; | 88 | struct GNUNET_PeerIdentity target; |
91 | 89 | ||
90 | /** | ||
91 | * Where the packet came from | ||
92 | */ | ||
93 | struct GNUNET_PeerIdentity source; | ||
94 | |||
92 | // followed by payload | 95 | // followed by payload |
93 | 96 | ||
94 | }; | 97 | }; |
95 | 98 | ||
96 | /* Wlan IEEE80211 header default */ | 99 | /* Wlan IEEE80211 header default */ |
97 | //Informations (in German) http://www.umtslink.at/content/WLAN_macheader-196.html | 100 | //Informations (in German) http://www.umtslink.at/content/WLAN_macheader-196.html |
98 | static const uint8_t u8aIeeeHeader[] = | 101 | static const uint8_t u8aIeeeHeader[] = |
99 | { | 102 | { 0x08, 0x01, // Frame Control 0x08= 00001000 -> | b1,2 = 0 -> Version 0; |
100 | 0x08, 0x01, // Frame Control 0x08= 00001000 -> | b1,2 = 0 -> Version 0; | 103 | // b3,4 = 10 -> Data; b5-8 = 0 -> Normal Data |
101 | // b3,4 = 10 -> Data; b5-8 = 0 -> Normal Data | 104 | // 0x01 = 00000001 -> | b1 = 1 to DS; b2 = 0 not from DS; |
102 | // 0x01 = 00000001 -> | b1 = 1 to DS; b2 = 0 not from DS; | 105 | 0x00, 0x00, // Duration/ID |
103 | 0x00, 0x00, // Duration/ID | 106 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // mac1 - in this case receiver |
104 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // mac1 - in this case receiver | 107 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac2 - in this case sender |
105 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac2 - in this case sender | 108 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac3 - in this case bssid |
106 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, // mac3 - in this case bssid | 109 | 0x10, 0x86, //Sequence Control |
107 | 0x10, 0x86, //Sequence Control | 110 | }; |
108 | }; | ||
109 | 111 | ||
110 | // gnunet bssid | 112 | // gnunet bssid |
111 | static const struct MacAddress mac_bssid = | 113 | static const struct MacAddress mac_bssid = |
112 | { { 0x13, 0x22, 0x33, 0x44, 0x55, 0x66 } } ; | 114 | { |
115 | { 0x13, 0x22, 0x33, 0x44, 0x55, 0x66 } }; | ||
113 | 116 | ||
114 | // broadcast mac | 117 | // broadcast mac |
115 | static const struct MacAddress bc_all_mac = | 118 | static const struct MacAddress bc_all_mac = |
116 | { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; | 119 | { |
117 | 120 | { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; | |
118 | 121 | ||
119 | /* this is the template radiotap header we send packets out with */ | 122 | /* this is the template radiotap header we send packets out with */ |
120 | 123 | ||
121 | static const uint8_t u8aRadiotapHeader[] = | 124 | static const uint8_t u8aRadiotapHeader[] = |
122 | { | 125 | { 0x00, 0x00, // <-- radiotap version |
123 | 0x00, 0x00, // <-- radiotap version | 126 | 0x19, 0x00, // <- radiotap header length |
124 | 0x19, 0x00, // <- radiotap header length | 127 | 0x6f, 0x08, 0x00, 0x00, // <-- bitmap |
125 | 0x6f, 0x08, 0x00, 0x00, // <-- bitmap | 128 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <-- timestamp |
126 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <-- timestamp | 129 | 0x00, // <-- flags (Offset +0x10) |
127 | 0x00, // <-- flags (Offset +0x10) | 130 | 0x6c, // <-- rate (0ffset +0x11) |
128 | 0x6c, // <-- rate (0ffset +0x11) | 131 | 0x71, 0x09, 0xc0, 0x00, // <-- channel |
129 | 0x71, 0x09, 0xc0, 0x00, // <-- channel | 132 | 0xde, // <-- antsignal |
130 | 0xde, // <-- antsignal | 133 | 0x00, // <-- antnoise |
131 | 0x00, // <-- antnoise | 134 | 0x01, // <-- antenna |
132 | 0x01, // <-- antenna | 135 | }; |
133 | }; | ||
134 | 136 | ||
135 | struct Radiotap_Send | 137 | struct Radiotap_Send |
136 | { | 138 | { |
137 | /** | 139 | /** |
138 | * wlan send rate | 140 | * wlan send rate |
139 | */ | 141 | */ |
140 | uint8_t rate; | 142 | uint8_t rate; |
141 | 143 | ||
142 | /** | 144 | /** |
143 | * antenna | 145 | * antenna |
144 | */ | 146 | */ |
145 | uint8_t antenna; | 147 | uint8_t antenna; |
146 | 148 | ||
147 | /** | 149 | /** |
148 | * Transmit power expressed as unitless distance from max power set at factory calibration. | 150 | * Transmit power expressed as unitless distance from max power set at factory calibration. |
149 | * 0 is max power. Monotonically nondecreasing with lower power levels. | 151 | * 0 is max power. Monotonically nondecreasing with lower power levels. |
150 | */ | 152 | */ |
151 | 153 | ||
152 | uint16_t tx_power; | 154 | uint16_t tx_power; |
153 | }; | 155 | }; |
154 | 156 | ||
155 | // bit field defines for ri_present | 157 | // bit field defines for ri_present |
@@ -162,15 +164,16 @@ struct Radiotap_Send | |||
162 | * struct to represent infos gathered form the radiotap fields | 164 | * struct to represent infos gathered form the radiotap fields |
163 | */ | 165 | */ |
164 | 166 | ||
165 | struct Radiotap_rx { | 167 | struct Radiotap_rx |
166 | uint32_t ri_present; | 168 | { |
167 | uint64_t ri_mactime; | 169 | uint32_t ri_present; |
168 | int32_t ri_power; | 170 | uint64_t ri_mactime; |
169 | int32_t ri_noise; | 171 | int32_t ri_power; |
170 | uint32_t ri_channel; | 172 | int32_t ri_noise; |
171 | uint32_t ri_freq; | 173 | uint32_t ri_channel; |
172 | uint32_t ri_rate; | 174 | uint32_t ri_freq; |
173 | uint32_t ri_antenna; | 175 | uint32_t ri_rate; |
176 | uint32_t ri_antenna; | ||
174 | }; | 177 | }; |
175 | 178 | ||
176 | /** | 179 | /** |
@@ -184,48 +187,48 @@ struct RadiotapHeader | |||
184 | u_int8_t version; | 187 | u_int8_t version; |
185 | 188 | ||
186 | u_int8_t pad_version; | 189 | u_int8_t pad_version; |
187 | 190 | ||
188 | /** | 191 | /** |
189 | * radiotap header length | 192 | * radiotap header length |
190 | */ | 193 | */ |
191 | uint16_t length GNUNET_PACKED; | 194 | uint16_t length GNUNET_PACKED; |
192 | 195 | ||
193 | /** | 196 | /** |
194 | * bitmap, fields present | 197 | * bitmap, fields present |
195 | */ | 198 | */ |
196 | uint32_t bitmap GNUNET_PACKED; | 199 | uint32_t bitmap GNUNET_PACKED; |
197 | 200 | ||
198 | /** | 201 | /** |
199 | * timestamp | 202 | * timestamp |
200 | */ | 203 | */ |
201 | uint64_t timestamp GNUNET_PACKED; | 204 | uint64_t timestamp GNUNET_PACKED; |
202 | 205 | ||
203 | /** | 206 | /** |
204 | * radiotap flags | 207 | * radiotap flags |
205 | */ | 208 | */ |
206 | uint8_t flags; | 209 | uint8_t flags; |
207 | 210 | ||
208 | /** | 211 | /** |
209 | * wlan send rate | 212 | * wlan send rate |
210 | */ | 213 | */ |
211 | uint8_t rate; | 214 | uint8_t rate; |
212 | 215 | ||
213 | // FIXME: unaligned here, is this OK? | 216 | // FIXME: unaligned here, is this OK? |
214 | /** | 217 | /** |
215 | * Wlan channel | 218 | * Wlan channel |
216 | */ | 219 | */ |
217 | uint32_t channel GNUNET_PACKED; | 220 | uint32_t channel GNUNET_PACKED; |
218 | 221 | ||
219 | /** | 222 | /** |
220 | * antsignal | 223 | * antsignal |
221 | */ | 224 | */ |
222 | uint8_t antsignal; | 225 | uint8_t antsignal; |
223 | 226 | ||
224 | /** | 227 | /** |
225 | * antnoise | 228 | * antnoise |
226 | */ | 229 | */ |
227 | uint8_t antnoise; | 230 | uint8_t antnoise; |
228 | 231 | ||
229 | /** | 232 | /** |
230 | * antenna | 233 | * antenna |
231 | */ | 234 | */ |