📄 if_wlp_wavelan_roam.h
字号:
/* * Copyright (c) 1997 Carnegie Mellon University. All Rights * Reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted (including for commercial or for-profit * use), provided that both the copyright notice and this permission notice * appear in all copies of the software, derivative works, or modified * versions, and any portions thereof, and that both notices appear in * supporting documentation, and that credit is given to Carnegie Mellon * University in all publications reporting on direct or indirect use of this * code or its derivatives. * * THIS IMPLEMENTATION IS EXPERIMENTAL AND MAY HAVE BUGS, SOME OF WHICH MAY HAVE * SERIOUS CONSEQUENCES. CARNEGIE MELLON PROVIDES THIS SOFTWARE IN ITS "AS * IS" CONDITION, 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 CARNEGIE MELLON * UNIVERSITY 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. * * Carnegie Mellon encourages (but does not require) users of this software to * return any improvements or extensions that they make, and to grant * Carnegie Mellon the rights to redistribute these changes without * encumbrance. * * */#ifndef __IF_WLP_WAVELAN_ROAM_H__#define __IF_WLP_WAVELAN_ROAM_H__/* * ====================================================================== * ioctl()'s * ====================================================================== */#define SIOCSIFROAM _IOW ('i', 64, struct ifreq)#define SIOCGIFROAM _IOWR('i', 65, struct ifreq)#define SIOCSIFDOMID _IOW ('i', 66, struct ifreq)#define SIOCGIFDOMID _IOWR('i', 67, struct ifreq)#define SIOCSIFBEACONKEY _IOW ('i', 68, struct ifreq)#define SIOCGIFBEACONKEY _IOWR('i', 69, struct ifreq)#define SIOCGIFSIGNAL _IOWR('i', 70, struct ifreq)#define SIOCGIFTHRESH _IOWR('i', 71, struct ifreq)#ifdef KERNEL/* * ====================================================================== * Function Prototypes * ====================================================================== */int wavelan_roaming_ioctl(struct ifnet*, int, caddr_t);void wavelan_input(struct ether_header *, struct mbuf *, int);void RoamOnOff(struct wlp_softc*, int);/* * ====================================================================== * Defines * ====================================================================== */#define MAX_SOREQ_RETRANS 3#define PDUTYPE_BEACON 0x00#define PDUTYPE_SOREQ 0x01#define PDUTYPE_SORSP 0x02#define PDUTYPE_RECREQ 0x06#define BEACON_MIN_LEN 47#define SOREQ_MIN_LEN 13#define SORSP_MIN_LEN 13#define RECREQ_MIN_LEN 9#define SOREQ_INFOBLOCK_MAX_LEN 34#define SORSP_INFOBLOCK_MAX_LEN 34#define RECREQ_PADDING_LEN 37/* * ====================================================================== * Macros * ====================================================================== */#define EnableTX(ifp) { \ (ifp)->if_flags &= ~IFF_OACTIVE; \ ((struct wlp_softc*) (ifp)->if_softc)->sc_rs.rs_disabletx = 0; \}#define DisableTX(ifp) { \ (ifp)->if_flags |= IFF_OACTIVE; \ ((struct wlp_softc*) (ifp)->if_softc)->sc_rs.rs_disabletx = 1; \}#define min(x, y) ((x) < (y) ? (x) : (y))#define SNR(x) ((x)->ap_siglevel - (x)->ap_sillevel)#define STOP_CELL(x) ((x)->ap_beacon.scell)#define REG_CELL(x) ((x)->ap_beacon.rcell)#define FAST_CELL(x) ((x)->ap_beacon.fcell)#define AP_SET_EXPIRE(x) \ { \ int beacon_timeout = *((u_int16_t*) &(x)->ap_beacon.timeout); \ int timeout_sec = 0; \ int timeout_usec; \ \ /* \ * Beacons come more than once/second \ */ \ if(beacon_timeout == 60) \ { \ timeout_usec = 600000; \ } \ else if(beacon_timeout < 100) \ { \ timeout_usec = beacon_timeout * 10000; \ } \ \ /* \ * Beacons come less than once/second \ */ \ else \ { \ timeout_sec = beacon_timeout / 100; \ \ timeout_usec = (beacon_timeout - (timeout_sec * 100)) * 10000; \ } \ \ (x)->ap_expire.tv_sec = time.tv_sec + timeout_sec; \ \ if(time.tv_usec + timeout_usec > 999999) \ { \ (x)->ap_expire.tv_sec++; \ (x)->ap_expire.tv_usec = (time.tv_usec + timeout_usec) - 1000000; \ } \ else \ { \ (x)->ap_expire.tv_usec = timeout_usec; \ } \ }#define AP_EXPIRED(x) \ ( (x)->ap_expire.tv_sec == time.tv_sec ? \ ((x)->ap_expire.tv_usec < time.tv_usec) : \ ((x)->ap_expire.tv_sec < time.tv_sec) )/* ====================================================================== Roaming State (part of wlp_softc (if_wlp.h) ====================================================================== */struct roam_state { u_int8_t rs_roam_enable;#define ROAM_ON 0x01#define ROAM_OFF 0x00 u_int8_t rs_roam_mode;#define MODE_FAST_CELL 0x01#define MODE_REG_CELL 0x02#define MODE_STOP_CELL 0x03 u_int8_t rs_activetx; /* device is actively transmitting */ u_int8_t rs_disabletx; /* disable transmission of packets */ u_int16_t rs_domid; /* Domain ID */ u_int16_t rs_beaconkey; /* Beacon Key */ LIST_HEAD(, accesspoint) rs_aplist; struct accesspoint* rs_ap; /* Current Access Point */ struct accesspoint* rs_apreg; /* New Access Point */ u_int32_t rs_SOReqCnt; u_int32_t rs_SOReqRetrans; u_int32_t rs_SOReqFailed; u_int32_t rs_BeaconCount; /* Beacons Received */ u_int32_t rs_BeaconKept; /* Beacons Processed */};/* ====================================================================== Packet Formats ====================================================================== */struct pkt_beacon { u_int8_t pdutype; u_int8_t sequence; u_int16_t domid; u_int16_t snwid; u_int8_t rfnoise; /* NOTE: defined as a single field in the Air Interface Docs */ u_int8_t threshold; /* WaveAround CQ Method */ u_int8_t scell; u_int8_t rcell; u_int8_t fcell; u_int8_t interval[2]; u_int8_t timeout[2]; u_char apname[32];};struct pkt_soreq { u_char pdutype; u_char seq; u_char numaps; u_char roamstate; u_char reserved; u_char infoblock[0]; /* Place Holder */};struct pkt_sorsp { u_char pdutype; u_char seq; u_char status; u_char reserved[2]; u_char infoblock[0]; /* Place Holder */};struct pkt_recreq { u_int8_t pdutype; u_int8_t padding[0];};/* * ====================================================================== * Data Structures * ====================================================================== */struct accesspoint { LIST_ENTRY(accesspoint) ap_link; struct wlp_softc *ap_softc; struct pkt_beacon ap_beacon; u_int8_t ap_siglevel; u_int8_t ap_sillevel; u_int8_t ap_sigqual; struct timeval ap_expire; /* from Sign-On Response */ u_char ap_infoblock[SORSP_INFOBLOCK_MAX_LEN]; u_int8_t ap_macaddr[ETHER_ADDR_LEN];};#endif /* KERNEL */#endif /* __IF_WLP_WAVELAN_ROAM_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -