net80211.h revision a399b7655a1d835aa8606c2b29e4e777baac8635
/*
* Copyright 2007 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _SYS_NET80211_H
#define _SYS_NET80211_H
#include <sys/ethernet.h>
#include <sys/net80211_proto.h>
#include <sys/net80211_crypto.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? */
/* 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
#define IEEE80211_FIXED_RATE_NONE 0
/* WME stream classes */
#define WME_AC_BE 0 /* best effort */
#define MAX_EVENT 16
#define MAX_IEEE80211STR 256
/*
* 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 {
};
/*
* 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;
/* others */
};
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;
/* 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_private; /* ieee80211 private data */
};
extern const char *ieee80211_state_name[IEEE80211_S_MAX];
#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 *);
/* 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 *);
void *ieee80211_malloc(size_t);
void ieee80211_free(void *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NET80211_H */