/home/tai/chorist/xian-1.2/src/include/_ieee80211.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2001 Atsushi Onoe
00003  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. The name of the author may not be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * Alternatively, this software may be distributed under the terms of the
00018  * GNU General Public License ("GPL") version 2 as published by the Free
00019  * Software Foundation.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00022  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00024  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00026  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00027  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00030  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  *
00032  * $FreeBSD: src/sys/net80211/_ieee80211.h,v 1.2 2004/12/31 22:42:38 sam Exp $
00033  */
00034 #ifndef _NET80211__IEEE80211_H_
00035 #define _NET80211__IEEE80211_H_
00036 
00037 enum ieee80211_phytype {
00038         IEEE80211_T_DS,                 /* direct sequence spread spectrum */
00039         IEEE80211_T_FH,                 /* frequency hopping */
00040         IEEE80211_T_OFDM,               /* frequency division multiplexing */
00041         IEEE80211_T_TURBO               /* high rate OFDM, aka turbo mode */
00042 };
00043 #define IEEE80211_T_CCK IEEE80211_T_DS  /* more common nomenclature */
00044 
00045 /* XXX not really a mode; there are really multiple PHY's */
00046 enum ieee80211_phymode {
00047         IEEE80211_MODE_AUTO     = 0,    /* autoselect */
00048         IEEE80211_MODE_11A      = 1,    /* 5GHz, OFDM */
00049         IEEE80211_MODE_11B      = 2,    /* 2GHz, CCK */
00050         IEEE80211_MODE_11G      = 3,    /* 2GHz, OFDM */
00051         IEEE80211_MODE_FH       = 4,    /* 2GHz, GFSK */
00052         IEEE80211_MODE_TURBO_A  = 5,    /* 5GHz, OFDM, 2x clock */
00053         IEEE80211_MODE_TURBO_G  = 6     /* 2GHz, OFDM, 2x clock */
00054 };
00055 #define IEEE80211_MODE_MAX      (IEEE80211_MODE_TURBO_G+1)
00056 
00057 enum ieee80211_opmode {
00058         IEEE80211_M_STA         = 1,    /* infrastructure station */
00059         IEEE80211_M_IBSS        = 0,    /* IBSS (adhoc) station */
00060         IEEE80211_M_AHDEMO      = 3,    /* Old lucent compatible adhoc demo */
00061         IEEE80211_M_HOSTAP      = 6,    /* Software Access Point */
00062         IEEE80211_M_MONITOR     = 8     /* Monitor mode */
00063 };
00064 
00065 /*
00066  * 802.11g protection mode.
00067  */
00068 enum ieee80211_protmode {
00069         IEEE80211_PROT_NONE     = 0,    /* no protection */
00070         IEEE80211_PROT_CTSONLY  = 1,    /* CTS to self */
00071         IEEE80211_PROT_RTSCTS   = 2     /* RTS-CTS */
00072 };
00073 
00074 /*
00075  * Authentication mode.
00076  */
00077 enum ieee80211_authmode {
00078         IEEE80211_AUTH_NONE     = 0,
00079         IEEE80211_AUTH_OPEN     = 1,            /* open */
00080         IEEE80211_AUTH_SHARED   = 2,            /* shared-key */
00081         IEEE80211_AUTH_8021X    = 3,            /* 802.1x */
00082         IEEE80211_AUTH_AUTO     = 4,            /* auto-select/accept */
00083         /* NB: these are used only for ioctls */
00084         IEEE80211_AUTH_WPA      = 5             /* WPA/RSN w/ 802.1x/PSK */
00085 };
00086 
00087 /*
00088  * Roaming mode is effectively who controls the operation
00089  * of the 802.11 state machine when operating as a station.
00090  * State transitions are controlled either by the driver
00091  * (typically when management frames are processed by the
00092  * hardware/firmware), the host (auto/normal operation of
00093  * the 802.11 layer), or explicitly through ioctl requests
00094  * when applications like wpa_supplicant want control.
00095  */
00096 enum ieee80211_roamingmode {
00097         IEEE80211_ROAMING_DEVICE= 0,    /* driver/hardware control */
00098         IEEE80211_ROAMING_AUTO  = 1,    /* 802.11 layer control */
00099         IEEE80211_ROAMING_MANUAL= 2     /* application control */
00100 };
00101 
00102 /*
00103  * Channels are specified by frequency and attributes.
00104  */
00105 struct ieee80211_channel {
00106         u_int16_t       ic_freq;        /* setting in Mhz */
00107         u_int16_t       ic_flags;       /* see below */
00108 };
00109 
00110 #define IEEE80211_CHAN_MAX      255
00111 #define IEEE80211_CHAN_BYTES    32      /* howmany(IEEE80211_CHAN_MAX, NBBY) */
00112 #define IEEE80211_CHAN_ANY      0xffff  /* token for ``any channel'' */
00113 #define IEEE80211_CHAN_ANYC \
00114         ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
00115 
00116 /* bits 0-3 are for private use by drivers */
00117 /* channel attributes */
00118 #define IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
00119 #define IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
00120 #define IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
00121 #define IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
00122 #define IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
00123 #define IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
00124 #define IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
00125 #define IEEE80211_CHAN_GFSK     0x0800  /* GFSK channel (FHSS PHY) */
00126 
00127 /*
00128  * Useful combinations of channel characteristics.
00129  */
00130 #define IEEE80211_CHAN_FHSS \
00131         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
00132 #define IEEE80211_CHAN_A \
00133         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
00134 #define IEEE80211_CHAN_B \
00135         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
00136 #define IEEE80211_CHAN_PUREG \
00137         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
00138 #define IEEE80211_CHAN_G \
00139         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
00140 #define IEEE80211_CHAN_T \
00141         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
00142 #define IEEE80211_CHAN_108G \
00143         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
00144 
00145 #define IEEE80211_IS_CHAN_FHSS(_c) \
00146         (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
00147 #define IEEE80211_IS_CHAN_A(_c) \
00148         (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
00149 #define IEEE80211_IS_CHAN_B(_c) \
00150         (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
00151 #define IEEE80211_IS_CHAN_PUREG(_c) \
00152         (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
00153 #define IEEE80211_IS_CHAN_G(_c) \
00154         (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
00155 #define IEEE80211_IS_CHAN_T(_c) \
00156         (((_c)->ic_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T)
00157 #define IEEE80211_IS_CHAN_108G(_c) \
00158         (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
00159 
00160 #define IEEE80211_IS_CHAN_2GHZ(_c) \
00161         (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
00162 #define IEEE80211_IS_CHAN_5GHZ(_c) \
00163         (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
00164 #define IEEE80211_IS_CHAN_OFDM(_c) \
00165         (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
00166 #define IEEE80211_IS_CHAN_CCK(_c) \
00167         (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
00168 #define IEEE80211_IS_CHAN_GFSK(_c) \
00169         (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
00170 
00171 /* ni_chan encoding for FH phy */
00172 #define IEEE80211_FH_CHANMOD    80
00173 #define IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
00174 #define IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
00175 #define IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
00176 
00177 /*
00178  * 802.11 rate set.
00179  */
00180 #define IEEE80211_RATE_SIZE     8               /* 802.11 standard */
00181 #define IEEE80211_RATE_MAXSIZE  15              /* max rates we'll handle */
00182 
00183 struct ieee80211_rateset {
00184         u_int8_t                rs_nrates;
00185         u_int8_t                rs_rates[IEEE80211_RATE_MAXSIZE];
00186 };
00187 
00188 #endif /* _NET80211__IEEE80211_H_ */

Generated on Mon Jan 21 12:31:45 2008 for XIAN by  doxygen 1.5.3