linux/drivers/net/wireless/intel/ipw2x00/libipw.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Merged with mainline ieee80211.h in Aug 2004.  Original ieee802_11
 * remains copyright by the original authors
 *
 * Portions of the merged code are based on Host AP (software wireless
 * LAN access point) driver for Intersil Prism2/2.5/3.
 *
 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
 * <[email protected]>
 * Copyright (c) 2002-2003, Jouni Malinen <[email protected]>
 *
 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
 * <[email protected]>
 * Copyright (c) 2004-2005, Intel Corporation
 *
 * API Version History
 * 1.0.x -- Initial version
 * 1.1.x -- Added radiotap, QoS, TIM, libipw_geo APIs,
 *          various structure changes, and crypto API init method
 */
#ifndef LIBIPW_H
#define LIBIPW_H
#include <linux/if_ether.h>	/* ETH_ALEN */
#include <linux/kernel.h>	/* ARRAY_SIZE */
#include <linux/wireless.h>
#include <linux/ieee80211.h>

#include <net/lib80211.h>
#include <net/cfg80211.h>

#define LIBIPW_VERSION

#define LIBIPW_DATA_LEN
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
   6.2.1.1.2.

   The figure in section 7.1.2 suggests a body size of up to 2312
   bytes is allowed, which is a bit confusing, I suspect this
   represents the 2304 bytes of real data, plus a possible 8 bytes of
   WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */

#define LIBIPW_1ADDR_LEN
#define LIBIPW_2ADDR_LEN
#define LIBIPW_3ADDR_LEN
#define LIBIPW_4ADDR_LEN
#define LIBIPW_FCS_LEN
#define LIBIPW_HLEN
#define LIBIPW_FRAME_LEN

#define MIN_FRAG_THRESHOLD
#define MAX_FRAG_THRESHOLD

/* QOS control */
#define LIBIPW_QCTL_TID

/* debug macros */

#ifdef CONFIG_LIBIPW_DEBUG
extern u32 libipw_debug_level;
#define LIBIPW_DEBUG(level, fmt, args...)
#else
#define LIBIPW_DEBUG
#endif				/* CONFIG_LIBIPW_DEBUG */

/*
 * To use the debug system:
 *
 * If you are defining a new debug classification, simply add it to the #define
 * list here in the form of:
 *
 * #define LIBIPW_DL_xxxx VALUE
 *
 * shifting value to the left one bit from the previous entry.  xxxx should be
 * the name of the classification (for example, WEP)
 *
 * You then need to either add a LIBIPW_xxxx_DEBUG() macro definition for your
 * classification, or use LIBIPW_DEBUG(LIBIPW_DL_xxxx, ...) whenever you want
 * to send output to that classification.
 *
 * To add your debug level to the list of levels seen when you perform
 *
 * % cat /proc/net/ieee80211/debug_level
 *
 * you simply need to add your entry to the libipw_debug_level array.
 *
 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
 * CONFIG_LIBIPW_DEBUG defined in your kernel configuration
 *
 */

#define LIBIPW_DL_INFO
#define LIBIPW_DL_WX
#define LIBIPW_DL_SCAN
#define LIBIPW_DL_STATE
#define LIBIPW_DL_MGMT
#define LIBIPW_DL_FRAG
#define LIBIPW_DL_DROP

#define LIBIPW_DL_TX
#define LIBIPW_DL_RX
#define LIBIPW_DL_QOS

#define LIBIPW_ERROR(f, a...)
#define LIBIPW_WARNING(f, a...)
#define LIBIPW_DEBUG_INFO(f, a...)

#define LIBIPW_DEBUG_WX(f, a...)
#define LIBIPW_DEBUG_SCAN(f, a...)
#define LIBIPW_DEBUG_STATE(f, a...)
#define LIBIPW_DEBUG_MGMT(f, a...)
#define LIBIPW_DEBUG_FRAG(f, a...)
#define LIBIPW_DEBUG_DROP(f, a...)
#define LIBIPW_DEBUG_TX(f, a...)
#define LIBIPW_DEBUG_RX(f, a...)
#define LIBIPW_DEBUG_QOS(f, a...)
#include <linux/netdevice.h>
#include <linux/if_arp.h>	/* ARPHRD_ETHER */

#ifndef WIRELESS_SPY
#define WIRELESS_SPY
#endif
#include <net/iw_handler.h>	/* new driver API */

#define ETH_P_PREAUTH

#ifndef ETH_P_80211_RAW
#define ETH_P_80211_RAW
#endif

/* IEEE 802.11 defines */

#define P80211_OUI_LEN

struct libipw_snap_hdr {} __packed;

#define SNAP_SIZE

#define WLAN_FC_GET_VERS(fc)
#define WLAN_FC_GET_TYPE(fc)
#define WLAN_FC_GET_STYPE(fc)

#define WLAN_GET_SEQ_FRAG(seq)
#define WLAN_GET_SEQ_SEQ(seq)

#define LIBIPW_STATMASK_SIGNAL
#define LIBIPW_STATMASK_RSSI
#define LIBIPW_STATMASK_NOISE
#define LIBIPW_STATMASK_RATE
#define LIBIPW_STATMASK_WEMASK

#define LIBIPW_CCK_MODULATION
#define LIBIPW_OFDM_MODULATION

#define LIBIPW_24GHZ_BAND
#define LIBIPW_52GHZ_BAND

#define LIBIPW_CCK_RATE_1MB
#define LIBIPW_CCK_RATE_2MB
#define LIBIPW_CCK_RATE_5MB
#define LIBIPW_CCK_RATE_11MB
#define LIBIPW_OFDM_RATE_6MB
#define LIBIPW_OFDM_RATE_9MB
#define LIBIPW_OFDM_RATE_12MB
#define LIBIPW_OFDM_RATE_18MB
#define LIBIPW_OFDM_RATE_24MB
#define LIBIPW_OFDM_RATE_36MB
#define LIBIPW_OFDM_RATE_48MB
#define LIBIPW_OFDM_RATE_54MB
#define LIBIPW_BASIC_RATE_MASK

#define LIBIPW_CCK_RATE_1MB_MASK
#define LIBIPW_CCK_RATE_2MB_MASK
#define LIBIPW_CCK_RATE_5MB_MASK
#define LIBIPW_CCK_RATE_11MB_MASK
#define LIBIPW_OFDM_RATE_6MB_MASK
#define LIBIPW_OFDM_RATE_9MB_MASK
#define LIBIPW_OFDM_RATE_12MB_MASK
#define LIBIPW_OFDM_RATE_18MB_MASK
#define LIBIPW_OFDM_RATE_24MB_MASK
#define LIBIPW_OFDM_RATE_36MB_MASK
#define LIBIPW_OFDM_RATE_48MB_MASK
#define LIBIPW_OFDM_RATE_54MB_MASK

#define LIBIPW_CCK_RATES_MASK
#define LIBIPW_CCK_BASIC_RATES_MASK
#define LIBIPW_CCK_DEFAULT_RATES_MASK

#define LIBIPW_OFDM_RATES_MASK
#define LIBIPW_OFDM_BASIC_RATES_MASK
#define LIBIPW_OFDM_DEFAULT_RATES_MASK
#define LIBIPW_DEFAULT_RATES_MASK

#define LIBIPW_NUM_OFDM_RATES
#define LIBIPW_NUM_CCK_RATES
#define LIBIPW_OFDM_SHIFT_MASK_A

/* NOTE: This data is for statistical purposes; not all hardware provides this
 *       information for frames received.
 *       For libipw_rx_mgt, you need to set at least the 'len' parameter.
 */
struct libipw_rx_stats {};

/* IEEE 802.11 requires that STA supports concurrent reception of at least
 * three fragmented frames. This define can be increased to support more
 * concurrent frames, but it should be noted that each entry can consume about
 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
#define LIBIPW_FRAG_CACHE_LEN

struct libipw_frag_entry {};

struct libipw_stats {};

struct libipw_device;

#define SEC_KEY_1
#define SEC_KEY_2
#define SEC_KEY_3
#define SEC_KEY_4
#define SEC_ACTIVE_KEY
#define SEC_AUTH_MODE
#define SEC_UNICAST_GROUP
#define SEC_LEVEL
#define SEC_ENABLED
#define SEC_ENCRYPT

#define SEC_LEVEL_0
#define SEC_LEVEL_1
#define SEC_LEVEL_2
#define SEC_LEVEL_2_CKIP
#define SEC_LEVEL_3

#define SEC_ALG_NONE
#define SEC_ALG_WEP
#define SEC_ALG_TKIP
#define SEC_ALG_CCMP

#define WEP_KEYS
#define WEP_KEY_LEN
#define SCM_KEY_LEN
#define SCM_TEMPORAL_KEY_LENGTH

struct libipw_security {} __packed;

/*

 802.11 data frame from AP

      ,-------------------------------------------------------------------.
Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
      |------|------|---------|---------|---------|------|---------|------|
Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
      |      | tion | (BSSID) |         |         | ence |  data   |      |
      `-------------------------------------------------------------------'

Total: 28-2340 bytes

*/

#define BEACON_PROBE_SSID_ID_POSITION

struct libipw_hdr_1addr {} __packed;

struct libipw_hdr_2addr {} __packed;

struct libipw_hdr_3addr {} __packed;

struct libipw_hdr_4addr {} __packed;

struct libipw_hdr_3addrqos {} __packed;

struct libipw_info_element {} __packed;

/*
 * These are the data types that can make up management packets
 *
	u16 auth_algorithm;
	u16 auth_sequence;
	u16 beacon_interval;
	u16 capability;
	u8 current_ap[ETH_ALEN];
	u16 listen_interval;
	struct {
		u16 association_id:14, reserved:2;
	} __packed;
	u32 time_stamp[2];
	u16 reason;
	u16 status;
*/

struct libipw_auth {} __packed;

struct libipw_channel_switch {} __packed;

struct libipw_action {} __packed;

struct libipw_disassoc {} __packed;

/* Alias deauth for disassoc */
#define libipw_deauth

struct libipw_probe_request {} __packed;

struct libipw_probe_response {} __packed;

/* Alias beacon for probe_response */
#define libipw_beacon

struct libipw_assoc_request {} __packed;

struct libipw_reassoc_request {} __packed;

struct libipw_assoc_response {} __packed;

struct libipw_txb {};

/* SWEEP TABLE ENTRIES NUMBER */
#define MAX_SWEEP_TAB_ENTRIES
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET
/* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
 * only use 8, and then use extended rates for the remaining supported
 * rates.  Other APs, however, stick all of their supported rates on the
 * main rates information element... */
#define MAX_RATES_LENGTH
#define MAX_RATES_EX_LENGTH
#define MAX_NETWORK_COUNT

#define CRC_LENGTH

#define MAX_WPA_IE_LEN

#define NETWORK_HAS_OFDM
#define NETWORK_HAS_CCK

/* QoS structure */
#define NETWORK_HAS_QOS_PARAMETERS
#define NETWORK_HAS_QOS_INFORMATION
#define NETWORK_HAS_QOS_MASK

/* 802.11h */
#define NETWORK_HAS_POWER_CONSTRAINT
#define NETWORK_HAS_CSA
#define NETWORK_HAS_QUIET
#define NETWORK_HAS_IBSS_DFS
#define NETWORK_HAS_TPC_REPORT

#define NETWORK_HAS_ERP_VALUE

#define QOS_QUEUE_NUM
#define QOS_OUI_LEN
#define QOS_OUI_TYPE
#define QOS_ELEMENT_ID
#define QOS_OUI_INFO_SUB_TYPE
#define QOS_OUI_PARAM_SUB_TYPE
#define QOS_VERSION_1
#define QOS_AIFSN_MIN_VALUE

struct libipw_qos_information_element {} __packed;

struct libipw_qos_ac_parameter {} __packed;

struct libipw_qos_parameter_info {} __packed;

struct libipw_qos_parameters {} __packed;

struct libipw_qos_data {};

struct libipw_tim_parameters {} __packed;

/*******************************************************/

struct libipw_tpc_report {} __packed;

struct libipw_channel_map {} __packed;

struct libipw_ibss_dfs {};

struct libipw_csa {} __packed;

struct libipw_quiet {} __packed;

struct libipw_network {};

enum libipw_state {};

#define DEFAULT_MAX_SCAN_AGE
#define DEFAULT_FTS

#define CFG_LIBIPW_RESERVE_FCS
#define CFG_LIBIPW_COMPUTE_FCS
#define CFG_LIBIPW_RTS

#define LIBIPW_24GHZ_MIN_CHANNEL
#define LIBIPW_24GHZ_MAX_CHANNEL
#define LIBIPW_24GHZ_CHANNELS

#define LIBIPW_52GHZ_MIN_CHANNEL
#define LIBIPW_52GHZ_MAX_CHANNEL
#define LIBIPW_52GHZ_CHANNELS

enum {};

struct libipw_channel {};

struct libipw_geo {};

struct libipw_device {};

#define IEEE_A
#define IEEE_B
#define IEEE_G
#define IEEE_MODE_MASK

static inline void *libipw_priv(struct net_device *dev)
{}

static inline int libipw_is_valid_mode(struct libipw_device *ieee,
					  int mode)
{}

static inline int libipw_get_hdrlen(u16 fc)
{}

static inline u8 *libipw_get_payload(struct ieee80211_hdr *hdr)
{}

static inline int libipw_is_ofdm_rate(u8 rate)
{}

static inline int libipw_is_cck_rate(u8 rate)
{}

/* libipw.c */
void free_libipw(struct net_device *dev, int monitor);
struct net_device *alloc_libipw(int sizeof_priv, int monitor);

void libipw_networks_age(struct libipw_device *ieee, unsigned long age_secs);

int libipw_set_encryption(struct libipw_device *ieee);

/* libipw_tx.c */
netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev);
void libipw_txb_free(struct libipw_txb *);

/* libipw_rx.c */
void libipw_rx_any(struct libipw_device *ieee, struct sk_buff *skb,
		   struct libipw_rx_stats *stats);
int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,
	      struct libipw_rx_stats *rx_stats);
/* make sure to set stats->len */
void libipw_rx_mgt(struct libipw_device *ieee, struct libipw_hdr_4addr *header,
		   struct libipw_rx_stats *stats);

/* libipw_geo.c */
const struct libipw_geo *libipw_get_geo(struct libipw_device *ieee);
void libipw_set_geo(struct libipw_device *ieee, const struct libipw_geo *geo);

int libipw_is_valid_channel(struct libipw_device *ieee, u8 channel);
int libipw_channel_to_index(struct libipw_device *ieee, u8 channel);
u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq);
u8 libipw_get_channel_flags(struct libipw_device *ieee, u8 channel);
const struct libipw_channel *libipw_get_channel(struct libipw_device *ieee,
						u8 channel);
u32 libipw_channel_to_freq(struct libipw_device *ieee, u8 channel);

/* libipw_wx.c */
int libipw_wx_get_scan(struct libipw_device *ieee, struct iw_request_info *info,
		       union iwreq_data *wrqu, char *key);
int libipw_wx_set_encode(struct libipw_device *ieee,
			 struct iw_request_info *info, union iwreq_data *wrqu,
			 char *key);
int libipw_wx_get_encode(struct libipw_device *ieee,
			 struct iw_request_info *info, union iwreq_data *wrqu,
			 char *key);
int libipw_wx_set_encodeext(struct libipw_device *ieee,
			    struct iw_request_info *info,
			    union iwreq_data *wrqu, char *extra);
int libipw_wx_get_encodeext(struct libipw_device *ieee,
			    struct iw_request_info *info,
			    union iwreq_data *wrqu, char *extra);

static inline void libipw_increment_scans(struct libipw_device *ieee)
{}

static inline int libipw_get_scans(struct libipw_device *ieee)
{}

#endif				/* LIBIPW_H */