hostap_80211.h 2.5 KB
Newer Older
J
Jouni Malinen 已提交
1 2 3
#ifndef HOSTAP_80211_H
#define HOSTAP_80211_H

4 5 6
#include <linux/types.h>
#include <net/ieee80211_crypt.h>

J
Jouni Malinen 已提交
7
struct hostap_ieee80211_mgmt {
A
Al Viro 已提交
8 9
	__le16 frame_control;
	__le16 duration;
J
Jouni Malinen 已提交
10 11 12
	u8 da[6];
	u8 sa[6];
	u8 bssid[6];
A
Al Viro 已提交
13
	__le16 seq_ctrl;
J
Jouni Malinen 已提交
14 15
	union {
		struct {
A
Al Viro 已提交
16 17 18
			__le16 auth_alg;
			__le16 auth_transaction;
			__le16 status_code;
J
Jouni Malinen 已提交
19 20 21 22
			/* possibly followed by Challenge text */
			u8 variable[0];
		} __attribute__ ((packed)) auth;
		struct {
A
Al Viro 已提交
23
			__le16 reason_code;
J
Jouni Malinen 已提交
24 25
		} __attribute__ ((packed)) deauth;
		struct {
A
Al Viro 已提交
26 27
			__le16 capab_info;
			__le16 listen_interval;
J
Jouni Malinen 已提交
28 29 30 31
			/* followed by SSID and Supported rates */
			u8 variable[0];
		} __attribute__ ((packed)) assoc_req;
		struct {
A
Al Viro 已提交
32 33 34
			__le16 capab_info;
			__le16 status_code;
			__le16 aid;
J
Jouni Malinen 已提交
35 36 37 38
			/* followed by Supported rates */
			u8 variable[0];
		} __attribute__ ((packed)) assoc_resp, reassoc_resp;
		struct {
A
Al Viro 已提交
39 40
			__le16 capab_info;
			__le16 listen_interval;
J
Jouni Malinen 已提交
41 42 43 44 45
			u8 current_ap[6];
			/* followed by SSID and Supported rates */
			u8 variable[0];
		} __attribute__ ((packed)) reassoc_req;
		struct {
A
Al Viro 已提交
46
			__le16 reason_code;
J
Jouni Malinen 已提交
47 48 49 50 51
		} __attribute__ ((packed)) disassoc;
		struct {
		} __attribute__ ((packed)) probe_req;
		struct {
			u8 timestamp[8];
A
Al Viro 已提交
52 53
			__le16 beacon_int;
			__le16 capab_info;
J
Jouni Malinen 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
			/* followed by some of SSID, Supported rates,
			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
			u8 variable[0];
		} __attribute__ ((packed)) beacon, probe_resp;
	} u;
} __attribute__ ((packed));


#define IEEE80211_MGMT_HDR_LEN 24
#define IEEE80211_DATA_HDR3_LEN 24
#define IEEE80211_DATA_HDR4_LEN 30


struct hostap_80211_rx_status {
	u32 mac_time;
	u8 signal;
	u8 noise;
	u16 rate; /* in 100 kbps */
};


void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
		     struct hostap_80211_rx_status *rx_stats);


/* prism2_rx_80211 'type' argument */
enum {
	PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC,
	PRISM2_RX_NULLFUNC_ACK
};

int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
		    struct hostap_80211_rx_status *rx_stats, int type);
void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
		     struct hostap_80211_rx_status *rx_stats);
void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
			  struct hostap_80211_rx_status *rx_stats);

void hostap_dump_tx_80211(const char *name, struct sk_buff *skb);
int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev);
int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev);

#endif /* HOSTAP_80211_H */