Moep Library  2.0-nc
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
moep80211.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013, 2014 Maurice Leclaire <leclaire@in.tum.de>
3  * Stephan M. Guenther <moepi@moepi.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * See COPYING for more details.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 #ifndef __MOEP80211_MODULES_MOEP80211_H
27 #define __MOEP80211_MODULES_MOEP80211_H
28 
29 #include <stddef.h>
30 
31 #include <moep/dev.h>
32 #include <moep/frame.h>
33 #include <moep/moep_hdr_ext.h>
34 #include <moep/ieee80211_frametypes.h>
35 
36 #include <moep/modules/radio.h>
37 #include <moep/modules/unix.h>
38 
39 
40 /*
41  * Since the frame discritiminator consists of the higher 32bit of third address
42  * field, we have to choose this value s.t. it does not reflect a valid MAC
43  * address. At this thime the best we can do is to chose an OUI and set the
44  * locally administered bit to zero (otherwise there is no OUI and it would be
45  * possible that we encounter this address by accident). Since the IANA does
46  * not produce many NICs to our knowledge, we use their OUI and make sure by
47  * means of the 4th octet, that the address is currently unassigned.
48  * See http://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xml
49  */
50 #define MOEP80211_FRAME_DISCRIMINATOR 0xff5e0000
51 
52 
53 /*
54  * Generic moep80211 header:
55  * The structure strictly follows the IEEE802.11 3-address data frame format,
56  * except for the third address field that is redefined. The higher 32bit are
57  * used to differentiate between IEEE80211 and moep80211 frames. This is done by
58  * setting the discriminator field to MOEP80211_FRAME_DISCRIMINATOR. The lower
59  * 16bit are used as transmitter-specific sequence number, which is used for
60  * channel estimation.
61  */
62 struct moep80211_hdr {
63  u16 frame_control;
64  u16 duration_id;
65  u8 ra[IEEE80211_ALEN];
66  u8 ta[IEEE80211_ALEN];
67  u32 disc;
68  u16 txseq;
69  u16 seq_ctrl;
70 } __attribute__((packed));
71 
72 
79 
108 moep_dev_t moep_dev_moep80211_open(const char *devname, u32 freq,
109  enum moep80211_chan_width chan_width,
110  u32 freq1, u32 freq2, int mtu);
111 
135 moep_dev_t moep_dev_moep80211_unix_open(const char *devname, int mtu);
136 
151 
166 
185 
187 #endif /* __MOEP80211_MODULES_MOEP80211_H */
struct moep_frame * moep_frame_t
a moep frame
Definition: frame.h:45
moep_frame_t moep_frame_moep80211_unix_create(void)
create a moep80211 unix frame
moep80211_chan_width
channel width definition
Definition: radio.h:37
moep_dev_t moep_dev_moep80211_unix_open(const char *devname, int mtu)
open a moep80211 unix device
void moep_set_moep80211_discriminator(u32 d)
set the moep80211 discriminator
struct moep_dev * moep_dev_t
a moep device
Definition: dev.h:46
struct moep80211_hdr * moep_frame_moep80211_hdr(moep_frame_t frame)
moep80211 header
moep_frame_t moep_frame_moep80211_create(void)
create a moep80211 frame
moep_dev_t moep_dev_moep80211_open(const char *devname, u32 freq, enum moep80211_chan_width chan_width, u32 freq1, u32 freq2, int mtu)
open a moep80211 device
Definition: moep80211.h:62