1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef HOSTAP_80211_H
3 #define HOSTAP_80211_H
4 
5 #include <linux/types.h>
6 #include <linux/skbuff.h>
7 #include <linux/netdevice.h>
8 
9 struct hostap_ieee80211_mgmt {
10 	__le16 frame_control;
11 	__le16 duration;
12 	u8 da[6];
13 	u8 sa[6];
14 	u8 bssid[6];
15 	__le16 seq_ctrl;
16 	union {
17 		struct {
18 			__le16 auth_alg;
19 			__le16 auth_transaction;
20 			__le16 status_code;
21 			/* possibly followed by Challenge text */
22 			u8 variable[0];
23 		} __packed auth;
24 		struct {
25 			__le16 reason_code;
26 		} __packed deauth;
27 		struct {
28 			__le16 capab_info;
29 			__le16 listen_interval;
30 			/* followed by SSID and Supported rates */
31 			u8 variable[0];
32 		} __packed assoc_req;
33 		struct {
34 			__le16 capab_info;
35 			__le16 status_code;
36 			__le16 aid;
37 			/* followed by Supported rates */
38 			u8 variable[0];
39 		} __packed assoc_resp, reassoc_resp;
40 		struct {
41 			__le16 capab_info;
42 			__le16 listen_interval;
43 			u8 current_ap[6];
44 			/* followed by SSID and Supported rates */
45 			u8 variable[0];
46 		} __packed reassoc_req;
47 		struct {
48 			__le16 reason_code;
49 		} __packed disassoc;
50 		struct {
51 		} __packed probe_req;
52 		struct {
53 			u8 timestamp[8];
54 			__le16 beacon_int;
55 			__le16 capab_info;
56 			/* followed by some of SSID, Supported rates,
57 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
58 			u8 variable[0];
59 		} __packed beacon, probe_resp;
60 	} u;
61 } __packed;
62 
63 
64 #define IEEE80211_MGMT_HDR_LEN 24
65 #define IEEE80211_DATA_HDR3_LEN 24
66 #define IEEE80211_DATA_HDR4_LEN 30
67 
68 
69 struct hostap_80211_rx_status {
70 	u32 mac_time;
71 	u8 signal;
72 	u8 noise;
73 	u16 rate; /* in 100 kbps */
74 };
75 
76 /* prism2_rx_80211 'type' argument */
77 enum {
78 	PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC,
79 	PRISM2_RX_NULLFUNC_ACK
80 };
81 
82 int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
83 		    struct hostap_80211_rx_status *rx_stats, int type);
84 void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
85 		     struct hostap_80211_rx_status *rx_stats);
86 void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
87 			  struct hostap_80211_rx_status *rx_stats);
88 
89 void hostap_dump_tx_80211(const char *name, struct sk_buff *skb);
90 netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
91 				   struct net_device *dev);
92 netdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb,
93 				   struct net_device *dev);
94 netdev_tx_t hostap_master_start_xmit(struct sk_buff *skb,
95 				     struct net_device *dev);
96 
97 #endif /* HOSTAP_80211_H */
98