| 1 | /* |
| 2 | * iwinfo - Wireless Information Library - Lua Bindings |
| 3 | * |
| 4 | * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org> |
| 5 | * |
| 6 | * The iwinfo library is free software: you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License version 2 |
| 8 | * as published by the Free Software Foundation. |
| 9 | * |
| 10 | * The iwinfo library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with the iwinfo library. If not, see http://www.gnu.org/licenses/. |
| 17 | */ |
| 18 | |
| 19 | #include "iwinfo.h" |
| 20 | |
| 21 | |
| 22 | /* |
| 23 | * name constants |
| 24 | */ |
| 25 | const char *IWINFO_CIPHER_NAMES[] = { |
| 26 | "NONE", |
| 27 | "WEP40", |
| 28 | "TKIP", |
| 29 | "WRAP", |
| 30 | "CCMP", |
| 31 | "WEP104", |
| 32 | "AES-OCB", |
| 33 | "CKIP", |
| 34 | }; |
| 35 | |
| 36 | const char *IWINFO_KMGMT_NAMES[] = { |
| 37 | "NONE", |
| 38 | "802.1X", |
| 39 | "PSK", |
| 40 | }; |
| 41 | |
| 42 | const char *IWINFO_AUTH_NAMES[] = { |
| 43 | "OPEN", |
| 44 | "SHARED", |
| 45 | }; |
| 46 | |
| 47 | const char *IWINFO_OPMODE_NAMES[] = { |
| 48 | "Unknown", |
| 49 | "Master", |
| 50 | "Ad-Hoc", |
| 51 | "Client", |
| 52 | "Monitor", |
| 53 | }; |
| 54 | |
| 55 | |
| 56 | /* |
| 57 | * ISO3166 country labels |
| 58 | */ |
| 59 | |
| 60 | const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[] = { |
| 61 | { 0x3030 /* 00 */, "World" }, |
| 62 | { 0x4144 /* AD */, "Andorra" }, |
| 63 | { 0x4145 /* AE */, "United Arab Emirates" }, |
| 64 | { 0x4146 /* AF */, "Afghanistan" }, |
| 65 | { 0x4147 /* AG */, "Antigua and Barbuda" }, |
| 66 | { 0x4149 /* AI */, "Anguilla" }, |
| 67 | { 0x414C /* AL */, "Albania" }, |
| 68 | { 0x414D /* AM */, "Armenia" }, |
| 69 | { 0x414E /* AN */, "Netherlands Antilles" }, |
| 70 | { 0x414F /* AO */, "Angola" }, |
| 71 | { 0x4151 /* AQ */, "Antarctica" }, |
| 72 | { 0x4152 /* AR */, "Argentina" }, |
| 73 | { 0x4153 /* AS */, "American Samoa" }, |
| 74 | { 0x4154 /* AT */, "Austria" }, |
| 75 | { 0x4155 /* AU */, "Australia" }, |
| 76 | { 0x4157 /* AW */, "Aruba" }, |
| 77 | { 0x4158 /* AX */, "Aland Islands" }, |
| 78 | { 0x415A /* AZ */, "Azerbaijan" }, |
| 79 | { 0x4241 /* BA */, "Bosnia and Herzegovina" }, |
| 80 | { 0x4242 /* BB */, "Barbados" }, |
| 81 | { 0x4244 /* BD */, "Bangladesh" }, |
| 82 | { 0x4245 /* BE */, "Belgium" }, |
| 83 | { 0x4246 /* BF */, "Burkina Faso" }, |
| 84 | { 0x4247 /* BG */, "Bulgaria" }, |
| 85 | { 0x4248 /* BH */, "Bahrain" }, |
| 86 | { 0x4249 /* BI */, "Burundi" }, |
| 87 | { 0x424A /* BJ */, "Benin" }, |
| 88 | { 0x424C /* BL */, "Saint Barthelemy" }, |
| 89 | { 0x424D /* BM */, "Bermuda" }, |
| 90 | { 0x424E /* BN */, "Brunei Darussalam" }, |
| 91 | { 0x424F /* BO */, "Bolivia" }, |
| 92 | { 0x4252 /* BR */, "Brazil" }, |
| 93 | { 0x4253 /* BS */, "Bahamas" }, |
| 94 | { 0x4254 /* BT */, "Bhutan" }, |
| 95 | { 0x4256 /* BV */, "Bouvet Island" }, |
| 96 | { 0x4257 /* BW */, "Botswana" }, |
| 97 | { 0x4259 /* BY */, "Belarus" }, |
| 98 | { 0x425A /* BZ */, "Belize" }, |
| 99 | { 0x4341 /* CA */, "Canada" }, |
| 100 | { 0x4343 /* CC */, "Cocos (Keeling) Islands" }, |
| 101 | { 0x4344 /* CD */, "Congo" }, |
| 102 | { 0x4346 /* CF */, "Central African Republic" }, |
| 103 | { 0x4347 /* CG */, "Congo" }, |
| 104 | { 0x4348 /* CH */, "Switzerland" }, |
| 105 | { 0x4349 /* CI */, "Cote d'Ivoire" }, |
| 106 | { 0x434B /* CK */, "Cook Islands" }, |
| 107 | { 0x434C /* CL */, "Chile" }, |
| 108 | { 0x434D /* CM */, "Cameroon" }, |
| 109 | { 0x434E /* CN */, "China" }, |
| 110 | { 0x434F /* CO */, "Colombia" }, |
| 111 | { 0x4352 /* CR */, "Costa Rica" }, |
| 112 | { 0x4355 /* CU */, "Cuba" }, |
| 113 | { 0x4356 /* CV */, "Cape Verde" }, |
| 114 | { 0x4358 /* CX */, "Christmas Island" }, |
| 115 | { 0x4359 /* CY */, "Cyprus" }, |
| 116 | { 0x435A /* CZ */, "Czech Republic" }, |
| 117 | { 0x4445 /* DE */, "Germany" }, |
| 118 | { 0x444A /* DJ */, "Djibouti" }, |
| 119 | { 0x444B /* DK */, "Denmark" }, |
| 120 | { 0x444D /* DM */, "Dominica" }, |
| 121 | { 0x444F /* DO */, "Dominican Republic" }, |
| 122 | { 0x445A /* DZ */, "Algeria" }, |
| 123 | { 0x4543 /* EC */, "Ecuador" }, |
| 124 | { 0x4545 /* EE */, "Estonia" }, |
| 125 | { 0x4547 /* EG */, "Egypt" }, |
| 126 | { 0x4548 /* EH */, "Western Sahara" }, |
| 127 | { 0x4552 /* ER */, "Eritrea" }, |
| 128 | { 0x4553 /* ES */, "Spain" }, |
| 129 | { 0x4554 /* ET */, "Ethiopia" }, |
| 130 | { 0x4649 /* FI */, "Finland" }, |
| 131 | { 0x464A /* FJ */, "Fiji" }, |
| 132 | { 0x464B /* FK */, "Falkland Islands" }, |
| 133 | { 0x464D /* FM */, "Micronesia" }, |
| 134 | { 0x464F /* FO */, "Faroe Islands" }, |
| 135 | { 0x4652 /* FR */, "France" }, |
| 136 | { 0x4741 /* GA */, "Gabon" }, |
| 137 | { 0x4742 /* GB */, "United Kingdom" }, |
| 138 | { 0x4744 /* GD */, "Grenada" }, |
| 139 | { 0x4745 /* GE */, "Georgia" }, |
| 140 | { 0x4746 /* GF */, "French Guiana" }, |
| 141 | { 0x4747 /* GG */, "Guernsey" }, |
| 142 | { 0x4748 /* GH */, "Ghana" }, |
| 143 | { 0x4749 /* GI */, "Gibraltar" }, |
| 144 | { 0x474C /* GL */, "Greenland" }, |
| 145 | { 0x474D /* GM */, "Gambia" }, |
| 146 | { 0x474E /* GN */, "Guinea" }, |
| 147 | { 0x4750 /* GP */, "Guadeloupe" }, |
| 148 | { 0x4751 /* GQ */, "Equatorial Guinea" }, |
| 149 | { 0x4752 /* GR */, "Greece" }, |
| 150 | { 0x4753 /* GS */, "South Georgia" }, |
| 151 | { 0x4754 /* GT */, "Guatemala" }, |
| 152 | { 0x4755 /* GU */, "Guam" }, |
| 153 | { 0x4757 /* GW */, "Guinea-Bissau" }, |
| 154 | { 0x4759 /* GY */, "Guyana" }, |
| 155 | { 0x484B /* HK */, "Hong Kong" }, |
| 156 | { 0x484D /* HM */, "Heard and McDonald Islands" }, |
| 157 | { 0x484E /* HN */, "Honduras" }, |
| 158 | { 0x4852 /* HR */, "Croatia" }, |
| 159 | { 0x4854 /* HT */, "Haiti" }, |
| 160 | { 0x4855 /* HU */, "Hungary" }, |
| 161 | { 0x4944 /* ID */, "Indonesia" }, |
| 162 | { 0x4945 /* IE */, "Ireland" }, |
| 163 | { 0x494C /* IL */, "Israel" }, |
| 164 | { 0x494D /* IM */, "Isle of Man" }, |
| 165 | { 0x494E /* IN */, "India" }, |
| 166 | { 0x494F /* IO */, "Chagos Islands" }, |
| 167 | { 0x4951 /* IQ */, "Iraq" }, |
| 168 | { 0x4952 /* IR */, "Iran" }, |
| 169 | { 0x4953 /* IS */, "Iceland" }, |
| 170 | { 0x4954 /* IT */, "Italy" }, |
| 171 | { 0x4A45 /* JE */, "Jersey" }, |
| 172 | { 0x4A4D /* JM */, "Jamaica" }, |
| 173 | { 0x4A4F /* JO */, "Jordan" }, |
| 174 | { 0x4A50 /* JP */, "Japan" }, |
| 175 | { 0x4B45 /* KE */, "Kenya" }, |
| 176 | { 0x4B47 /* KG */, "Kyrgyzstan" }, |
| 177 | { 0x4B48 /* KH */, "Cambodia" }, |
| 178 | { 0x4B49 /* KI */, "Kiribati" }, |
| 179 | { 0x4B4D /* KM */, "Comoros" }, |
| 180 | { 0x4B4E /* KN */, "Saint Kitts and Nevis" }, |
| 181 | { 0x4B50 /* KP */, "North Korea" }, |
| 182 | { 0x4B52 /* KR */, "South Korea" }, |
| 183 | { 0x4B57 /* KW */, "Kuwait" }, |
| 184 | { 0x4B59 /* KY */, "Cayman Islands" }, |
| 185 | { 0x4B5A /* KZ */, "Kazakhstan" }, |
| 186 | { 0x4C41 /* LA */, "Laos" }, |
| 187 | { 0x4C42 /* LB */, "Lebanon" }, |
| 188 | { 0x4C43 /* LC */, "Saint Lucia" }, |
| 189 | { 0x4C49 /* LI */, "Liechtenstein" }, |
| 190 | { 0x4C4B /* LK */, "Sri Lanka" }, |
| 191 | { 0x4C52 /* LR */, "Liberia" }, |
| 192 | { 0x4C53 /* LS */, "Lesotho" }, |
| 193 | { 0x4C54 /* LT */, "Lithuania" }, |
| 194 | { 0x4C55 /* LU */, "Luxembourg" }, |
| 195 | { 0x4C56 /* LV */, "Latvia" }, |
| 196 | { 0x4C59 /* LY */, "Libyan Arab Jamahiriya" }, |
| 197 | { 0x4D41 /* MA */, "Morocco" }, |
| 198 | { 0x4D43 /* MC */, "Monaco" }, |
| 199 | { 0x4D44 /* MD */, "Moldova" }, |
| 200 | { 0x4D45 /* ME */, "Montenegro" }, |
| 201 | { 0x4D46 /* MF */, "Saint Martin (French part)" }, |
| 202 | { 0x4D47 /* MG */, "Madagascar" }, |
| 203 | { 0x4D48 /* MH */, "Marshall Islands" }, |
| 204 | { 0x4D4B /* MK */, "Macedonia" }, |
| 205 | { 0x4D4C /* ML */, "Mali" }, |
| 206 | { 0x4D4D /* MM */, "Myanmar" }, |
| 207 | { 0x4D4E /* MN */, "Mongolia" }, |
| 208 | { 0x4D4F /* MO */, "Macao" }, |
| 209 | { 0x4D50 /* MP */, "Northern Mariana Islands" }, |
| 210 | { 0x4D51 /* MQ */, "Martinique" }, |
| 211 | { 0x4D52 /* MR */, "Mauritania" }, |
| 212 | { 0x4D53 /* MS */, "Montserrat" }, |
| 213 | { 0x4D54 /* MT */, "Malta" }, |
| 214 | { 0x4D55 /* MU */, "Mauritius" }, |
| 215 | { 0x4D56 /* MV */, "Maldives" }, |
| 216 | { 0x4D57 /* MW */, "Malawi" }, |
| 217 | { 0x4D58 /* MX */, "Mexico" }, |
| 218 | { 0x4D59 /* MY */, "Malaysia" }, |
| 219 | { 0x4D5A /* MZ */, "Mozambique" }, |
| 220 | { 0x4E41 /* NA */, "Namibia" }, |
| 221 | { 0x4E43 /* NC */, "New Caledonia" }, |
| 222 | { 0x4E45 /* NE */, "Niger" }, |
| 223 | { 0x4E46 /* NF */, "Norfolk Island" }, |
| 224 | { 0x4E47 /* NG */, "Nigeria" }, |
| 225 | { 0x4E49 /* NI */, "Nicaragua" }, |
| 226 | { 0x4E4C /* NL */, "Netherlands" }, |
| 227 | { 0x4E4F /* NO */, "Norway" }, |
| 228 | { 0x4E50 /* NP */, "Nepal" }, |
| 229 | { 0x4E52 /* NR */, "Nauru" }, |
| 230 | { 0x4E55 /* NU */, "Niue" }, |
| 231 | { 0x4E5A /* NZ */, "New Zealand" }, |
| 232 | { 0x4F4D /* OM */, "Oman" }, |
| 233 | { 0x5041 /* PA */, "Panama" }, |
| 234 | { 0x5045 /* PE */, "Peru" }, |
| 235 | { 0x5046 /* PF */, "French Polynesia" }, |
| 236 | { 0x5047 /* PG */, "Papua New Guinea" }, |
| 237 | { 0x5048 /* PH */, "Philippines" }, |
| 238 | { 0x504B /* PK */, "Pakistan" }, |
| 239 | { 0x504C /* PL */, "Poland" }, |
| 240 | { 0x504D /* PM */, "Saint Pierre and Miquelon" }, |
| 241 | { 0x504E /* PN */, "Pitcairn" }, |
| 242 | { 0x5052 /* PR */, "Puerto Rico" }, |
| 243 | { 0x5053 /* PS */, "Palestinian Territory" }, |
| 244 | { 0x5054 /* PT */, "Portugal" }, |
| 245 | { 0x5057 /* PW */, "Palau" }, |
| 246 | { 0x5059 /* PY */, "Paraguay" }, |
| 247 | { 0x5141 /* QA */, "Qatar" }, |
| 248 | { 0x5245 /* RE */, "Reunion" }, |
| 249 | { 0x524F /* RO */, "Romania" }, |
| 250 | { 0x5253 /* RS */, "Serbia" }, |
| 251 | { 0x5255 /* RU */, "Russian Federation" }, |
| 252 | { 0x5257 /* RW */, "Rwanda" }, |
| 253 | { 0x5341 /* SA */, "Saudi Arabia" }, |
| 254 | { 0x5342 /* SB */, "Solomon Islands" }, |
| 255 | { 0x5343 /* SC */, "Seychelles" }, |
| 256 | { 0x5344 /* SD */, "Sudan" }, |
| 257 | { 0x5345 /* SE */, "Sweden" }, |
| 258 | { 0x5347 /* SG */, "Singapore" }, |
| 259 | { 0x5348 /* SH */, "St. Helena and Dependencies" }, |
| 260 | { 0x5349 /* SI */, "Slovenia" }, |
| 261 | { 0x534A /* SJ */, "Svalbard and Jan Mayen" }, |
| 262 | { 0x534B /* SK */, "Slovakia" }, |
| 263 | { 0x534C /* SL */, "Sierra Leone" }, |
| 264 | { 0x534D /* SM */, "San Marino" }, |
| 265 | { 0x534E /* SN */, "Senegal" }, |
| 266 | { 0x534F /* SO */, "Somalia" }, |
| 267 | { 0x5352 /* SR */, "Suriname" }, |
| 268 | { 0x5354 /* ST */, "Sao Tome and Principe" }, |
| 269 | { 0x5356 /* SV */, "El Salvador" }, |
| 270 | { 0x5359 /* SY */, "Syrian Arab Republic" }, |
| 271 | { 0x535A /* SZ */, "Swaziland" }, |
| 272 | { 0x5443 /* TC */, "Turks and Caicos Islands" }, |
| 273 | { 0x5444 /* TD */, "Chad" }, |
| 274 | { 0x5446 /* TF */, "French Southern Territories" }, |
| 275 | { 0x5447 /* TG */, "Togo" }, |
| 276 | { 0x5448 /* TH */, "Thailand" }, |
| 277 | { 0x544A /* TJ */, "Tajikistan" }, |
| 278 | { 0x544B /* TK */, "Tokelau" }, |
| 279 | { 0x544C /* TL */, "Timor-Leste" }, |
| 280 | { 0x544D /* TM */, "Turkmenistan" }, |
| 281 | { 0x544E /* TN */, "Tunisia" }, |
| 282 | { 0x544F /* TO */, "Tonga" }, |
| 283 | { 0x5452 /* TR */, "Turkey" }, |
| 284 | { 0x5454 /* TT */, "Trinidad and Tobago" }, |
| 285 | { 0x5456 /* TV */, "Tuvalu" }, |
| 286 | { 0x5457 /* TW */, "Taiwan" }, |
| 287 | { 0x545A /* TZ */, "Tanzania" }, |
| 288 | { 0x5541 /* UA */, "Ukraine" }, |
| 289 | { 0x5547 /* UG */, "Uganda" }, |
| 290 | { 0x554D /* UM */, "U.S. Minor Outlying Islands" }, |
| 291 | { 0x5553 /* US */, "United States" }, |
| 292 | { 0x5559 /* UY */, "Uruguay" }, |
| 293 | { 0x555A /* UZ */, "Uzbekistan" }, |
| 294 | { 0x5641 /* VA */, "Vatican City State" }, |
| 295 | { 0x5643 /* VC */, "St. Vincent and Grenadines" }, |
| 296 | { 0x5645 /* VE */, "Venezuela" }, |
| 297 | { 0x5647 /* VG */, "Virgin Islands, British" }, |
| 298 | { 0x5649 /* VI */, "Virgin Islands, U.S." }, |
| 299 | { 0x564E /* VN */, "Viet Nam" }, |
| 300 | { 0x5655 /* VU */, "Vanuatu" }, |
| 301 | { 0x5746 /* WF */, "Wallis and Futuna" }, |
| 302 | { 0x5753 /* WS */, "Samoa" }, |
| 303 | { 0x5945 /* YE */, "Yemen" }, |
| 304 | { 0x5954 /* YT */, "Mayotte" }, |
| 305 | { 0x5A41 /* ZA */, "South Africa" }, |
| 306 | { 0x5A4D /* ZM */, "Zambia" }, |
| 307 | { 0x5A57 /* ZW */, "Zimbabwe" }, |
| 308 | { 0, "" } |
| 309 | }; |
| 310 | |
| 311 | /* |
| 312 | * hardware database |
| 313 | */ |
| 314 | |
| 315 | const char VENDOR_UBNT[] = "Ubiquiti"; |
| 316 | const char VENDOR_ATH[] = "Atheros"; |
| 317 | |
| 318 | const struct iwinfo_hardware_entry IWINFO_HARDWARE_ENTRIES[] = { |
| 319 | /* { vendor, model, vendorid, deviceid, subsys vendorid, subsys deviceid, poweroff, freqoff } */ |
| 320 | #if defined(USE_MADWIFI) || defined(USE_NL80211) |
| 321 | { VENDOR_UBNT, "PowerStation2 (18V)", 0xffff, 0xffff, 0xffff, 0xb102, 0, 0 }, |
| 322 | { VENDOR_UBNT, "PowerStation2 (16D)", 0xffff, 0xffff, 0xffff, 0xb202, 0, 0 }, |
| 323 | { VENDOR_UBNT, "PowerStation2 (EXT)", 0xffff, 0xffff, 0xffff, 0xb302, 0, 0 }, |
| 324 | { VENDOR_UBNT, "PowerStation5 (22V)", 0xffff, 0xffff, 0xffff, 0xb105, 0, 0 }, |
| 325 | { VENDOR_UBNT, "PowerStation5 (EXT)", 0xffff, 0xffff, 0xffff, 0xb305, 0, 0 }, |
| 326 | { VENDOR_UBNT, "PicoStation2", 0xffff, 0xffff, 0xffff, 0xc302, 0, 0 }, |
| 327 | { VENDOR_UBNT, "PicoStation2 HP", 0xffff, 0xffff, 0xffff, 0xc3a2, 10, 0 }, |
| 328 | { VENDOR_UBNT, "WispStation5", 0xffff, 0xffff, 0xffff, 0xa105, 0, 0 }, |
| 329 | { VENDOR_UBNT, "LiteStation2", 0xffff, 0xffff, 0xffff, 0xa002, 10, 0 }, |
| 330 | { VENDOR_UBNT, "LiteStation5", 0xffff, 0xffff, 0xffff, 0xa005, 5, 0 }, |
| 331 | { VENDOR_UBNT, "NanoStation2", 0xffff, 0xffff, 0xffff, 0xc002, 10, 0 }, |
| 332 | { VENDOR_UBNT, "NanoStation5", 0xffff, 0xffff, 0xffff, 0xc005, 5, 0 }, |
| 333 | { VENDOR_UBNT, "NanoStation Loco2", 0xffff, 0xffff, 0xffff, 0xc102, 10, 0 }, |
| 334 | { VENDOR_UBNT, "NanoStation Loco5", 0xffff, 0xffff, 0xffff, 0xc105, 5, 0 }, |
| 335 | { VENDOR_UBNT, "Bullet2", 0xffff, 0xffff, 0xffff, 0xc202, 10, 0 }, |
| 336 | { VENDOR_UBNT, "Bullet5", 0xffff, 0xffff, 0xffff, 0xc205, 5, 0 }, |
| 337 | { VENDOR_UBNT, "XR2", 0x168c, 0x001b, 0x0777, 0x3002, 10, 0 }, |
| 338 | { VENDOR_UBNT, "XR2", 0x168c, 0x001b, 0x7777, 0x3002, 10, 0 }, |
| 339 | { VENDOR_UBNT, "XR2.3", 0x168c, 0x001b, 0x0777, 0x3b02, 10, 0 }, |
| 340 | { VENDOR_UBNT, "XR2.6", 0x168c, 0x001b, 0x0777, 0x3c02, 10, 0 }, |
| 341 | { VENDOR_UBNT, "XR3-2.8", 0x168c, 0x001b, 0x0777, 0x3b03, 10, 0 }, |
| 342 | { VENDOR_UBNT, "XR3-3.6", 0x168c, 0x001b, 0x0777, 0x3c03, 10, 0 }, |
| 343 | { VENDOR_UBNT, "XR3", 0x168c, 0x001b, 0x0777, 0x3003, 10, 0 }, |
| 344 | { VENDOR_UBNT, "XR4", 0x168c, 0x001b, 0x0777, 0x3004, 10, 0 }, |
| 345 | { VENDOR_UBNT, "XR5", 0x168c, 0x001b, 0x0777, 0x3005, 10, 0 }, |
| 346 | { VENDOR_UBNT, "XR5", 0x168c, 0x001b, 0x7777, 0x3005, 10, 0 }, |
| 347 | { VENDOR_UBNT, "XR7", 0x168c, 0x001b, 0x0777, 0x3007, 10, 0 }, |
| 348 | { VENDOR_UBNT, "XR9", 0x168c, 0x001b, 0x0777, 0x3009, 10, -1520 }, |
| 349 | { VENDOR_UBNT, "SRC", 0x168c, 0x0013, 0x168c, 0x1042, 1, 0 }, |
| 350 | { VENDOR_UBNT, "SR2", 0x168c, 0x0013, 0x0777, 0x2041, 10, 0 }, |
| 351 | { VENDOR_UBNT, "SR4", 0x168c, 0x0013, 0x0777, 0x2004, 6, 0 }, |
| 352 | { VENDOR_UBNT, "SR4", 0x168c, 0x0013, 0x7777, 0x2004, 6, 0 }, |
| 353 | { VENDOR_UBNT, "SR4C", 0x168c, 0x0013, 0x0777, 0x1004, 6, 0 }, |
| 354 | { VENDOR_UBNT, "SR4C", 0x168c, 0x0013, 0x7777, 0x1004, 6, 0 }, |
| 355 | { VENDOR_UBNT, "SR5", 0x168c, 0x0013, 0x168c, 0x2042, 7, 0 }, |
| 356 | { VENDOR_UBNT, "SR9", 0x168c, 0x0013, 0x7777, 0x2009, 12, -1500 }, |
| 357 | { VENDOR_UBNT, "SR71A", 0x168c, 0x0027, 0x168c, 0x2082, 10, 0 }, |
| 358 | { VENDOR_UBNT, "SR71", 0x168c, 0x0027, 0x0777, 0x4082, 10, 0 }, |
| 359 | #endif |
| 360 | #ifdef USE_NL80211 |
| 361 | { VENDOR_UBNT, "PicoStation M2", 0x168c, 0x002a, 0x0777, 0xe302, 12, 0 }, /* ToDo: confirm offset */ |
| 362 | { VENDOR_UBNT, "NanoStation M2", 0x168c, 0x002a, 0x0777, 0xe012, 12, 0 }, /* ToDo: confirm offset */ |
| 363 | { VENDOR_UBNT, "NanoStation M5", 0x168c, 0x002a, 0x0777, 0xe005, 5, 0 }, /* ToDo: confirm offset */ |
| 364 | { VENDOR_UBNT, "Bullet M2", 0x168c, 0x002a, 0x0777, 0xe202, 12, 0 }, |
| 365 | { VENDOR_UBNT, "Bullet M5", 0x168c, 0x002a, 0x0777, 0xe805, 5, 0 }, |
| 366 | |
| 367 | { VENDOR_ATH, "AR9220", 0x168c, 0x0029, 0x168c, 0xa094, 0, 0 }, |
| 368 | { VENDOR_ATH, "AR9223", 0x168c, 0x0029, 0x168c, 0xa095, 0, 0 }, |
| 369 | #endif |
| 370 | { NULL } |
| 371 | }; |
| 372 | |
| 373 | |
| 374 | const char * iwinfo_type(const char *ifname) |
| 375 | { |
| 376 | #ifdef USE_NL80211 |
| 377 | if (nl80211_probe(ifname)) |
| 378 | return "nl80211"; |
| 379 | else |
| 380 | #endif |
| 381 | |
| 382 | #ifdef USE_MADWIFI |
| 383 | if (madwifi_probe(ifname)) |
| 384 | return "madwifi"; |
| 385 | else |
| 386 | #endif |
| 387 | |
| 388 | #ifdef USE_WL |
| 389 | if (wl_probe(ifname)) |
| 390 | return "wl"; |
| 391 | else |
| 392 | #endif |
| 393 | |
| 394 | if (wext_probe(ifname)) |
| 395 | return "wext"; |
| 396 | |
| 397 | return NULL; |
| 398 | } |
| 399 | |
| 400 | const struct iwinfo_ops * iwinfo_backend(const char *ifname) |
| 401 | { |
| 402 | const char *type; |
| 403 | struct iwinfo_ops *ops; |
| 404 | |
| 405 | type = iwinfo_type(ifname); |
| 406 | if (!type) |
| 407 | return NULL; |
| 408 | |
| 409 | #ifdef USE_NL80211 |
| 410 | if (!strcmp(type, "nl80211")) |
| 411 | return &nl80211_ops; |
| 412 | else |
| 413 | #endif |
| 414 | |
| 415 | #ifdef USE_MADWIFI |
| 416 | if (!strcmp(type, "madwifi")) |
| 417 | return &madwifi_ops; |
| 418 | else |
| 419 | #endif |
| 420 | |
| 421 | #ifdef USE_WL |
| 422 | if (!strcmp(type, "wl")) |
| 423 | return &wl_ops; |
| 424 | else |
| 425 | #endif |
| 426 | |
| 427 | if (!strcmp(type, "wext")) |
| 428 | return &wext_ops; |
| 429 | |
| 430 | return NULL; |
| 431 | } |
| 432 | |
| 433 | void iwinfo_finish(void) |
| 434 | { |
| 435 | #ifdef USE_WL |
| 436 | wl_close(); |
| 437 | #endif |
| 438 | #ifdef USE_MADWIFI |
| 439 | madwifi_close(); |
| 440 | #endif |
| 441 | #ifdef USE_NL80211 |
| 442 | nl80211_close(); |
| 443 | #endif |
| 444 | wext_close(); |
| 445 | iwinfo_close(); |
| 446 | } |
| 447 | |