#ifndef HOSTAP_WLAN_H
#define HOSTAP_WLAN_H
#include <linux/wireless.h>
#include <linux/netdevice.h>
#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <net/ieee80211_radiotap.h>
#include "hostap_config.h"
#include "hostap_common.h"
#define MAX_PARM_DEVICES 8
#define PARM_MIN_MAX "1-" __MODULE_STRING(MAX_PARM_DEVICES)
#define DEF_INTS -1, -1, -1, -1, -1, -1, -1
#define GET_INT_PARM(var,idx) var[var[idx] < 0 ? 0 : idx]
/* Specific skb->protocol value that indicates that the packet already contains
* txdesc header.
* FIX: This might need own value that would be allocated especially for Prism2
* txdesc; ETH_P_CONTROL is commented as "Card specific control frames".
* However, these skb's should have only minimal path in the kernel side since
* prism2_send_mgmt() sends these with dev_queue_xmit() to prism2_tx(). */
#define ETH_P_HOSTAP ETH_P_CONTROL
/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
* (from linux-wlan-ng) */
struct linux_wlan_ng_val {
u32 did;
u16 status, len;
u32 data;
} __attribute__ ((packed));
struct linux_wlan_ng_prism_hdr {
u32 msgcode, msglen;
char devname[16];
struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
noise, rate, istx, frmlen;
} __attribute__ ((packed));
struct linux_wlan_ng_cap_hdr {
__be32 version;
__be32 length;
__be64 mactime;
__be64 hosttime;
__be32 phytype;
__be32 channel;
__be32 datarate;
__be32 antenna;
__be32 priority;
__be32 ssi_type;
__be32 ssi_signal;
__be32 ssi_noise;
__be32 preamble;
__be32 encoding;
} __attribute__ ((packed));
struct hostap_radiotap_rx {
struct ieee80211_radiotap_header hdr;
__le64 tsft;
u8 rate;
u8 padding;
__le16 chan_freq;
__le16 chan_flags;
s8 dbm_antsignal;
s8 dbm_antnoise;
} __attribute__ ((packed));
#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
#define LWNG_CAPHDR_VERSION 0x80211001
struct hfa384x_rx_frame {
/* HFA384X RX frame descriptor */
__le16 status; /* HFA384X_RX_STATUS_ flags */
__le32 time; /* timestamp, 1 microsecond resolution */
u8 silence; /* 27 .. 154; seems to be 0 */
u8 signal; /* 27 .. 154 */
u8 rate; /* 10, 20, 55, or 110 */
u8 rxflow;
__le32 reserved;
/* 802.11 */
__le16 frame_control;
__le16 duration_id;
u8 addr1[6];
u8 addr2[6];
u8 addr3[6];
__le16 seq_ctrl;
u8 addr4[6];
__le16 data_len;
/* 802.3 */
u8 dst_addr[6];
u8 src_addr[6];
__be16 len;
/* followed by frame data; max 2304 bytes */
} __attribute__ ((packed));
struct hfa384x_tx_frame {
/* HFA384X TX frame descriptor */
__le16 status; /* HFA384X_TX_STATUS_ flags */
__le16 reserved1;
__le16 reserved2;
__le32 sw_support;
u8 retry_count; /* not yet implemented */
u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */
__le16 tx_control; /* HFA384X_TX_CTRL_ flags */
/* 802.11 */
__le16 frame_control; /* parts not used */
__le16 duration_id;
u8 addr1[6];
u8 addr2[6]; /* filled by firmware */
u8 addr3[6];
__le16 seq_ctrl; /* filled by firmware */
u8 addr4[6];
__le16 data_len;
/* 802.3 */
u8 dst_addr[6];
u8 src_addr[6];
__be16 len;
/* followed by frame data; max 2304 bytes */
} __attribute__ ((packed));
struct hfa384x_rid_hdr
{
__le16 len;
__le16 rid;
} __attribute__ ((packed));
/* Macro for converting signal levels (range 27 .. 154) to wireless ext
* dBm value with some accuracy */
#define HFA384X_LEVEL_TO_dBm(v) 0x100 + (v) * 100 / 255 - 100
#define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100
struct hfa384x_scan_request {
__le16 channel_list;
__le16 txrate; /* HFA384X_RATES_* */
} __attribute__ ((packed));
struct hfa384x_hostscan_request {
__le16 channel_list;
__le16 txrate;
__le16 target_ssid_len;
u8 target_ssid[32];
} __attribute__ ((packed));
struct hfa384x_join_request {
u8 bssid[6];
__le16 channel;
} __attribute__ ((packed));
struct hfa384x_info_frame {
__le16 len;
__le16 type;
} __attribute__ ((packed));
struct hfa384x_comm_tallies {
__le16 tx_unicast_frames;
__le16 tx_multicast_frames;
__le16 tx_fragments;
__le16 tx_unicast_octets;
__le16 tx_multicast_octets;
__le16 tx_deferred_transmissions;
__le16 tx_single_retry_frames;
__le16 tx_multiple_retry_frames;
__le16 tx_retry_limit_exceeded;
__le16 tx_discards;