c870e4d657f9372eeb7cf40c4027707e21facd4d
[oweals/gnunet.git] / src / transport / plugin_transport_wlan.h
1 /*
2      This file is part of GNUnet
3      (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20
21 /**
22  * @file transport/plugin_transport_wlan.h
23  * @brief header for transport plugin and the helper for wlan
24  * @author David Brodski
25  */
26
27 #include "gnunet_common.h"
28
29 typedef unsigned int uint32_t;
30 typedef unsigned short uint16_t;
31
32 /* Wlan IEEE80211 header default */
33 static const uint8_t u8aIeeeHeader[] = {
34         0x08, 0x01, 0x00, 0x00,
35         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
36         0x13, 0x22, 0x33, 0x44, 0x55, 0x66,
37         0x13, 0x22, 0x33, 0x44, 0x55, 0x66,
38         0x10, 0x86,
39 };
40
41 /**
42  * Wlan header
43  */
44
45 struct IeeeHeader
46 {
47         /**
48          * Wlan flags
49          */
50         uint8_t flags[4] GNUNET_PACKED;
51
52         /**
53          * first mac
54          */
55         uint8_t mac1[6] GNUNET_PACKED;
56
57         /**
58          * second mac
59          */
60         uint8_t mac2[6] GNUNET_PACKED;
61
62         /**
63          * third mac
64          */
65         uint8_t mac3[6] GNUNET_PACKED;
66
67         /**
68          * Wlan flags2
69          */
70         uint8_t flags2[2] GNUNET_PACKED;
71 };
72
73 /* this is the template radiotap header we send packets out with */
74
75 static const uint8_t u8aRadiotapHeader[] = {
76
77         0x00, 0x00, // <-- radiotap version
78         0x19, 0x00, // <- radiotap header length
79         0x6f, 0x08, 0x00, 0x00, // <-- bitmap
80         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <-- timestamp
81         0x00, // <-- flags (Offset +0x10)
82         0x6c, // <-- rate (0ffset +0x11)
83         0x71, 0x09, 0xc0, 0x00, // <-- channel
84         0xde, // <-- antsignal
85         0x00, // <-- antnoise
86         0x01, // <-- antenna
87
88 };
89
90 /**
91  * Radiotap Header
92  */
93
94 struct RadiotapHeader
95 {
96         /**
97          * radiotap version
98          */
99         uint8_t version[2] GNUNET_PACKED;
100
101         /**
102          * radiotap header length
103          */
104         uint8_t lenght[2] GNUNET_PACKED;
105
106         /**
107          * bitmap
108          */
109         uint8_t bitmap[4] GNUNET_PACKED;
110
111         /**
112          * timestamp
113          */
114         uint8_t timestamp[8] GNUNET_PACKED;
115
116         /**
117          * radiotap flags
118          */
119         uint8_t flags GNUNET_PACKED;
120
121         /**
122          * wlan send rate
123          */
124         uint8_t rate GNUNET_PACKED;
125
126         /**
127          * Wlan channel
128          */
129         uint8_t channel[4] GNUNET_PACKED;
130
131         /**
132          * antsignal
133          */
134         uint8_t antsignal GNUNET_PACKED;
135
136         /**
137          * antnoise
138          */
139         uint8_t antnoise GNUNET_PACKED;
140
141         /**
142          * antenna
143          */
144         uint8_t antenna GNUNET_PACKED;
145 };
146