1 | /*
|
---|
2 | * Copyright 2009, Haiku, Inc. All Rights Reserved.
|
---|
3 | * Distributed under the terms of the MIT License.
|
---|
4 | */
|
---|
5 | #ifndef _IEEE80211_DRIVER_H
|
---|
6 | #define _IEEE80211_DRIVER_H
|
---|
7 |
|
---|
8 | /*! Wireless IEEE80211 driver interface */
|
---|
9 |
|
---|
10 | /* Currently trying to base this on FreeBSD's ieee80211_ioctl.h,
|
---|
11 | * which uses a
|
---|
12 | * struct ieee80211req for almost all ioctls (except for stats which
|
---|
13 | * uses a simpler struct that is not part of ieee80211.
|
---|
14 | *
|
---|
15 | * Btw do we want to use IEEE80211 or wireless as name?
|
---|
16 | * */
|
---|
17 |
|
---|
18 | #include <Drivers.h>
|
---|
19 |
|
---|
20 |
|
---|
21 | /* ioctl() opcodes a driver should support */
|
---|
22 | /* This is a raw list of ioctl 'types' from FreeBSD, made ioctls.
|
---|
23 | * This list may/should be compacted as I understand more about
|
---|
24 | * every ioctl's function.
|
---|
25 | enum {
|
---|
26 | IEEE80211_IOC_SSID /* TODO: Set this to something B_DEVICE_OP_CODES_END? or a ETHER_OP_CODES_END? */,
|
---|
27 | IEEE80211_IOC_NUMSSIDS,
|
---|
28 | IEEE80211_IOC_WEP,
|
---|
29 | IEEE80211_IOC_WEPKEY,
|
---|
30 | IEEE80211_IOC_NUMWEPKEYS,
|
---|
31 | IEEE80211_IOC_WEPTXKEY,
|
---|
32 | IEEE80211_IOC_AUTHMODE,
|
---|
33 | IEEE80211_IOC_STATIONNAME,
|
---|
34 | IEEE80211_IOC_CHANNEL,
|
---|
35 | IEEE80211_IOC_POWERSAVE,
|
---|
36 | IEEE80211_IOC_POWERSAVESLEEP,
|
---|
37 | IEEE80211_IOC_RTSTHRESHOLD,
|
---|
38 | IEEE80211_IOC_PROTMODE,
|
---|
39 |
|
---|
40 | IEEE80211_IOC_TXPOWER, /* global tx power limit */
|
---|
41 | IEEE80211_IOC_BSSID,
|
---|
42 | IEEE80211_IOC_ROAMING, /* roaming mode */
|
---|
43 | IEEE80211_IOC_PRIVACY, /* privacy invoked */
|
---|
44 | IEEE80211_IOC_DROPUNENCRYPTED, /* discard unencrypted frames */
|
---|
45 | IEEE80211_IOC_WPAKEY,
|
---|
46 | IEEE80211_IOC_DELKEY,
|
---|
47 | IEEE80211_IOC_MLME,
|
---|
48 | IEEE80211_IOC_COUNTERMEASURES, /* WPA/TKIP countermeasures */
|
---|
49 | IEEE80211_IOC_WPA, /* WPA mode (0,1,2) */
|
---|
50 | IEEE80211_IOC_CHANLIST, /* channel list */
|
---|
51 | IEEE80211_IOC_WME, /* WME mode (on, off) */
|
---|
52 | IEEE80211_IOC_HIDESSID, /* hide SSID mode (on, off) */
|
---|
53 | IEEE80211_IOC_APBRIDGE, /* AP inter-sta bridging */
|
---|
54 | IEEE80211_IOC_WPAIE, /* WPA information element */
|
---|
55 | IEEE80211_IOC_STA_STATS, /* per-station statistics */
|
---|
56 | IEEE80211_IOC_MACCMD, /* MAC ACL operation */
|
---|
57 | IEEE80211_IOC_CHANINFO, /* channel info list */
|
---|
58 | IEEE80211_IOC_TXPOWMAX, /* max tx power for channel */
|
---|
59 | IEEE80211_IOC_STA_TXPOW, /* per-station tx power limit */
|
---|
60 | IEEE80211_IOC_WME_CWMIN, /* WME: ECWmin */
|
---|
61 | IEEE80211_IOC_WME_CWMAX, /* WME: ECWmax */
|
---|
62 | IEEE80211_IOC_WME_AIFS, /* WME: AIFSN */
|
---|
63 | IEEE80211_IOC_WME_TXOPLIMIT, /* WME: txops limit */
|
---|
64 | IEEE80211_IOC_WME_ACM, /* WME: ACM (bss only) */
|
---|
65 | IEEE80211_IOC_WME_ACKPOLICY, /* WME: ACK policy (!bss only)*/
|
---|
66 | IEEE80211_IOC_DTIM_PERIOD, /* DTIM period (beacons) */
|
---|
67 | IEEE80211_IOC_BEACON_INTERVAL, /* beacon interval (ms) */
|
---|
68 | IEEE80211_IOC_ADDMAC, /* add sta to MAC ACL table */
|
---|
69 | IEEE80211_IOC_DELMAC, /* del sta from MAC ACL table */
|
---|
70 | IEEE80211_IOC_PUREG, /* pure 11g (no 11b stations) */
|
---|
71 | IEEE80211_IOC_FF, /* ATH fast frames (on, off) */
|
---|
72 | IEEE80211_IOC_TURBOP, /* ATH turbo' (on, off) */
|
---|
73 | IEEE80211_IOC_BGSCAN, /* bg scanning (on, off) */
|
---|
74 | IEEE80211_IOC_BGSCAN_IDLE, /* bg scan idle threshold */
|
---|
75 | IEEE80211_IOC_BGSCAN_INTERVAL, /* bg scan interval */
|
---|
76 | IEEE80211_IOC_SCANVALID, /* scan cache valid threshold */
|
---|
77 | IEEE80211_IOC_FRAGTHRESHOLD, /* tx fragmentation threshold */
|
---|
78 | IEEE80211_IOC_BURST, /* packet bursting */
|
---|
79 | IEEE80211_IOC_SCAN_RESULTS, /* get scan results */
|
---|
80 | IEEE80211_IOC_BMISSTHRESHOLD, /* beacon miss threshold */
|
---|
81 | IEEE80211_IOC_STA_INFO, /* station/neighbor info */
|
---|
82 | IEEE80211_IOC_WPAIE2, /* WPA+RSN info elements */
|
---|
83 | IEEE80211_IOC_CURCHAN, /* current channel */
|
---|
84 | IEEE80211_IOC_SHORTGI, /* 802.11n half GI */
|
---|
85 | IEEE80211_IOC_AMPDU, /* 802.11n A-MPDU (on, off) */
|
---|
86 | IEEE80211_IOC_AMPDU_LIMIT, /* A-MPDU length limit */
|
---|
87 | IEEE80211_IOC_AMPDU_DENSITY, /* A-MPDU density */
|
---|
88 | IEEE80211_IOC_AMSDU, /* 802.11n A-MSDU (on, off) */
|
---|
89 | IEEE80211_IOC_AMSDU_LIMIT, /* A-MSDU length limit */
|
---|
90 | IEEE80211_IOC_PUREN, /* pure 11n (no legacy sta's) */
|
---|
91 | IEEE80211_IOC_DOTH, /* 802.11h (on, off) */
|
---|
92 | IEEE80211_IOC_HTCOMPAT, /* support pre-D1.10 HT ie's */
|
---|
93 | IEEE80211_IOC_DWDS, /* DWDS/4-address handling */
|
---|
94 | IEEE80211_IOC_INACTIVITY, /* sta inactivity handling */
|
---|
95 | IEEE80211_IOC_APPIE, /* application IE's */
|
---|
96 | IEEE80211_IOC_WPS, /* WPS operation */
|
---|
97 | IEEE80211_IOC_TSN, /* TSN operation */
|
---|
98 | IEEE80211_IOC_DEVCAPS, /* driver+device capabilities */
|
---|
99 | IEEE80211_IOC_CHANSWITCH, /* start 11h channel switch */
|
---|
100 | IEEE80211_IOC_DFS, /* DFS (on, off) */
|
---|
101 | IEEE80211_IOC_DOTD, /* 802.11d (on, off) */
|
---|
102 | IEEE80211_IOC_HTPROTMODE, /* HT protection (off, rts) */
|
---|
103 | IEEE80211_IOC_SCAN_REQ, /* scan w/ specified params */
|
---|
104 | IEEE80211_IOC_SCAN_CANCEL, /* cancel ongoing scan */
|
---|
105 | IEEE80211_IOC_HTCONF, /* HT config (off, HT20, HT40)*/
|
---|
106 | IEEE80211_IOC_REGDOMAIN, /* regulatory domain info */
|
---|
107 | IEEE80211_IOC_ROAM, /* roaming params en masse */
|
---|
108 | IEEE80211_IOC_TXPARAMS, /* tx parameters */
|
---|
109 | IEEE80211_IOC_STA_VLAN, /* per-station vlan tag */
|
---|
110 | IEEE80211_IOC_SMPS, /* MIMO power save */
|
---|
111 | IEEE80211_IOC_RIFS, /* RIFS config (on, off) */
|
---|
112 |
|
---|
113 | IEEE80211_IOC_TDMA_SLOT, /* TDMA: assigned slot */
|
---|
114 | IEEE80211_IOC_TDMA_SLOTCNT, /* TDMA: slots in bss */
|
---|
115 | IEEE80211_IOC_TDMA_SLOTLEN, /* TDMA: slot length (usecs) */
|
---|
116 | IEEE80211_IOC_TDMA_BINTERVAL, /* TDMA: beacon intvl (slots) */
|
---|
117 | };
|
---|
118 |
|
---|
119 | /* I see two kind of requests atm, one for reading/writing simple 16bit value and
|
---|
120 | * one for reading/writing complex data. I need more knowledge of individual reqs.
|
---|
121 |
|
---|
122 | /* values for IEEE80211_IOC_WEP
|
---|
123 | #define IEEE80211_WEP_NOSUP -1
|
---|
124 | #define IEEE80211_WEP_OFF 0
|
---|
125 | #define IEEE80211_WEP_ON 1
|
---|
126 | #define IEEE80211_WEP_MIXED 2
|
---|
127 | */
|
---|
128 |
|
---|
129 | /* Values for IEEE80211_IOC_POWERSAVE
|
---|
130 | #define IEEE80211_POWERSAVE_NOSUP -1
|
---|
131 | #define IEEE80211_POWERSAVE_OFF 0
|
---|
132 | #define IEEE80211_POWERSAVE_CAM 1
|
---|
133 | #define IEEE80211_POWERSAVE_PSP 2
|
---|
134 | #define IEEE80211_POWERSAVE_PSP_CAM 3
|
---|
135 | #define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
|
---|
136 | */
|
---|
137 |
|
---|
138 | /* Values for IEEE80211_IOC_PROTMODE
|
---|
139 | #define IEEE80211_PROTMODE_OFF 0
|
---|
140 | #define IEEE80211_PROTMODE_CTS 1
|
---|
141 | #define IEEE80211_PROTMODE_RTSCTS 2
|
---|
142 | */
|
---|
143 |
|
---|
144 | /* Below is FreeBSD's struct for communication.
|
---|
145 | * AFAICT they send in the name of the interface and the ioctl type
|
---|
146 | * in i_type using one ioctl SIOCG80211.
|
---|
147 | * Not sure we want to replicate this but switch to proper ioctls for all
|
---|
148 | * types. Also I think we can ditch the name in the request.
|
---|
149 | * i_val - pass a value in or out of ioctl.
|
---|
150 | * i_len - length of extra data
|
---|
151 | * i_data - pass data in or out of ioctl.
|
---|
152 | *
|
---|
153 | */
|
---|
154 | #ifdef FREEBSD_CODE_FOR_REF_ONLY
|
---|
155 | /* the first member must be matched with struct ifreq */
|
---|
156 | struct ieee80211req {
|
---|
157 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
---|
158 | uint16_t i_type; /* req type */
|
---|
159 | int16_t i_val; /* Index or simple value */
|
---|
160 | int16_t i_len; /* Index or simple value */
|
---|
161 | void *i_data; /* Extra data */
|
---|
162 | };
|
---|
163 | #endif
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 |
|
---|
169 | #endif /* _IEEE80211_DRIVER_H */
|
---|