2 * Copyright (c) 2010 The FreeBSD Foundation
5 * This software was developed by Shteryana Sotirova Shopova under
6 * sponsorship from the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #define WLAN_IFMODE_MAX WlanIfaceOperatingModeType_tdma
33 #define WLAN_COUNTRY_CODE_SIZE 3
34 #define WLAN_BGSCAN_IDLE_MIN 100 /* XXX */
35 #define WLAN_SCAN_VALID_MIN 10 /* XXX */
36 #define WLAN_TDMA_MAXSLOTS 2 /* XXX */
41 uint8_t pmac[IEEE80211_ADDR_LEN]; /* key */
56 SLIST_ENTRY(wlan_peer) wp;
59 SLIST_HEAD(wlan_peerlist, wlan_peer);
61 struct wlan_scan_result {
62 uint8_t ssid[IEEE80211_NWID_LEN + 1];
63 uint8_t bssid[IEEE80211_ADDR_LEN];
70 struct wlan_iface *pwif;
71 SLIST_ENTRY(wlan_scan_result) wsr;
74 SLIST_HEAD(wlan_scanlist, wlan_scan_result);
77 uint8_t mac[IEEE80211_ADDR_LEN];
78 enum RowStatus mac_status;
79 SLIST_ENTRY(wlan_mac_mac) wm;
82 SLIST_HEAD(wlan_maclist, wlan_mac_mac);
84 struct wlan_mesh_route {
85 struct ieee80211req_mesh_route imroute;
86 enum RowStatus mroute_status;
87 SLIST_ENTRY(wlan_mesh_route) wr;
90 SLIST_HEAD(wlan_mesh_routes, wlan_mesh_route);
96 enum WlanIfaceOperatingModeType mode;
98 uint8_t dbssid[IEEE80211_ADDR_LEN];
99 uint8_t dlmac[IEEE80211_ADDR_LEN];
100 enum RowStatus status;
101 enum wlanIfaceState state;
108 uint32_t packet_burst;
109 uint8_t country_code[WLAN_COUNTRY_CODE_SIZE];
110 enum WlanRegDomainCode reg_domain;
111 uint8_t desired_ssid[IEEE80211_NWID_LEN + 1];
112 uint32_t desired_channel;
113 enum TruthValue dyn_frequency;
114 enum TruthValue fast_frames;
115 enum TruthValue dturbo;
117 int32_t frag_threshold;
118 int32_t rts_threshold;
119 enum TruthValue priv_subscribe;
120 enum TruthValue bg_scan;
121 int32_t bg_scan_idle;
122 int32_t bg_scan_interval;
123 int32_t beacons_missed;
124 uint8_t desired_bssid[IEEE80211_ADDR_LEN];
125 enum wlanIfaceRoamingMode roam_mode;
126 enum TruthValue dot11d;
127 enum TruthValue dot11h;
128 enum TruthValue dynamic_wds;
129 enum TruthValue power_save;
130 enum TruthValue ap_bridge;
131 int32_t beacon_interval;
133 enum TruthValue hide_ssid;
134 enum TruthValue inact_process;
135 enum wlanIfaceDot11gProtMode do11g_protect;
136 enum TruthValue dot11g_pure;
137 enum TruthValue dot11n_pure;
138 enum WlanIfaceDot11nPduType ampdu;
139 int32_t ampdu_density;
141 enum WlanIfaceDot11nPduType amsdu;
143 enum TruthValue ht_enabled;
144 enum TruthValue ht_compatible;
145 enum wlanIfaceDot11nHTProtMode ht_prot_mode;
146 enum TruthValue rifs;
147 enum TruthValue short_gi;
148 enum wlanIfaceDot11nSMPSMode smps_mode;
150 int32_t tdma_slot_count;
151 int32_t tdma_slot_length;
152 int32_t tdma_binterval;
154 struct wlan_peerlist peerlist;
155 struct ieee80211_stats stats;
157 struct ieee80211_channel *chanlist;
158 struct ieee80211_roamparams_req roamparams;
159 struct ieee80211_txparams_req txparams;
162 uint32_t scan_duration;
163 uint32_t scan_mindwell;
164 uint32_t scan_maxdwell;
165 enum wlanScanConfigStatus scan_status;
166 struct wlan_scanlist scanlist;
168 uint8_t wepsupported;
169 enum wlanWepMode wepmode;
172 uint8_t macsupported;
173 enum wlanMACAccessControlPolicy mac_policy;
175 struct wlan_maclist mac_maclist;
178 enum wlanMeshPeeringEnabled mesh_peering;
179 enum wlanMeshForwardingEnabled mesh_forwarding;
180 enum wlanMeshMetric mesh_metric;
181 enum wlanMeshPath mesh_path;
182 enum wlanHWMPRootMode hwmp_root_mode;
183 uint32_t hwmp_max_hops;
184 struct wlan_mesh_routes mesh_routelist;
186 SLIST_ENTRY(wlan_iface) w_if;
190 WLAN_MESH_RETRY_TO = 0,
191 WLAN_MESH_HOLDING_TO,
192 WLAN_MESH_CONFIRM_TO,
193 WLAN_MESH_MAX_RETRIES,
194 WLAN_HWMP_TARGET_ONLY,
195 WLAN_HWMP_REPLY_FORWARD,
196 WLAN_HWMP_PATH_LIFETIME,
200 WLAN_HWMP_INACTIVITY_TO,
205 int32_t mesh_retryto;
206 int32_t mesh_holdingto;
207 int32_t mesh_confirmto;
208 int32_t mesh_maxretries;
209 int32_t hwmp_targetonly;
210 int32_t hwmp_replyforward;
211 int32_t hwmp_pathlifetime;
212 int32_t hwmp_roottimeout;
213 int32_t hwmp_rootint;
214 int32_t hwmp_rannint;
218 int wlan_ioctl_init(void);
219 int wlan_kmodules_load(void);
220 int wlan_check_media(char *);
221 int wlan_config_state(struct wlan_iface *, uint8_t);
222 int wlan_get_opmode(struct wlan_iface *wif);
223 int wlan_get_local_addr(struct wlan_iface *wif);
224 int wlan_get_parent(struct wlan_iface *wif);
225 int wlan_get_driver_caps(struct wlan_iface *wif);
226 uint8_t wlan_channel_state_to_snmp(uint8_t cstate);
227 uint32_t wlan_channel_flags_to_snmp(uint32_t cflags);
228 int wlan_get_channel_list(struct wlan_iface *wif);
229 int wlan_get_roam_params(struct wlan_iface *wif);
230 int wlan_get_tx_params(struct wlan_iface *wif);
231 int wlan_set_tx_params(struct wlan_iface *wif, int32_t pmode);
232 int wlan_clone_create(struct wlan_iface *);
233 int wlan_clone_destroy(struct wlan_iface *wif);
234 int wlan_config_get_dssid(struct wlan_iface *wif);
235 int wlan_config_set_dssid(struct wlan_iface *wif, char *ssid, int slen);
236 int wlan_config_get_ioctl(struct wlan_iface *wif, int which);
237 int wlan_config_set_ioctl(struct wlan_iface *wif, int which, int val,
238 char *strval, int len);
239 int wlan_set_scan_config(struct wlan_iface *wif);
240 int wlan_get_scan_results(struct wlan_iface *wif);
241 int wlan_get_stats(struct wlan_iface *wif);
242 int wlan_get_wepmode(struct wlan_iface *wif);
243 int wlan_set_wepmode(struct wlan_iface *wif);
244 int wlan_get_weptxkey(struct wlan_iface *wif);
245 int wlan_set_weptxkey(struct wlan_iface *wif);
246 int wlan_get_wepkeys(struct wlan_iface *wif);
247 int wlan_set_wepkeys(struct wlan_iface *wif);
248 int wlan_get_mac_policy(struct wlan_iface *wif);
249 int wlan_set_mac_policy(struct wlan_iface *wif);
250 int wlan_flush_mac_mac(struct wlan_iface *wif);
251 int wlan_get_mac_acl_macs(struct wlan_iface *wif);
252 int wlan_add_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);
253 int wlan_del_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);
255 int32_t wlan_do_sysctl(struct wlan_config *cfg, enum wlan_syscl which, int set);
256 int wlan_mesh_config_get(struct wlan_iface *wif, int which);
257 int wlan_mesh_config_set(struct wlan_iface *wif, int which);
258 int wlan_mesh_flush_routes(struct wlan_iface *wif);
259 int wlan_mesh_add_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
260 int wlan_mesh_del_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
261 int wlan_mesh_get_routelist(struct wlan_iface *wif);
262 int wlan_hwmp_config_get(struct wlan_iface *wif, int which);
263 int wlan_hwmp_config_set(struct wlan_iface *wif, int which);
267 int wlan_peer_set_vlan(struct wlan_iface *wif, struct wlan_peer *wip, int vlan);
268 int wlan_get_peerinfo(struct wlan_iface *wif);
271 struct wlan_peer *wlan_new_peer(const uint8_t *pmac);
272 void wlan_free_peer(struct wlan_peer *wip);
273 int wlan_add_peer(struct wlan_iface *wif, struct wlan_peer *wip);
275 struct wlan_scan_result * wlan_scan_new_result(const uint8_t *ssid,
276 const uint8_t *bssid);
277 void wlan_scan_free_result(struct wlan_scan_result *sr);
278 int wlan_scan_add_result(struct wlan_iface *wif, struct wlan_scan_result *sr);
280 struct wlan_mac_mac *wlan_mac_new_mac(const uint8_t *mac);
281 void wlan_mac_free_mac(struct wlan_mac_mac *wmm);
282 int wlan_mac_add_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm);
284 struct wlan_mesh_route *wlan_mesh_new_route(const uint8_t *dstmac);
285 int wlan_mesh_add_rtentry(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
286 void wlan_mesh_free_route(struct wlan_mesh_route *wmr);