18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef HOSTAP_80211_H
38c2ecf20Sopenharmony_ci#define HOSTAP_80211_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
78c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct hostap_ieee80211_mgmt {
108c2ecf20Sopenharmony_ci	__le16 frame_control;
118c2ecf20Sopenharmony_ci	__le16 duration;
128c2ecf20Sopenharmony_ci	u8 da[6];
138c2ecf20Sopenharmony_ci	u8 sa[6];
148c2ecf20Sopenharmony_ci	u8 bssid[6];
158c2ecf20Sopenharmony_ci	__le16 seq_ctrl;
168c2ecf20Sopenharmony_ci	union {
178c2ecf20Sopenharmony_ci		struct {
188c2ecf20Sopenharmony_ci			__le16 auth_alg;
198c2ecf20Sopenharmony_ci			__le16 auth_transaction;
208c2ecf20Sopenharmony_ci			__le16 status_code;
218c2ecf20Sopenharmony_ci			/* possibly followed by Challenge text */
228c2ecf20Sopenharmony_ci			u8 variable[0];
238c2ecf20Sopenharmony_ci		} __packed auth;
248c2ecf20Sopenharmony_ci		struct {
258c2ecf20Sopenharmony_ci			__le16 reason_code;
268c2ecf20Sopenharmony_ci		} __packed deauth;
278c2ecf20Sopenharmony_ci		struct {
288c2ecf20Sopenharmony_ci			__le16 capab_info;
298c2ecf20Sopenharmony_ci			__le16 listen_interval;
308c2ecf20Sopenharmony_ci			/* followed by SSID and Supported rates */
318c2ecf20Sopenharmony_ci			u8 variable[0];
328c2ecf20Sopenharmony_ci		} __packed assoc_req;
338c2ecf20Sopenharmony_ci		struct {
348c2ecf20Sopenharmony_ci			__le16 capab_info;
358c2ecf20Sopenharmony_ci			__le16 status_code;
368c2ecf20Sopenharmony_ci			__le16 aid;
378c2ecf20Sopenharmony_ci			/* followed by Supported rates */
388c2ecf20Sopenharmony_ci			u8 variable[0];
398c2ecf20Sopenharmony_ci		} __packed assoc_resp, reassoc_resp;
408c2ecf20Sopenharmony_ci		struct {
418c2ecf20Sopenharmony_ci			__le16 capab_info;
428c2ecf20Sopenharmony_ci			__le16 listen_interval;
438c2ecf20Sopenharmony_ci			u8 current_ap[6];
448c2ecf20Sopenharmony_ci			/* followed by SSID and Supported rates */
458c2ecf20Sopenharmony_ci			u8 variable[0];
468c2ecf20Sopenharmony_ci		} __packed reassoc_req;
478c2ecf20Sopenharmony_ci		struct {
488c2ecf20Sopenharmony_ci			__le16 reason_code;
498c2ecf20Sopenharmony_ci		} __packed disassoc;
508c2ecf20Sopenharmony_ci		struct {
518c2ecf20Sopenharmony_ci		} __packed probe_req;
528c2ecf20Sopenharmony_ci		struct {
538c2ecf20Sopenharmony_ci			u8 timestamp[8];
548c2ecf20Sopenharmony_ci			__le16 beacon_int;
558c2ecf20Sopenharmony_ci			__le16 capab_info;
568c2ecf20Sopenharmony_ci			/* followed by some of SSID, Supported rates,
578c2ecf20Sopenharmony_ci			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
588c2ecf20Sopenharmony_ci			u8 variable[0];
598c2ecf20Sopenharmony_ci		} __packed beacon, probe_resp;
608c2ecf20Sopenharmony_ci	} u;
618c2ecf20Sopenharmony_ci} __packed;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define IEEE80211_MGMT_HDR_LEN 24
658c2ecf20Sopenharmony_ci#define IEEE80211_DATA_HDR3_LEN 24
668c2ecf20Sopenharmony_ci#define IEEE80211_DATA_HDR4_LEN 30
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cistruct hostap_80211_rx_status {
708c2ecf20Sopenharmony_ci	u32 mac_time;
718c2ecf20Sopenharmony_ci	u8 signal;
728c2ecf20Sopenharmony_ci	u8 noise;
738c2ecf20Sopenharmony_ci	u16 rate; /* in 100 kbps */
748c2ecf20Sopenharmony_ci};
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* prism2_rx_80211 'type' argument */
778c2ecf20Sopenharmony_cienum {
788c2ecf20Sopenharmony_ci	PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC,
798c2ecf20Sopenharmony_ci	PRISM2_RX_NULLFUNC_ACK
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciint prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
838c2ecf20Sopenharmony_ci		    struct hostap_80211_rx_status *rx_stats, int type);
848c2ecf20Sopenharmony_civoid hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
858c2ecf20Sopenharmony_ci		     struct hostap_80211_rx_status *rx_stats);
868c2ecf20Sopenharmony_civoid hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
878c2ecf20Sopenharmony_ci			  struct hostap_80211_rx_status *rx_stats);
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_civoid hostap_dump_tx_80211(const char *name, struct sk_buff *skb);
908c2ecf20Sopenharmony_cinetdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
918c2ecf20Sopenharmony_ci				   struct net_device *dev);
928c2ecf20Sopenharmony_cinetdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb,
938c2ecf20Sopenharmony_ci				   struct net_device *dev);
948c2ecf20Sopenharmony_cinetdev_tx_t hostap_master_start_xmit(struct sk_buff *skb,
958c2ecf20Sopenharmony_ci				     struct net_device *dev);
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#endif /* HOSTAP_80211_H */
98