mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
add updated mac80211 - this no longer relies on patching includes in the kernel trees, but just uses its own instead
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9290 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* IEEE 802.11 defines
|
||||
*
|
||||
* Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
|
||||
* <jkmaline@cc.hut.fi>
|
||||
* Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
|
||||
* Copyright (c) 2005, Devicescape Software, Inc.
|
||||
* Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_H
|
||||
#define IEEE80211_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define FCS_LEN 4
|
||||
|
||||
#define IEEE80211_FCTL_VERS 0x0003
|
||||
#define IEEE80211_FCTL_FTYPE 0x000c
|
||||
#define IEEE80211_FCTL_STYPE 0x00f0
|
||||
#define IEEE80211_FCTL_TODS 0x0100
|
||||
#define IEEE80211_FCTL_FROMDS 0x0200
|
||||
#define IEEE80211_FCTL_MOREFRAGS 0x0400
|
||||
#define IEEE80211_FCTL_RETRY 0x0800
|
||||
#define IEEE80211_FCTL_PM 0x1000
|
||||
#define IEEE80211_FCTL_MOREDATA 0x2000
|
||||
#define IEEE80211_FCTL_PROTECTED 0x4000
|
||||
#define IEEE80211_FCTL_ORDER 0x8000
|
||||
|
||||
#define IEEE80211_SCTL_FRAG 0x000F
|
||||
#define IEEE80211_SCTL_SEQ 0xFFF0
|
||||
|
||||
#define IEEE80211_FTYPE_MGMT 0x0000
|
||||
#define IEEE80211_FTYPE_CTL 0x0004
|
||||
#define IEEE80211_FTYPE_DATA 0x0008
|
||||
|
||||
/* management */
|
||||
#define IEEE80211_STYPE_ASSOC_REQ 0x0000
|
||||
#define IEEE80211_STYPE_ASSOC_RESP 0x0010
|
||||
#define IEEE80211_STYPE_REASSOC_REQ 0x0020
|
||||
#define IEEE80211_STYPE_REASSOC_RESP 0x0030
|
||||
#define IEEE80211_STYPE_PROBE_REQ 0x0040
|
||||
#define IEEE80211_STYPE_PROBE_RESP 0x0050
|
||||
#define IEEE80211_STYPE_BEACON 0x0080
|
||||
#define IEEE80211_STYPE_ATIM 0x0090
|
||||
#define IEEE80211_STYPE_DISASSOC 0x00A0
|
||||
#define IEEE80211_STYPE_AUTH 0x00B0
|
||||
#define IEEE80211_STYPE_DEAUTH 0x00C0
|
||||
#define IEEE80211_STYPE_ACTION 0x00D0
|
||||
|
||||
/* control */
|
||||
#define IEEE80211_STYPE_PSPOLL 0x00A0
|
||||
#define IEEE80211_STYPE_RTS 0x00B0
|
||||
#define IEEE80211_STYPE_CTS 0x00C0
|
||||
#define IEEE80211_STYPE_ACK 0x00D0
|
||||
#define IEEE80211_STYPE_CFEND 0x00E0
|
||||
#define IEEE80211_STYPE_CFENDACK 0x00F0
|
||||
|
||||
/* data */
|
||||
#define IEEE80211_STYPE_DATA 0x0000
|
||||
#define IEEE80211_STYPE_DATA_CFACK 0x0010
|
||||
#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
|
||||
#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
|
||||
#define IEEE80211_STYPE_NULLFUNC 0x0040
|
||||
#define IEEE80211_STYPE_CFACK 0x0050
|
||||
#define IEEE80211_STYPE_CFPOLL 0x0060
|
||||
#define IEEE80211_STYPE_CFACKPOLL 0x0070
|
||||
#define IEEE80211_STYPE_QOS_DATA 0x0080
|
||||
#define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
|
||||
#define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
|
||||
#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
|
||||
#define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
|
||||
#define IEEE80211_STYPE_QOS_CFACK 0x00D0
|
||||
#define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
|
||||
#define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
|
||||
|
||||
|
||||
/* miscellaneous IEEE 802.11 constants */
|
||||
#define IEEE80211_MAX_FRAG_THRESHOLD 2346
|
||||
#define IEEE80211_MAX_RTS_THRESHOLD 2347
|
||||
#define IEEE80211_MAX_AID 2007
|
||||
#define IEEE80211_MAX_TIM_LEN 251
|
||||
#define IEEE80211_MAX_DATA_LEN 2304
|
||||
/* 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 IEEE80211_MAX_SSID_LEN 32
|
||||
|
||||
struct ieee80211_hdr {
|
||||
__le16 frame_control;
|
||||
__le16 duration_id;
|
||||
u8 addr1[6];
|
||||
u8 addr2[6];
|
||||
u8 addr3[6];
|
||||
__le16 seq_ctrl;
|
||||
u8 addr4[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct ieee80211_mgmt {
|
||||
__le16 frame_control;
|
||||
__le16 duration;
|
||||
u8 da[6];
|
||||
u8 sa[6];
|
||||
u8 bssid[6];
|
||||
__le16 seq_ctrl;
|
||||
union {
|
||||
struct {
|
||||
__le16 auth_alg;
|
||||
__le16 auth_transaction;
|
||||
__le16 status_code;
|
||||
/* possibly followed by Challenge text */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) auth;
|
||||
struct {
|
||||
__le16 reason_code;
|
||||
} __attribute__ ((packed)) deauth;
|
||||
struct {
|
||||
__le16 capab_info;
|
||||
__le16 listen_interval;
|
||||
/* followed by SSID and Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) assoc_req;
|
||||
struct {
|
||||
__le16 capab_info;
|
||||
__le16 status_code;
|
||||
__le16 aid;
|
||||
/* followed by Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) assoc_resp, reassoc_resp;
|
||||
struct {
|
||||
__le16 capab_info;
|
||||
__le16 listen_interval;
|
||||
u8 current_ap[6];
|
||||
/* followed by SSID and Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) reassoc_req;
|
||||
struct {
|
||||
__le16 reason_code;
|
||||
} __attribute__ ((packed)) disassoc;
|
||||
struct {
|
||||
__le64 timestamp;
|
||||
__le16 beacon_int;
|
||||
__le16 capab_info;
|
||||
/* followed by some of SSID, Supported rates,
|
||||
* FH Params, DS Params, CF Params, IBSS Params, TIM */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) beacon;
|
||||
struct {
|
||||
/* only variable items: SSID, Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) probe_req;
|
||||
struct {
|
||||
__le64 timestamp;
|
||||
__le16 beacon_int;
|
||||
__le16 capab_info;
|
||||
/* followed by some of SSID, Supported rates,
|
||||
* FH Params, DS Params, CF Params, IBSS Params */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) probe_resp;
|
||||
struct {
|
||||
u8 category;
|
||||
union {
|
||||
struct {
|
||||
u8 action_code;
|
||||
u8 dialog_token;
|
||||
u8 status_code;
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) wme_action;
|
||||
struct{
|
||||
u8 action_code;
|
||||
u8 element_id;
|
||||
u8 length;
|
||||
u8 switch_mode;
|
||||
u8 new_chan;
|
||||
u8 switch_count;
|
||||
} __attribute__((packed)) chan_switch;
|
||||
} u;
|
||||
} __attribute__ ((packed)) action;
|
||||
} u;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Control frames */
|
||||
struct ieee80211_rts {
|
||||
__le16 frame_control;
|
||||
__le16 duration;
|
||||
u8 ra[6];
|
||||
u8 ta[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ieee80211_cts {
|
||||
__le16 frame_control;
|
||||
__le16 duration;
|
||||
u8 ra[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Authentication algorithms */
|
||||
#define WLAN_AUTH_OPEN 0
|
||||
#define WLAN_AUTH_SHARED_KEY 1
|
||||
#define WLAN_AUTH_FAST_BSS_TRANSITION 2
|
||||
#define WLAN_AUTH_LEAP 128
|
||||
|
||||
#define WLAN_AUTH_CHALLENGE_LEN 128
|
||||
|
||||
#define WLAN_CAPABILITY_ESS (1<<0)
|
||||
#define WLAN_CAPABILITY_IBSS (1<<1)
|
||||
#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
|
||||
#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
|
||||
#define WLAN_CAPABILITY_PRIVACY (1<<4)
|
||||
#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
|
||||
#define WLAN_CAPABILITY_PBCC (1<<6)
|
||||
#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
|
||||
/* 802.11h */
|
||||
#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
|
||||
#define WLAN_CAPABILITY_QOS (1<<9)
|
||||
#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
|
||||
#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
|
||||
|
||||
/* 802.11g ERP information element */
|
||||
#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
|
||||
#define WLAN_ERP_USE_PROTECTION (1<<1)
|
||||
#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
|
||||
|
||||
/* WLAN_ERP_BARKER_PREAMBLE values */
|
||||
enum {
|
||||
WLAN_ERP_PREAMBLE_SHORT = 0,
|
||||
WLAN_ERP_PREAMBLE_LONG = 1,
|
||||
};
|
||||
|
||||
/* Status codes */
|
||||
enum ieee80211_statuscode {
|
||||
WLAN_STATUS_SUCCESS = 0,
|
||||
WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
|
||||
WLAN_STATUS_CAPS_UNSUPPORTED = 10,
|
||||
WLAN_STATUS_REASSOC_NO_ASSOC = 11,
|
||||
WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
|
||||
WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
|
||||
WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
|
||||
WLAN_STATUS_CHALLENGE_FAIL = 15,
|
||||
WLAN_STATUS_AUTH_TIMEOUT = 16,
|
||||
WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
|
||||
WLAN_STATUS_ASSOC_DENIED_RATES = 18,
|
||||
/* 802.11b */
|
||||
WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
|
||||
WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
|
||||
WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
|
||||
/* 802.11h */
|
||||
WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
|
||||
WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
|
||||
WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
|
||||
/* 802.11g */
|
||||
WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
|
||||
WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
|
||||
/* 802.11i */
|
||||
WLAN_STATUS_INVALID_IE = 40,
|
||||
WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
|
||||
WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
|
||||
WLAN_STATUS_INVALID_AKMP = 43,
|
||||
WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
|
||||
WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
|
||||
WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
|
||||
};
|
||||
|
||||
|
||||
/* Reason codes */
|
||||
enum ieee80211_reasoncode {
|
||||
WLAN_REASON_UNSPECIFIED = 1,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
|
||||
WLAN_REASON_DEAUTH_LEAVING = 3,
|
||||
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
|
||||
WLAN_REASON_DISASSOC_AP_BUSY = 5,
|
||||
WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
|
||||
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
|
||||
WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
|
||||
WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
|
||||
/* 802.11h */
|
||||
WLAN_REASON_DISASSOC_BAD_POWER = 10,
|
||||
WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
|
||||
/* 802.11i */
|
||||
WLAN_REASON_INVALID_IE = 13,
|
||||
WLAN_REASON_MIC_FAILURE = 14,
|
||||
WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
|
||||
WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
|
||||
WLAN_REASON_IE_DIFFERENT = 17,
|
||||
WLAN_REASON_INVALID_GROUP_CIPHER = 18,
|
||||
WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
|
||||
WLAN_REASON_INVALID_AKMP = 20,
|
||||
WLAN_REASON_UNSUPP_RSN_VERSION = 21,
|
||||
WLAN_REASON_INVALID_RSN_IE_CAP = 22,
|
||||
WLAN_REASON_IEEE8021X_FAILED = 23,
|
||||
WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
|
||||
};
|
||||
|
||||
|
||||
/* Information Element IDs */
|
||||
enum ieee80211_eid {
|
||||
WLAN_EID_SSID = 0,
|
||||
WLAN_EID_SUPP_RATES = 1,
|
||||
WLAN_EID_FH_PARAMS = 2,
|
||||
WLAN_EID_DS_PARAMS = 3,
|
||||
WLAN_EID_CF_PARAMS = 4,
|
||||
WLAN_EID_TIM = 5,
|
||||
WLAN_EID_IBSS_PARAMS = 6,
|
||||
WLAN_EID_CHALLENGE = 16,
|
||||
/* 802.11d */
|
||||
WLAN_EID_COUNTRY = 7,
|
||||
WLAN_EID_HP_PARAMS = 8,
|
||||
WLAN_EID_HP_TABLE = 9,
|
||||
WLAN_EID_REQUEST = 10,
|
||||
/* 802.11h */
|
||||
WLAN_EID_PWR_CONSTRAINT = 32,
|
||||
WLAN_EID_PWR_CAPABILITY = 33,
|
||||
WLAN_EID_TPC_REQUEST = 34,
|
||||
WLAN_EID_TPC_REPORT = 35,
|
||||
WLAN_EID_SUPPORTED_CHANNELS = 36,
|
||||
WLAN_EID_CHANNEL_SWITCH = 37,
|
||||
WLAN_EID_MEASURE_REQUEST = 38,
|
||||
WLAN_EID_MEASURE_REPORT = 39,
|
||||
WLAN_EID_QUIET = 40,
|
||||
WLAN_EID_IBSS_DFS = 41,
|
||||
/* 802.11g */
|
||||
WLAN_EID_ERP_INFO = 42,
|
||||
WLAN_EID_EXT_SUPP_RATES = 50,
|
||||
/* 802.11i */
|
||||
WLAN_EID_RSN = 48,
|
||||
WLAN_EID_WPA = 221,
|
||||
WLAN_EID_GENERIC = 221,
|
||||
WLAN_EID_VENDOR_SPECIFIC = 221,
|
||||
WLAN_EID_QOS_PARAMETER = 222
|
||||
};
|
||||
|
||||
/* cipher suite selectors */
|
||||
#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
|
||||
#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
|
||||
#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
|
||||
/* reserved: 0x000FAC03 */
|
||||
#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
|
||||
#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
|
||||
|
||||
#define WLAN_MAX_KEY_LEN 32
|
||||
|
||||
/**
|
||||
* ieee80211_get_SA - get pointer to SA
|
||||
*
|
||||
* Given an 802.11 frame, this function returns the offset
|
||||
* to the source address (SA). It does not verify that the
|
||||
* header is long enough to contain the address, and the
|
||||
* header must be long enough to contain the frame control
|
||||
* field.
|
||||
*
|
||||
* @hdr: the frame
|
||||
*/
|
||||
static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
u8 *raw = (u8 *) hdr;
|
||||
u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
|
||||
|
||||
switch (tofrom) {
|
||||
case 2:
|
||||
return hdr->addr3;
|
||||
case 3:
|
||||
return hdr->addr4;
|
||||
}
|
||||
return hdr->addr2;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_get_DA - get pointer to DA
|
||||
*
|
||||
* Given an 802.11 frame, this function returns the offset
|
||||
* to the destination address (DA). It does not verify that
|
||||
* the header is long enough to contain the address, and the
|
||||
* header must be long enough to contain the frame control
|
||||
* field.
|
||||
*
|
||||
* @hdr: the frame
|
||||
*/
|
||||
static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
u8 *raw = (u8 *) hdr;
|
||||
u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
|
||||
|
||||
if (to_ds)
|
||||
return hdr->addr3;
|
||||
return hdr->addr1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
|
||||
*
|
||||
* This function determines whether the "more fragments" bit is set
|
||||
* in the frame.
|
||||
*
|
||||
* @hdr: the frame
|
||||
*/
|
||||
static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
return (le16_to_cpu(hdr->frame_control) &
|
||||
IEEE80211_FCTL_MOREFRAGS) != 0;
|
||||
}
|
||||
|
||||
#endif /* IEEE80211_H */
|
||||
@@ -0,0 +1,129 @@
|
||||
#ifndef __LINUX_NL80211_H
|
||||
#define __LINUX_NL80211_H
|
||||
/*
|
||||
* 802.11 netlink interface public header
|
||||
*
|
||||
* Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
* enum nl80211_commands - supported nl80211 commands
|
||||
*
|
||||
* @NL80211_CMD_UNSPEC: unspecified command to catch errors
|
||||
*
|
||||
* @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
|
||||
* to get a list of all present wiphys.
|
||||
* @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and
|
||||
* %NL80211_ATTR_WIPHY_NAME.
|
||||
* @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
|
||||
* or rename notification. Has attributes %NL80211_ATTR_WIPHY and
|
||||
* %NL80211_ATTR_WIPHY_NAME.
|
||||
* @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes
|
||||
* %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
|
||||
*
|
||||
* @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
|
||||
* either a dump request on a %NL80211_ATTR_WIPHY or a specific get
|
||||
* on an %NL80211_ATTR_IFINDEX is supported.
|
||||
* @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
|
||||
%NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
|
||||
* @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
|
||||
* to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
|
||||
* %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
|
||||
* be sent from userspace to request creation of a new virtual interface,
|
||||
* then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
|
||||
* %NL80211_ATTR_IFNAME.
|
||||
* @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
|
||||
* %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
|
||||
* userspace to request deletion of a virtual interface, then requires
|
||||
* attribute %NL80211_ATTR_IFINDEX.
|
||||
*
|
||||
* @NL80211_CMD_MAX: highest used command number
|
||||
* @__NL80211_CMD_AFTER_LAST: internal use
|
||||
*/
|
||||
enum nl80211_commands {
|
||||
/* don't change the order or add anything inbetween, this is ABI! */
|
||||
NL80211_CMD_UNSPEC,
|
||||
|
||||
NL80211_CMD_GET_WIPHY, /* can dump */
|
||||
NL80211_CMD_SET_WIPHY,
|
||||
NL80211_CMD_NEW_WIPHY,
|
||||
NL80211_CMD_DEL_WIPHY,
|
||||
|
||||
NL80211_CMD_GET_INTERFACE, /* can dump */
|
||||
NL80211_CMD_SET_INTERFACE,
|
||||
NL80211_CMD_NEW_INTERFACE,
|
||||
NL80211_CMD_DEL_INTERFACE,
|
||||
|
||||
/* add commands here */
|
||||
|
||||
/* used to define NL80211_CMD_MAX below */
|
||||
__NL80211_CMD_AFTER_LAST,
|
||||
NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* enum nl80211_attrs - nl80211 netlink attributes
|
||||
*
|
||||
* @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors
|
||||
*
|
||||
* @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
|
||||
* /sys/class/ieee80211/<phyname>/index
|
||||
* @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
|
||||
*
|
||||
* @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
|
||||
* @NL80211_ATTR_IFNAME: network interface name
|
||||
* @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
|
||||
*
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
*/
|
||||
enum nl80211_attrs {
|
||||
/* don't change the order or add anything inbetween, this is ABI! */
|
||||
NL80211_ATTR_UNSPEC,
|
||||
|
||||
NL80211_ATTR_WIPHY,
|
||||
NL80211_ATTR_WIPHY_NAME,
|
||||
|
||||
NL80211_ATTR_IFINDEX,
|
||||
NL80211_ATTR_IFNAME,
|
||||
NL80211_ATTR_IFTYPE,
|
||||
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl80211_iftype - (virtual) interface types
|
||||
*
|
||||
* @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
|
||||
* @NL80211_IFTYPE_ADHOC: independent BSS member
|
||||
* @NL80211_IFTYPE_STATION: managed BSS member
|
||||
* @NL80211_IFTYPE_AP: access point
|
||||
* @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
|
||||
* @NL80211_IFTYPE_WDS: wireless distribution interface
|
||||
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
|
||||
* @NL80211_IFTYPE_MAX: highest interface type number currently defined
|
||||
* @__NL80211_IFTYPE_AFTER_LAST: internal use
|
||||
*
|
||||
* These values are used with the %NL80211_ATTR_IFTYPE
|
||||
* to set the type of an interface.
|
||||
*
|
||||
*/
|
||||
enum nl80211_iftype {
|
||||
NL80211_IFTYPE_UNSPECIFIED,
|
||||
NL80211_IFTYPE_ADHOC,
|
||||
NL80211_IFTYPE_STATION,
|
||||
NL80211_IFTYPE_AP,
|
||||
NL80211_IFTYPE_AP_VLAN,
|
||||
NL80211_IFTYPE_WDS,
|
||||
NL80211_IFTYPE_MONITOR,
|
||||
|
||||
/* keep last */
|
||||
__NL80211_IFTYPE_AFTER_LAST,
|
||||
NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
#endif /* __LINUX_NL80211_H */
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef __NET_CFG80211_H
|
||||
#define __NET_CFG80211_H
|
||||
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/nl80211.h>
|
||||
#include <net/genetlink.h>
|
||||
|
||||
/*
|
||||
* 802.11 configuration in-kernel interface
|
||||
*
|
||||
* Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
|
||||
*/
|
||||
|
||||
/* Radiotap header iteration
|
||||
* implemented in net/wireless/radiotap.c
|
||||
* docs in Documentation/networking/radiotap-headers.txt
|
||||
*/
|
||||
/**
|
||||
* struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
|
||||
* @rtheader: pointer to the radiotap header we are walking through
|
||||
* @max_length: length of radiotap header in cpu byte ordering
|
||||
* @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
|
||||
* @this_arg: pointer to current radiotap arg
|
||||
* @arg_index: internal next argument index
|
||||
* @arg: internal next argument pointer
|
||||
* @next_bitmap: internal pointer to next present u32
|
||||
* @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
|
||||
*/
|
||||
|
||||
struct ieee80211_radiotap_iterator {
|
||||
struct ieee80211_radiotap_header *rtheader;
|
||||
int max_length;
|
||||
int this_arg_index;
|
||||
u8 *this_arg;
|
||||
|
||||
int arg_index;
|
||||
u8 *arg;
|
||||
__le32 *next_bitmap;
|
||||
u32 bitmap_shifter;
|
||||
};
|
||||
|
||||
extern int ieee80211_radiotap_iterator_init(
|
||||
struct ieee80211_radiotap_iterator *iterator,
|
||||
struct ieee80211_radiotap_header *radiotap_header,
|
||||
int max_length);
|
||||
|
||||
extern int ieee80211_radiotap_iterator_next(
|
||||
struct ieee80211_radiotap_iterator *iterator);
|
||||
|
||||
|
||||
/* from net/wireless.h */
|
||||
struct wiphy;
|
||||
|
||||
/**
|
||||
* struct cfg80211_ops - backend description for wireless configuration
|
||||
*
|
||||
* This struct is registered by fullmac card drivers and/or wireless stacks
|
||||
* in order to handle configuration requests on their interfaces.
|
||||
*
|
||||
* All callbacks except where otherwise noted should return 0
|
||||
* on success or a negative error code.
|
||||
*
|
||||
* All operations are currently invoked under rtnl for consistency with the
|
||||
* wireless extensions but this is subject to reevaluation as soon as this
|
||||
* code is used more widely and we have a first user without wext.
|
||||
*
|
||||
* @add_virtual_intf: create a new virtual interface with the given name
|
||||
*
|
||||
* @del_virtual_intf: remove the virtual interface determined by ifindex.
|
||||
*
|
||||
* @change_virtual_intf: change type of virtual interface
|
||||
*
|
||||
*/
|
||||
struct cfg80211_ops {
|
||||
int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
|
||||
enum nl80211_iftype type);
|
||||
int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
|
||||
int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
|
||||
enum nl80211_iftype type);
|
||||
};
|
||||
|
||||
#endif /* __NET_CFG80211_H */
|
||||
@@ -0,0 +1,268 @@
|
||||
/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */
|
||||
/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 David Young. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of David Young may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID
|
||||
* YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modifications to fit into the linux IEEE 802.11 stack,
|
||||
* Mike Kershaw (dragorn@kismetwireless.net)
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211RADIOTAP_H
|
||||
#define IEEE80211RADIOTAP_H
|
||||
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
/* Radiotap header version (from official NetBSD feed) */
|
||||
#define IEEE80211RADIOTAP_VERSION "1.5"
|
||||
/* Base version of the radiotap packet header data */
|
||||
#define PKTHDR_RADIOTAP_VERSION 0
|
||||
|
||||
/* A generic radio capture format is desirable. There is one for
|
||||
* Linux, but it is neither rigidly defined (there were not even
|
||||
* units given for some fields) nor easily extensible.
|
||||
*
|
||||
* I suggest the following extensible radio capture format. It is
|
||||
* based on a bitmap indicating which fields are present.
|
||||
*
|
||||
* I am trying to describe precisely what the application programmer
|
||||
* should expect in the following, and for that reason I tell the
|
||||
* units and origin of each measurement (where it applies), or else I
|
||||
* use sufficiently weaselly language ("is a monotonically nondecreasing
|
||||
* function of...") that I cannot set false expectations for lawyerly
|
||||
* readers.
|
||||
*/
|
||||
|
||||
/* XXX tcpdump/libpcap do not tolerate variable-length headers,
|
||||
* yet, so we pad every radiotap header to 64 bytes. Ugh.
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_HDRLEN 64
|
||||
|
||||
/* The radio capture header precedes the 802.11 header.
|
||||
* All data in the header is little endian on all platforms.
|
||||
*/
|
||||
struct ieee80211_radiotap_header {
|
||||
u8 it_version; /* Version 0. Only increases
|
||||
* for drastic changes,
|
||||
* introduction of compatible
|
||||
* new fields does not count.
|
||||
*/
|
||||
u8 it_pad;
|
||||
__le16 it_len; /* length of the whole
|
||||
* header in bytes, including
|
||||
* it_version, it_pad,
|
||||
* it_len, and data fields.
|
||||
*/
|
||||
__le32 it_present; /* A bitmap telling which
|
||||
* fields are present. Set bit 31
|
||||
* (0x80000000) to extend the
|
||||
* bitmap by another 32 bits.
|
||||
* Additional extensions are made
|
||||
* by setting bit 31.
|
||||
*/
|
||||
};
|
||||
|
||||
/* Name Data type Units
|
||||
* ---- --------- -----
|
||||
*
|
||||
* IEEE80211_RADIOTAP_TSFT __le64 microseconds
|
||||
*
|
||||
* Value in microseconds of the MAC's 64-bit 802.11 Time
|
||||
* Synchronization Function timer when the first bit of the
|
||||
* MPDU arrived at the MAC. For received frames, only.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap
|
||||
*
|
||||
* Tx/Rx frequency in MHz, followed by flags (see below).
|
||||
*
|
||||
* IEEE80211_RADIOTAP_FHSS __le16 see below
|
||||
*
|
||||
* For frequency-hopping radios, the hop set (first byte)
|
||||
* and pattern (second byte).
|
||||
*
|
||||
* IEEE80211_RADIOTAP_RATE u8 500kb/s
|
||||
*
|
||||
* Tx/Rx data rate
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from
|
||||
* one milliwatt (dBm)
|
||||
*
|
||||
* RF signal power at the antenna, decibel difference from
|
||||
* one milliwatt.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from
|
||||
* one milliwatt (dBm)
|
||||
*
|
||||
* RF noise power at the antenna, decibel difference from one
|
||||
* milliwatt.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB)
|
||||
*
|
||||
* RF signal power at the antenna, decibel difference from an
|
||||
* arbitrary, fixed reference.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB)
|
||||
*
|
||||
* RF noise power at the antenna, decibel difference from an
|
||||
* arbitrary, fixed reference point.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless
|
||||
*
|
||||
* Quality of Barker code lock. Unitless. Monotonically
|
||||
* nondecreasing with "better" lock strength. Called "Signal
|
||||
* Quality" in datasheets. (Is there a standard way to measure
|
||||
* this?)
|
||||
*
|
||||
* IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless
|
||||
*
|
||||
* Transmit power expressed as unitless distance from max
|
||||
* power set at factory calibration. 0 is max power.
|
||||
* Monotonically nondecreasing with lower power levels.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB)
|
||||
*
|
||||
* Transmit power expressed as decibel distance from max power
|
||||
* set at factory calibration. 0 is max power. Monotonically
|
||||
* nondecreasing with lower power levels.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from
|
||||
* one milliwatt (dBm)
|
||||
*
|
||||
* Transmit power expressed as dBm (decibels from a 1 milliwatt
|
||||
* reference). This is the absolute power level measured at
|
||||
* the antenna port.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_FLAGS u8 bitmap
|
||||
*
|
||||
* Properties of transmitted and received frames. See flags
|
||||
* defined below.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_ANTENNA u8 antenna index
|
||||
*
|
||||
* Unitless indication of the Rx/Tx antenna for this packet.
|
||||
* The first antenna is antenna 0.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap
|
||||
*
|
||||
* Properties of received frames. See flags defined below.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap
|
||||
*
|
||||
* Properties of transmitted frames. See flags defined below.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_RTS_RETRIES u8 data
|
||||
*
|
||||
* Number of rts retries a transmitted frame used.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DATA_RETRIES u8 data
|
||||
*
|
||||
* Number of unicast retries a transmitted frame used.
|
||||
*
|
||||
*/
|
||||
enum ieee80211_radiotap_type {
|
||||
IEEE80211_RADIOTAP_TSFT = 0,
|
||||
IEEE80211_RADIOTAP_FLAGS = 1,
|
||||
IEEE80211_RADIOTAP_RATE = 2,
|
||||
IEEE80211_RADIOTAP_CHANNEL = 3,
|
||||
IEEE80211_RADIOTAP_FHSS = 4,
|
||||
IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
|
||||
IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
|
||||
IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
|
||||
IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
|
||||
IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
|
||||
IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
|
||||
IEEE80211_RADIOTAP_ANTENNA = 11,
|
||||
IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
|
||||
IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
|
||||
IEEE80211_RADIOTAP_RX_FLAGS = 14,
|
||||
IEEE80211_RADIOTAP_TX_FLAGS = 15,
|
||||
IEEE80211_RADIOTAP_RTS_RETRIES = 16,
|
||||
IEEE80211_RADIOTAP_DATA_RETRIES = 17,
|
||||
IEEE80211_RADIOTAP_EXT = 31
|
||||
};
|
||||
|
||||
/* Channel flags. */
|
||||
#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
|
||||
#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
|
||||
#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
|
||||
#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
|
||||
#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
|
||||
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
|
||||
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
|
||||
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
|
||||
|
||||
/* For IEEE80211_RADIOTAP_FLAGS */
|
||||
#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
|
||||
* during CFP
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
|
||||
* with short
|
||||
* preamble
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
|
||||
* with WEP encryption
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
|
||||
* with fragmentation
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */
|
||||
#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between
|
||||
* 802.11 header and payload
|
||||
* (to 32-bit boundary)
|
||||
*/
|
||||
/* For IEEE80211_RADIOTAP_RX_FLAGS */
|
||||
#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
|
||||
|
||||
/* For IEEE80211_RADIOTAP_TX_FLAGS */
|
||||
#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
|
||||
* retries */
|
||||
#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
|
||||
#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
|
||||
|
||||
/* Ugly macro to convert literal channel numbers into their mhz equivalents
|
||||
* There are certianly some conditions that will break this (like feeding it '30')
|
||||
* but they shouldn't arise since nothing talks on channel 30. */
|
||||
#define ieee80211chan2mhz(x) \
|
||||
(((x) <= 14) ? \
|
||||
(((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
|
||||
((x) + 1000) * 5)
|
||||
|
||||
/* helpers */
|
||||
static inline int ieee80211_get_radiotap_len(unsigned char *data)
|
||||
{
|
||||
struct ieee80211_radiotap_header *hdr =
|
||||
(struct ieee80211_radiotap_header *)data;
|
||||
|
||||
return le16_to_cpu(get_unaligned(&hdr->it_len));
|
||||
}
|
||||
|
||||
#endif /* IEEE80211_RADIOTAP_H */
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user