1210502Ssyrinx/*- 2210502Ssyrinx * Copyright (c) 2010 The FreeBSD Foundation 3210502Ssyrinx * All rights reserved. 4210502Ssyrinx * 5210502Ssyrinx * This software was developed by Shteryana Sotirova Shopova under 6210502Ssyrinx * sponsorship from the FreeBSD Foundation. 7210502Ssyrinx * 8210502Ssyrinx * Redistribution and use in source and binary forms, with or without 9210502Ssyrinx * modification, are permitted provided that the following conditions 10210502Ssyrinx * are met: 11210502Ssyrinx * 1. Redistributions of source code must retain the above copyright 12210502Ssyrinx * notice, this list of conditions and the following disclaimer. 13210502Ssyrinx * 2. Redistributions in binary form must reproduce the above copyright 14210502Ssyrinx * notice, this list of conditions and the following disclaimer in the 15210502Ssyrinx * documentation and/or other materials provided with the distribution. 16210502Ssyrinx * 17210502Ssyrinx * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18210502Ssyrinx * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19210502Ssyrinx * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20210502Ssyrinx * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21210502Ssyrinx * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22210502Ssyrinx * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23210502Ssyrinx * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24210502Ssyrinx * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25210502Ssyrinx * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26210502Ssyrinx * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27210502Ssyrinx * SUCH DAMAGE. 28210502Ssyrinx * 29210502Ssyrinx * $FreeBSD: releng/10.3/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h 228657 2011-12-17 19:53:08Z dim $ 30210502Ssyrinx */ 31210502Ssyrinx 32210502Ssyrinx#define WLAN_IFMODE_MAX WlanIfaceOperatingModeType_tdma 33210502Ssyrinx#define WLAN_COUNTRY_CODE_SIZE 3 34210502Ssyrinx#define WLAN_BGSCAN_IDLE_MIN 100 /* XXX */ 35210502Ssyrinx#define WLAN_SCAN_VALID_MIN 10 /* XXX */ 36210502Ssyrinx#define WLAN_TDMA_MAXSLOTS 2 /* XXX */ 37210502Ssyrinx 38210502Ssyrinxstruct wlan_iface; 39210502Ssyrinx 40210502Ssyrinxstruct wlan_peer { 41210502Ssyrinx uint8_t pmac[IEEE80211_ADDR_LEN]; /* key */ 42210502Ssyrinx uint16_t associd; 43210502Ssyrinx uint16_t vlan; 44210502Ssyrinx uint16_t frequency; 45210502Ssyrinx uint32_t fflags; 46210502Ssyrinx uint8_t txrate; 47210502Ssyrinx int8_t rssi; 48210502Ssyrinx uint16_t idle; 49210502Ssyrinx uint16_t txseqs; 50210502Ssyrinx uint16_t rxseqs; 51210502Ssyrinx uint16_t txpower; 52210502Ssyrinx uint8_t capinfo; 53210502Ssyrinx uint32_t state; 54210502Ssyrinx uint16_t local_id; 55210502Ssyrinx uint16_t peer_id; 56210502Ssyrinx SLIST_ENTRY(wlan_peer) wp; 57210502Ssyrinx}; 58210502Ssyrinx 59210502SsyrinxSLIST_HEAD(wlan_peerlist, wlan_peer); 60210502Ssyrinx 61210502Ssyrinxstruct wlan_scan_result { 62210502Ssyrinx uint8_t ssid[IEEE80211_NWID_LEN + 1]; 63210502Ssyrinx uint8_t bssid[IEEE80211_ADDR_LEN]; 64210502Ssyrinx uint8_t opchannel; 65210502Ssyrinx int8_t rssi; 66210502Ssyrinx uint16_t frequency; 67210502Ssyrinx int8_t noise; 68210502Ssyrinx uint16_t bintval; 69210502Ssyrinx uint8_t capinfo; 70210502Ssyrinx struct wlan_iface *pwif; 71210502Ssyrinx SLIST_ENTRY(wlan_scan_result) wsr; 72210502Ssyrinx}; 73210502Ssyrinx 74210502SsyrinxSLIST_HEAD(wlan_scanlist, wlan_scan_result); 75210502Ssyrinx 76210502Ssyrinxstruct wlan_mac_mac { 77210502Ssyrinx uint8_t mac[IEEE80211_ADDR_LEN]; 78210502Ssyrinx enum RowStatus mac_status; 79210502Ssyrinx SLIST_ENTRY(wlan_mac_mac) wm; 80210502Ssyrinx}; 81210502Ssyrinx 82210502SsyrinxSLIST_HEAD(wlan_maclist, wlan_mac_mac); 83210502Ssyrinx 84210502Ssyrinxstruct wlan_mesh_route { 85210502Ssyrinx struct ieee80211req_mesh_route imroute; 86210502Ssyrinx enum RowStatus mroute_status; 87210502Ssyrinx SLIST_ENTRY(wlan_mesh_route) wr; 88210502Ssyrinx}; 89210502Ssyrinx 90210502SsyrinxSLIST_HEAD(wlan_mesh_routes, wlan_mesh_route); 91210502Ssyrinx 92210502Ssyrinxstruct wlan_iface { 93210502Ssyrinx char wname[IFNAMSIZ]; 94210502Ssyrinx uint32_t index; 95210502Ssyrinx char pname[IFNAMSIZ]; 96210502Ssyrinx enum WlanIfaceOperatingModeType mode; 97210502Ssyrinx uint32_t flags; 98210502Ssyrinx uint8_t dbssid[IEEE80211_ADDR_LEN]; 99210502Ssyrinx uint8_t dlmac[IEEE80211_ADDR_LEN]; 100210502Ssyrinx enum RowStatus status; 101210502Ssyrinx enum wlanIfaceState state; 102210502Ssyrinx uint8_t internal; 103210502Ssyrinx 104210502Ssyrinx uint32_t drivercaps; 105210502Ssyrinx uint32_t cryptocaps; 106210502Ssyrinx uint32_t htcaps; 107210502Ssyrinx 108210502Ssyrinx uint32_t packet_burst; 109210502Ssyrinx uint8_t country_code[WLAN_COUNTRY_CODE_SIZE]; 110210502Ssyrinx enum WlanRegDomainCode reg_domain; 111210502Ssyrinx uint8_t desired_ssid[IEEE80211_NWID_LEN + 1]; 112210502Ssyrinx uint32_t desired_channel; 113210502Ssyrinx enum TruthValue dyn_frequency; 114210502Ssyrinx enum TruthValue fast_frames; 115210502Ssyrinx enum TruthValue dturbo; 116210502Ssyrinx int32_t tx_power; 117210502Ssyrinx int32_t frag_threshold; 118210502Ssyrinx int32_t rts_threshold; 119210502Ssyrinx enum TruthValue priv_subscribe; 120210502Ssyrinx enum TruthValue bg_scan; 121210502Ssyrinx int32_t bg_scan_idle; 122210502Ssyrinx int32_t bg_scan_interval; 123210502Ssyrinx int32_t beacons_missed; 124210502Ssyrinx uint8_t desired_bssid[IEEE80211_ADDR_LEN]; 125210502Ssyrinx enum wlanIfaceRoamingMode roam_mode; 126210502Ssyrinx enum TruthValue dot11d; 127210502Ssyrinx enum TruthValue dot11h; 128210502Ssyrinx enum TruthValue dynamic_wds; 129210502Ssyrinx enum TruthValue power_save; 130210502Ssyrinx enum TruthValue ap_bridge; 131210502Ssyrinx int32_t beacon_interval; 132210502Ssyrinx int32_t dtim_period; 133210502Ssyrinx enum TruthValue hide_ssid; 134210502Ssyrinx enum TruthValue inact_process; 135210502Ssyrinx enum wlanIfaceDot11gProtMode do11g_protect; 136210502Ssyrinx enum TruthValue dot11g_pure; 137210502Ssyrinx enum TruthValue dot11n_pure; 138210502Ssyrinx enum WlanIfaceDot11nPduType ampdu; 139210502Ssyrinx int32_t ampdu_density; 140210502Ssyrinx int32_t ampdu_limit; 141210502Ssyrinx enum WlanIfaceDot11nPduType amsdu; 142210502Ssyrinx int32_t amsdu_limit; 143210502Ssyrinx enum TruthValue ht_enabled; 144210502Ssyrinx enum TruthValue ht_compatible; 145210502Ssyrinx enum wlanIfaceDot11nHTProtMode ht_prot_mode; 146210502Ssyrinx enum TruthValue rifs; 147210502Ssyrinx enum TruthValue short_gi; 148210502Ssyrinx enum wlanIfaceDot11nSMPSMode smps_mode; 149210502Ssyrinx int32_t tdma_slot; 150210502Ssyrinx int32_t tdma_slot_count; 151210502Ssyrinx int32_t tdma_slot_length; 152210502Ssyrinx int32_t tdma_binterval; 153210502Ssyrinx 154210502Ssyrinx struct wlan_peerlist peerlist; 155210502Ssyrinx struct ieee80211_stats stats; 156210502Ssyrinx uint32_t nchannels; 157210502Ssyrinx struct ieee80211_channel *chanlist; 158210502Ssyrinx struct ieee80211_roamparams_req roamparams; 159210502Ssyrinx struct ieee80211_txparams_req txparams; 160210502Ssyrinx 161210502Ssyrinx uint32_t scan_flags; 162210502Ssyrinx uint32_t scan_duration; 163210502Ssyrinx uint32_t scan_mindwell; 164210502Ssyrinx uint32_t scan_maxdwell; 165210502Ssyrinx enum wlanScanConfigStatus scan_status; 166210502Ssyrinx struct wlan_scanlist scanlist; 167210502Ssyrinx 168210502Ssyrinx uint8_t wepsupported; 169210502Ssyrinx enum wlanWepMode wepmode; 170210502Ssyrinx int32_t weptxkey; 171210502Ssyrinx 172210502Ssyrinx uint8_t macsupported; 173210502Ssyrinx enum wlanMACAccessControlPolicy mac_policy; 174210502Ssyrinx uint32_t mac_nacls; 175210502Ssyrinx struct wlan_maclist mac_maclist; 176210502Ssyrinx 177210502Ssyrinx uint32_t mesh_ttl; 178228657Sdim enum wlanMeshPeeringEnabled mesh_peering; 179228657Sdim enum wlanMeshForwardingEnabled mesh_forwarding; 180210502Ssyrinx enum wlanMeshMetric mesh_metric; 181210502Ssyrinx enum wlanMeshPath mesh_path; 182210502Ssyrinx enum wlanHWMPRootMode hwmp_root_mode; 183210502Ssyrinx uint32_t hwmp_max_hops; 184210502Ssyrinx struct wlan_mesh_routes mesh_routelist; 185210502Ssyrinx 186210502Ssyrinx SLIST_ENTRY(wlan_iface) w_if; 187210502Ssyrinx}; 188210502Ssyrinx 189210502Ssyrinxenum wlan_syscl { 190210502Ssyrinx WLAN_MESH_RETRY_TO = 0, 191210502Ssyrinx WLAN_MESH_HOLDING_TO, 192210502Ssyrinx WLAN_MESH_CONFIRM_TO, 193210502Ssyrinx WLAN_MESH_MAX_RETRIES, 194210502Ssyrinx WLAN_HWMP_TARGET_ONLY, 195210502Ssyrinx WLAN_HWMP_REPLY_FORWARD, 196210502Ssyrinx WLAN_HWMP_PATH_LIFETIME, 197210502Ssyrinx WLAN_HWMP_ROOT_TO, 198210502Ssyrinx WLAN_HWMP_ROOT_INT, 199210502Ssyrinx WLAN_HWMP_RANN_INT, 200210502Ssyrinx WLAN_HWMP_INACTIVITY_TO, 201210502Ssyrinx WLAN_SYSCTL_MAX 202210502Ssyrinx}; 203210502Ssyrinx 204210502Ssyrinxstruct wlan_config { 205210502Ssyrinx int32_t mesh_retryto; 206210502Ssyrinx int32_t mesh_holdingto; 207210502Ssyrinx int32_t mesh_confirmto; 208210502Ssyrinx int32_t mesh_maxretries; 209210502Ssyrinx int32_t hwmp_targetonly; 210210502Ssyrinx int32_t hwmp_replyforward; 211210502Ssyrinx int32_t hwmp_pathlifetime; 212210502Ssyrinx int32_t hwmp_roottimeout; 213210502Ssyrinx int32_t hwmp_rootint; 214210502Ssyrinx int32_t hwmp_rannint; 215210502Ssyrinx int32_t hwmp_inact; 216210502Ssyrinx}; 217210502Ssyrinx 218210502Ssyrinxint wlan_ioctl_init(void); 219210502Ssyrinxint wlan_kmodules_load(void); 220210502Ssyrinxint wlan_check_media(char *); 221210502Ssyrinxint wlan_config_state(struct wlan_iface *, uint8_t); 222210502Ssyrinxint wlan_get_opmode(struct wlan_iface *wif); 223210502Ssyrinxint wlan_get_local_addr(struct wlan_iface *wif); 224210502Ssyrinxint wlan_get_parent(struct wlan_iface *wif); 225210502Ssyrinxint wlan_get_driver_caps(struct wlan_iface *wif); 226210502Ssyrinxuint8_t wlan_channel_state_to_snmp(uint8_t cstate); 227210502Ssyrinxuint32_t wlan_channel_flags_to_snmp(uint32_t cflags); 228210502Ssyrinxint wlan_get_channel_list(struct wlan_iface *wif); 229210502Ssyrinxint wlan_get_roam_params(struct wlan_iface *wif); 230210502Ssyrinxint wlan_get_tx_params(struct wlan_iface *wif); 231210502Ssyrinxint wlan_set_tx_params(struct wlan_iface *wif, int32_t pmode); 232210502Ssyrinxint wlan_clone_create(struct wlan_iface *); 233210502Ssyrinxint wlan_clone_destroy(struct wlan_iface *wif); 234210502Ssyrinxint wlan_config_get_dssid(struct wlan_iface *wif); 235210502Ssyrinxint wlan_config_set_dssid(struct wlan_iface *wif, char *ssid, int slen); 236210502Ssyrinxint wlan_config_get_ioctl(struct wlan_iface *wif, int which); 237210502Ssyrinxint wlan_config_set_ioctl(struct wlan_iface *wif, int which, int val, 238210502Ssyrinx char *strval, int len); 239210502Ssyrinxint wlan_set_scan_config(struct wlan_iface *wif); 240210502Ssyrinxint wlan_get_scan_results(struct wlan_iface *wif); 241210502Ssyrinxint wlan_get_stats(struct wlan_iface *wif); 242210502Ssyrinxint wlan_get_wepmode(struct wlan_iface *wif); 243210502Ssyrinxint wlan_set_wepmode(struct wlan_iface *wif); 244210502Ssyrinxint wlan_get_weptxkey(struct wlan_iface *wif); 245210502Ssyrinxint wlan_set_weptxkey(struct wlan_iface *wif); 246210502Ssyrinxint wlan_get_wepkeys(struct wlan_iface *wif); 247210502Ssyrinxint wlan_set_wepkeys(struct wlan_iface *wif); 248210502Ssyrinxint wlan_get_mac_policy(struct wlan_iface *wif); 249210502Ssyrinxint wlan_set_mac_policy(struct wlan_iface *wif); 250210502Ssyrinxint wlan_flush_mac_mac(struct wlan_iface *wif); 251210502Ssyrinxint wlan_get_mac_acl_macs(struct wlan_iface *wif); 252210502Ssyrinxint wlan_add_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac); 253210502Ssyrinxint wlan_del_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac); 254210502Ssyrinx 255210502Ssyrinxint32_t wlan_do_sysctl(struct wlan_config *cfg, enum wlan_syscl which, int set); 256210502Ssyrinxint wlan_mesh_config_get(struct wlan_iface *wif, int which); 257210502Ssyrinxint wlan_mesh_config_set(struct wlan_iface *wif, int which); 258210502Ssyrinxint wlan_mesh_flush_routes(struct wlan_iface *wif); 259210502Ssyrinxint wlan_mesh_add_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr); 260210502Ssyrinxint wlan_mesh_del_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr); 261210502Ssyrinxint wlan_mesh_get_routelist(struct wlan_iface *wif); 262210502Ssyrinxint wlan_hwmp_config_get(struct wlan_iface *wif, int which); 263210502Ssyrinxint wlan_hwmp_config_set(struct wlan_iface *wif, int which); 264210502Ssyrinx 265210502Ssyrinx/* XXX: static */ 266210502Ssyrinx 267210502Ssyrinxint wlan_peer_set_vlan(struct wlan_iface *wif, struct wlan_peer *wip, int vlan); 268210502Ssyrinxint wlan_get_peerinfo(struct wlan_iface *wif); 269210502Ssyrinx 270210502Ssyrinx/* XXX*/ 271210502Ssyrinxstruct wlan_peer *wlan_new_peer(const uint8_t *pmac); 272210502Ssyrinxvoid wlan_free_peer(struct wlan_peer *wip); 273210502Ssyrinxint wlan_add_peer(struct wlan_iface *wif, struct wlan_peer *wip); 274210502Ssyrinx 275210502Ssyrinxstruct wlan_scan_result * wlan_scan_new_result(const uint8_t *ssid, 276210502Ssyrinx const uint8_t *bssid); 277210502Ssyrinxvoid wlan_scan_free_result(struct wlan_scan_result *sr); 278210502Ssyrinxint wlan_scan_add_result(struct wlan_iface *wif, struct wlan_scan_result *sr); 279210502Ssyrinx 280210502Ssyrinxstruct wlan_mac_mac *wlan_mac_new_mac(const uint8_t *mac); 281210502Ssyrinxvoid wlan_mac_free_mac(struct wlan_mac_mac *wmm); 282210502Ssyrinxint wlan_mac_add_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm); 283210502Ssyrinx 284210502Ssyrinxstruct wlan_mesh_route *wlan_mesh_new_route(const uint8_t *dstmac); 285210502Ssyrinxint wlan_mesh_add_rtentry(struct wlan_iface *wif, struct wlan_mesh_route *wmr); 286210502Ssyrinxvoid wlan_mesh_free_route(struct wlan_mesh_route *wmr); 287