net80211.h revision 216e0daa70a0058c5dc883bc667cd6925015df0a
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
* 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
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
*/
#ifndef _SYS_NET80211_H
#define _SYS_NET80211_H
#include <sys/ethernet.h>
#include <sys/net80211_proto.h>
#include <sys/net80211_crypto.h>
#include <sys/net80211_ht.h>
/*
* IEEE802.11 kernel support module
*/
#ifdef __cplusplus
extern "C" {
#endif
/* ic_caps */
#define IEEE80211_C_TURBOP 0x00000080
/* CAPABILITY: ATH Turbo available */
#define IEEE80211_C_WPA 0x01800000
/* CAPABILITY: WPA1+WPA2 avail */
/* 0x10000000 reserved */
/* XXX protection/barker? */
/*
*
* NB: the low 16-bits are the 802.11 definitions, the upper
*/
/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */
/* ic_flags */
/* NB: bits 0x4c available */
/* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */
/* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */
#define IEEE80211_F_SHSLOT 0x00000400
/* STATUS: use short slot time */
#define IEEE80211_F_BGSCAN 0x00004000
/* CONF: bg scan enabled (???) */
#define IEEE80211_F_USEBARKER 0x00200000
/* STATUS: use barker preamble */
/* ic_flags_ext */
/* 0x00000006 reserved */
#define IEEE80211_FEXT_BGSCAN 0x00000008
/* STATUS: enable full bgscan completion */
/*
* Channel attributes (ich_flags)
* bits 0-3 are for private use by drivers
*/
#define IEEE80211_CHAN_MAX 255
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *)IEEE80211_CHAN_ANY)
#define IEEE80211_IS_CHAN_2GHZ(_c) \
#define IEEE80211_IS_CHAN_5GHZ(_c) \
#define IEEE80211_NODE_HASHSIZE 32
/* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
#define IEEE80211_NODE_AMPDU \
#define IEEE80211_FIXED_RATE_NONE 0
#define WME_OUI 0xf25000
#define WME_OUI_TYPE 0x02
#define WME_INFO_OUI_SUBTYPE 0x00
#define WME_PARAM_OUI_SUBTYPE 0x01
#define WME_VERSION 1
/* WME stream classes */
#define WME_AC_BE 0 /* best effort */
#define MAX_EVENT 16
#define MAX_IEEE80211STR 256
/* For IEEE80211_RADIOTAP_FLAGS */
#define IEEE80211_RADIOTAP_F_CFP 0x01
#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02
#define IEEE80211_RADIOTAP_F_WEP 0x04
#define IEEE80211_RADIOTAP_F_FRAG 0x08
#define IEEE80211_RADIOTAP_F_DATAPAD 0x20
/*
* frame has padding between 802.11
* header and payload (to 32-bit
* boundary
*/
/*
* Authentication mode.
*/
enum ieee80211_authmode {
IEEE80211_AUTH_NONE = 0,
/* NB: these are used only for ioctls */
};
enum ieee80211_state {
IEEE80211_S_INIT = 0, /* default state */
};
/*
* 802.11 rate set.
*/
/* size of extended supported rates */
struct ieee80211_rateset {
};
/*
* 802.11n variant of ieee80211_rateset. Instead
* legacy rates the entries are MCS rates. We define
* the structure such that it can be used interchangeably
* with an ieee80211_rateset (modulo structure size).
*/
#define IEEE80211_HTRATE_MAXSIZE 127
struct ieee80211_htrateset {
};
#define IEEE80211_RATE_MCS 0x80
/*
* Channels are specified by frequency and attributes.
*/
struct ieee80211_channel {
};
struct ieee80211_device_stats {
};
struct ieee80211_crypto_state;
typedef struct ieee80211_node_table ieee80211_node_table_t;
typedef struct ieee80211_node ieee80211_node_t;
typedef struct ieee80211com ieee80211com_t;
struct ieee80211_node_table {
const char *nt_name; /* for debugging */
/* For node inactivity processing */
int nt_inact_timer; /* inactivity timer */
int nt_inact_init; /* initial node inact setting */
void (*nt_timeout)(struct ieee80211_node_table *);
int nt_keyixmax; /* keyixmap size */
};
/*
* Node specific information. Note that drivers are expected
* to derive from this structure to add device-specific per-node
* state. This is done by overriding the ic_node_* methods in
* the ieee80211com structure.
*/
struct ieee80211_node {
struct ieee80211com *in_ic;
struct ieee80211_node_table *in_table;
/*
* index 0 is used when QoS is not enabled. index 1-16 is used
* when QoS is enabled. 1-16 corresponds to TID 0-15.
*/
/* hardware */
/* header */
/* beacon, probe response */
union {
} in_tstamp; /* from last rcv'd beacon */
enum ieee80211_phytype in_phytype;
/* 11n state */
/* others */
};
/*
*/
struct wmeParams {
};
struct chanAccParams {
};
struct ieee80211_wme_state {
/* agressive mode switch hysteresis */
struct chanAccParams wme_wmeBssChanParams;
/* WME params bcast to stations */
int (*wme_update)(struct ieee80211com *);
};
struct ieee80211com {
/* Initialized by driver */
/* INITIALIZED by IEEE80211, used/overridden by driver */
void *ic_opt_ie; /* user-specified IE's */
/* Cipher state/configuration. */
struct ieee80211_crypto_state ic_crypto;
char ic_wpadoor[MAX_IEEE80211STR];
/* Runtime states */
struct ieee80211_device_stats ic_stats;
int ic_ampdu_rxmax; /* A-MPDU rx limit (bytes) */
int ic_ampdu_density; /* A-MPDU density */
int ic_ampdu_limit; /* A-MPDU tx limit (bytes) */
int ic_amsdu_limit; /* A-MSDU tx limit (bytes) */
int ic_lastnonerp; /* last time nonERP sta noted */
int ic_lastnonht; /* last time non-HT sta noted */
int ic_beaconmiss; /* beacon miss counter */
/* callback functions */
/*
* Functions initialized by driver before calling ieee80211_attach()
* Those must be initialized are marked with M(andatory)
*
* ic_xmit - [M] transmit a management or null data frame
* return 0 on success, non-zero on error
* ic_watchdog - [O] periodic run function, enabled by
* ieee80211_start_watchdog()
* ic_node_newassoc - [O] driver specific operation on a newly
* associated or re-assoced node
*/
void (*ic_watchdog)(void *);
void (*ic_set_tim)(ieee80211com_t *,
ieee80211_node_t *, int);
void (*ic_set_shortslot)(ieee80211com_t *, int);
void (*ic_node_newassoc)(ieee80211_node_t *, int);
/*
* Functions initialized by ieee80211_attach(), driver could
* override these functions after calling ieee80211_attach()
*
* ic_reset - reset
* ic_recv_mgmt - handle received management frames
* ic_send_mgmt - construct and transmit management frames
* ic_newstate - handle state transition
* ic_node_alloc - allocate a new BSS info node
* ic_node_cleanup - cleanup or free memory spaces of a node
* ic_node_free - free a node
* ic_node_getrssi - get node's rssi
*/
int (*ic_reset)(ieee80211com_t *);
void (*ic_recv_mgmt)(ieee80211com_t *,
mblk_t *, ieee80211_node_t *,
int, int, uint32_t);
int (*ic_send_mgmt)(ieee80211com_t *,
ieee80211_node_t *, int, int);
int (*ic_newstate)(ieee80211com_t *,
enum ieee80211_state, int);
void (*ic_node_cleanup)(ieee80211_node_t *);
void (*ic_node_free)(ieee80211_node_t *);
void (*ic_set_channel)(ieee80211com_t *);
/*
* of A-MPDU tx aggregation is provided; the driver may
* override these methods to provide their own support.
* A-MPDU rx re-ordering happens automatically if the
* driver passes out-of-order frames to ieee80211_input
* from an assocated HT station.
*/
void (*ic_recv_action)(ieee80211_node_t *,
int (*ic_send_action)(ieee80211_node_t *,
int, int, uint16_t[4]);
int (*ic_addba_request)(ieee80211_node_t *,
struct ieee80211_tx_ampdu *,
int, int, int);
int (*ic_addba_response)(ieee80211_node_t *,
struct ieee80211_tx_ampdu *,
int, int, int);
void (*ic_addba_stop)(ieee80211_node_t *,
struct ieee80211_tx_ampdu *);
void *ic_private; /* ieee80211 private data */
};
extern const char *ieee80211_state_name[IEEE80211_S_MAX];
extern const char *ieee80211_wme_acnames[];
#define IEEE80211_RATE(_ix) \
#define ieee80211_macaddr_sprintf(_addr) \
/*
* Node reference counting definitions.
*
* ieee80211_node_initref initialize the reference count to 1
* ieee80211_node_incref add a reference
* ieee80211_node_decref remove a reference
* ieee80211_node_decref_nv remove a reference and return new value
* ieee80211_node_refcnt reference count for printing (only)
*/
#define ieee80211_node_initref(_in) \
#define ieee80211_node_incref(_in) \
#define ieee80211_node_decref(_in) \
#define ieee80211_node_decref_nv(_in) \
#define ieee80211_node_refcnt(_in) \
typedef void ieee80211_iter_func(void *, ieee80211_node_t *);
/* Initialization */
void ieee80211_attach(ieee80211com_t *);
void ieee80211_detach(ieee80211com_t *);
void ieee80211_media_init(ieee80211com_t *);
void ieee80211_register_door(ieee80211com_t *, const char *, int);
/* Protocol Processing */
struct ieee80211_beacon_offsets *);
struct ieee80211_beacon_offsets *, mblk_t *, int);
void ieee80211_beacon_miss(ieee80211com_t *);
void ieee80211_next_scan(ieee80211com_t *);
void ieee80211_end_scan(ieee80211com_t *);
void ieee80211_cancel_scan(ieee80211com_t *);
/* Node Operation */
void ieee80211_unref_node(ieee80211_node_t **);
void ieee80211_node_authorize(ieee80211_node_t *);
ieee80211_node_table_t *, const uint8_t *);
void ieee80211_free_node(ieee80211_node_t *);
void *);
const uint8_t *);
const struct ieee80211_frame *);
/* Crypto */
int);
extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int,
struct ieee80211_key *);
/* Helper Functions */
struct ieee80211_channel *);
void ieee80211_reset_chan(ieee80211com_t *);
void ieee80211_watchdog(void *);
void ieee80211_stop_watchdog(ieee80211com_t *);
struct ieee80211_node *);
int ieee80211_hdrsize(const void *);
int ieee80211_hdrspace(ieee80211com_t *, const void *);
int ieee80211_anyhdrsize(const void *);
int ieee80211_anyhdrspace(ieee80211com_t *, const void *);
void *ieee80211_malloc(size_t);
void ieee80211_free(void *);
const void *);
void *, uint_t *);
struct ieee80211_channel *);
/* HT */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NET80211_H */