1 /* 2 * iwinfo - Wireless Information Library - Lua Bindings 3 * 4 * Copyright (C) 2009-2013 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 "Master (VLAN)", 54 "WDS", 55 "Mesh Point", 56 "P2P Client", 57 "P2P Go", 58 }; 59 60 const char *IWINFO_HTMODE_NAMES[] = { 61 "HT20", 62 "HT40", 63 "VHT20", 64 "VHT40", 65 "VHT80", 66 "VHT80+80", 67 "VHT160", 68 "NOHT", 69 "HE20", 70 "HE40", 71 "HE80", 72 "HE80+80", 73 "HE160" 74 }; 75 76 77 /* 78 * ISO3166 country labels 79 */ 80 81 const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[] = { 82 { 0x3030 /* 00 */, "World" }, 83 { 0x4144 /* AD */, "Andorra" }, 84 { 0x4145 /* AE */, "United Arab Emirates" }, 85 { 0x4146 /* AF */, "Afghanistan" }, 86 { 0x4147 /* AG */, "Antigua and Barbuda" }, 87 { 0x4149 /* AI */, "Anguilla" }, 88 { 0x414C /* AL */, "Albania" }, 89 { 0x414D /* AM */, "Armenia" }, 90 { 0x414E /* AN */, "Netherlands Antilles" }, 91 { 0x414F /* AO */, "Angola" }, 92 { 0x4151 /* AQ */, "Antarctica" }, 93 { 0x4152 /* AR */, "Argentina" }, 94 { 0x4153 /* AS */, "American Samoa" }, 95 { 0x4154 /* AT */, "Austria" }, 96 { 0x4155 /* AU */, "Australia" }, 97 { 0x4157 /* AW */, "Aruba" }, 98 { 0x4158 /* AX */, "Aland Islands" }, 99 { 0x415A /* AZ */, "Azerbaijan" }, 100 { 0x4241 /* BA */, "Bosnia and Herzegovina" }, 101 { 0x4242 /* BB */, "Barbados" }, 102 { 0x4244 /* BD */, "Bangladesh" }, 103 { 0x4245 /* BE */, "Belgium" }, 104 { 0x4246 /* BF */, "Burkina Faso" }, 105 { 0x4247 /* BG */, "Bulgaria" }, 106 { 0x4248 /* BH */, "Bahrain" }, 107 { 0x4249 /* BI */, "Burundi" }, 108 { 0x424A /* BJ */, "Benin" }, 109 { 0x424C /* BL */, "Saint Barthelemy" }, 110 { 0x424D /* BM */, "Bermuda" }, 111 { 0x424E /* BN */, "Brunei Darussalam" }, 112 { 0x424F /* BO */, "Bolivia" }, 113 { 0x4252 /* BR */, "Brazil" }, 114 { 0x4253 /* BS */, "Bahamas" }, 115 { 0x4254 /* BT */, "Bhutan" }, 116 { 0x4256 /* BV */, "Bouvet Island" }, 117 { 0x4257 /* BW */, "Botswana" }, 118 { 0x4259 /* BY */, "Belarus" }, 119 { 0x425A /* BZ */, "Belize" }, 120 { 0x4341 /* CA */, "Canada" }, 121 { 0x4343 /* CC */, "Cocos (Keeling) Islands" }, 122 { 0x4344 /* CD */, "Congo" }, 123 { 0x4346 /* CF */, "Central African Republic" }, 124 { 0x4347 /* CG */, "Congo" }, 125 { 0x4348 /* CH */, "Switzerland" }, 126 { 0x4349 /* CI */, "Cote d'Ivoire" }, 127 { 0x434B /* CK */, "Cook Islands" }, 128 { 0x434C /* CL */, "Chile" }, 129 { 0x434D /* CM */, "Cameroon" }, 130 { 0x434E /* CN */, "China" }, 131 { 0x434F /* CO */, "Colombia" }, 132 { 0x4352 /* CR */, "Costa Rica" }, 133 { 0x4355 /* CU */, "Cuba" }, 134 { 0x4356 /* CV */, "Cape Verde" }, 135 { 0x4358 /* CX */, "Christmas Island" }, 136 { 0x4359 /* CY */, "Cyprus" }, 137 { 0x435A /* CZ */, "Czech Republic" }, 138 { 0x4445 /* DE */, "Germany" }, 139 { 0x444A /* DJ */, "Djibouti" }, 140 { 0x444B /* DK */, "Denmark" }, 141 { 0x444D /* DM */, "Dominica" }, 142 { 0x444F /* DO */, "Dominican Republic" }, 143 { 0x445A /* DZ */, "Algeria" }, 144 { 0x4543 /* EC */, "Ecuador" }, 145 { 0x4545 /* EE */, "Estonia" }, 146 { 0x4547 /* EG */, "Egypt" }, 147 { 0x4548 /* EH */, "Western Sahara" }, 148 { 0x4552 /* ER */, "Eritrea" }, 149 { 0x4553 /* ES */, "Spain" }, 150 { 0x4554 /* ET */, "Ethiopia" }, 151 { 0x4649 /* FI */, "Finland" }, 152 { 0x464A /* FJ */, "Fiji" }, 153 { 0x464B /* FK */, "Falkland Islands" }, 154 { 0x464D /* FM */, "Micronesia" }, 155 { 0x464F /* FO */, "Faroe Islands" }, 156 { 0x4652 /* FR */, "France" }, 157 { 0x4741 /* GA */, "Gabon" }, 158 { 0x4742 /* GB */, "United Kingdom" }, 159 { 0x4744 /* GD */, "Grenada" }, 160 { 0x4745 /* GE */, "Georgia" }, 161 { 0x4746 /* GF */, "French Guiana" }, 162 { 0x4747 /* GG */, "Guernsey" }, 163 { 0x4748 /* GH */, "Ghana" }, 164 { 0x4749 /* GI */, "Gibraltar" }, 165 { 0x474C /* GL */, "Greenland" }, 166 { 0x474D /* GM */, "Gambia" }, 167 { 0x474E /* GN */, "Guinea" }, 168 { 0x4750 /* GP */, "Guadeloupe" }, 169 { 0x4751 /* GQ */, "Equatorial Guinea" }, 170 { 0x4752 /* GR */, "Greece" }, 171 { 0x4753 /* GS */, "South Georgia" }, 172 { 0x4754 /* GT */, "Guatemala" }, 173 { 0x4755 /* GU */, "Guam" }, 174 { 0x4757 /* GW */, "Guinea-Bissau" }, 175 { 0x4759 /* GY */, "Guyana" }, 176 { 0x484B /* HK */, "Hong Kong" }, 177 { 0x484D /* HM */, "Heard and McDonald Islands" }, 178 { 0x484E /* HN */, "Honduras" }, 179 { 0x4852 /* HR */, "Croatia" }, 180 { 0x4854 /* HT */, "Haiti" }, 181 { 0x4855 /* HU */, "Hungary" }, 182 { 0x4944 /* ID */, "Indonesia" }, 183 { 0x4945 /* IE */, "Ireland" }, 184 { 0x494C /* IL */, "Israel" }, 185 { 0x494D /* IM */, "Isle of Man" }, 186 { 0x494E /* IN */, "India" }, 187 { 0x494F /* IO */, "Chagos Islands" }, 188 { 0x4951 /* IQ */, "Iraq" }, 189 { 0x4952 /* IR */, "Iran" }, 190 { 0x4953 /* IS */, "Iceland" }, 191 { 0x4954 /* IT */, "Italy" }, 192 { 0x4A45 /* JE */, "Jersey" }, 193 { 0x4A4D /* JM */, "Jamaica" }, 194 { 0x4A4F /* JO */, "Jordan" }, 195 { 0x4A50 /* JP */, "Japan" }, 196 { 0x4B45 /* KE */, "Kenya" }, 197 { 0x4B47 /* KG */, "Kyrgyzstan" }, 198 { 0x4B48 /* KH */, "Cambodia" }, 199 { 0x4B49 /* KI */, "Kiribati" }, 200 { 0x4B4D /* KM */, "Comoros" }, 201 { 0x4B4E /* KN */, "Saint Kitts and Nevis" }, 202 { 0x4B50 /* KP */, "North Korea" }, 203 { 0x4B52 /* KR */, "South Korea" }, 204 { 0x4B57 /* KW */, "Kuwait" }, 205 { 0x4B59 /* KY */, "Cayman Islands" }, 206 { 0x4B5A /* KZ */, "Kazakhstan" }, 207 { 0x4C41 /* LA */, "Laos" }, 208 { 0x4C42 /* LB */, "Lebanon" }, 209 { 0x4C43 /* LC */, "Saint Lucia" }, 210 { 0x4C49 /* LI */, "Liechtenstein" }, 211 { 0x4C4B /* LK */, "Sri Lanka" }, 212 { 0x4C52 /* LR */, "Liberia" }, 213 { 0x4C53 /* LS */, "Lesotho" }, 214 { 0x4C54 /* LT */, "Lithuania" }, 215 { 0x4C55 /* LU */, "Luxembourg" }, 216 { 0x4C56 /* LV */, "Latvia" }, 217 { 0x4C59 /* LY */, "Libyan Arab Jamahiriya" }, 218 { 0x4D41 /* MA */, "Morocco" }, 219 { 0x4D43 /* MC */, "Monaco" }, 220 { 0x4D44 /* MD */, "Moldova" }, 221 { 0x4D45 /* ME */, "Montenegro" }, 222 { 0x4D46 /* MF */, "Saint Martin (French part)" }, 223 { 0x4D47 /* MG */, "Madagascar" }, 224 { 0x4D48 /* MH */, "Marshall Islands" }, 225 { 0x4D4B /* MK */, "Macedonia" }, 226 { 0x4D4C /* ML */, "Mali" }, 227 { 0x4D4D /* MM */, "Myanmar" }, 228 { 0x4D4E /* MN */, "Mongolia" }, 229 { 0x4D4F /* MO */, "Macao" }, 230 { 0x4D50 /* MP */, "Northern Mariana Islands" }, 231 { 0x4D51 /* MQ */, "Martinique" }, 232 { 0x4D52 /* MR */, "Mauritania" }, 233 { 0x4D53 /* MS */, "Montserrat" }, 234 { 0x4D54 /* MT */, "Malta" }, 235 { 0x4D55 /* MU */, "Mauritius" }, 236 { 0x4D56 /* MV */, "Maldives" }, 237 { 0x4D57 /* MW */, "Malawi" }, 238 { 0x4D58 /* MX */, "Mexico" }, 239 { 0x4D59 /* MY */, "Malaysia" }, 240 { 0x4D5A /* MZ */, "Mozambique" }, 241 { 0x4E41 /* NA */, "Namibia" }, 242 { 0x4E43 /* NC */, "New Caledonia" }, 243 { 0x4E45 /* NE */, "Niger" }, 244 { 0x4E46 /* NF */, "Norfolk Island" }, 245 { 0x4E47 /* NG */, "Nigeria" }, 246 { 0x4E49 /* NI */, "Nicaragua" }, 247 { 0x4E4C /* NL */, "Netherlands" }, 248 { 0x4E4F /* NO */, "Norway" }, 249 { 0x4E50 /* NP */, "Nepal" }, 250 { 0x4E52 /* NR */, "Nauru" }, 251 { 0x4E55 /* NU */, "Niue" }, 252 { 0x4E5A /* NZ */, "New Zealand" }, 253 { 0x4F4D /* OM */, "Oman" }, 254 { 0x5041 /* PA */, "Panama" }, 255 { 0x5045 /* PE */, "Peru" }, 256 { 0x5046 /* PF */, "French Polynesia" }, 257 { 0x5047 /* PG */, "Papua New Guinea" }, 258 { 0x5048 /* PH */, "Philippines" }, 259 { 0x504B /* PK */, "Pakistan" }, 260 { 0x504C /* PL */, "Poland" }, 261 { 0x504D /* PM */, "Saint Pierre and Miquelon" }, 262 { 0x504E /* PN */, "Pitcairn" }, 263 { 0x5052 /* PR */, "Puerto Rico" }, 264 { 0x5053 /* PS */, "Palestinian Territory" }, 265 { 0x5054 /* PT */, "Portugal" }, 266 { 0x5057 /* PW */, "Palau" }, 267 { 0x5059 /* PY */, "Paraguay" }, 268 { 0x5141 /* QA */, "Qatar" }, 269 { 0x5245 /* RE */, "Reunion" }, 270 { 0x524F /* RO */, "Romania" }, 271 { 0x5253 /* RS */, "Serbia" }, 272 { 0x5255 /* RU */, "Russian Federation" }, 273 { 0x5257 /* RW */, "Rwanda" }, 274 { 0x5341 /* SA */, "Saudi Arabia" }, 275 { 0x5342 /* SB */, "Solomon Islands" }, 276 { 0x5343 /* SC */, "Seychelles" }, 277 { 0x5344 /* SD */, "Sudan" }, 278 { 0x5345 /* SE */, "Sweden" }, 279 { 0x5347 /* SG */, "Singapore" }, 280 { 0x5348 /* SH */, "St. Helena and Dependencies" }, 281 { 0x5349 /* SI */, "Slovenia" }, 282 { 0x534A /* SJ */, "Svalbard and Jan Mayen" }, 283 { 0x534B /* SK */, "Slovakia" }, 284 { 0x534C /* SL */, "Sierra Leone" }, 285 { 0x534D /* SM */, "San Marino" }, 286 { 0x534E /* SN */, "Senegal" }, 287 { 0x534F /* SO */, "Somalia" }, 288 { 0x5352 /* SR */, "Suriname" }, 289 { 0x5354 /* ST */, "Sao Tome and Principe" }, 290 { 0x5356 /* SV */, "El Salvador" }, 291 { 0x5359 /* SY */, "Syrian Arab Republic" }, 292 { 0x535A /* SZ */, "Swaziland" }, 293 { 0x5443 /* TC */, "Turks and Caicos Islands" }, 294 { 0x5444 /* TD */, "Chad" }, 295 { 0x5446 /* TF */, "French Southern Territories" }, 296 { 0x5447 /* TG */, "Togo" }, 297 { 0x5448 /* TH */, "Thailand" }, 298 { 0x544A /* TJ */, "Tajikistan" }, 299 { 0x544B /* TK */, "Tokelau" }, 300 { 0x544C /* TL */, "Timor-Leste" }, 301 { 0x544D /* TM */, "Turkmenistan" }, 302 { 0x544E /* TN */, "Tunisia" }, 303 { 0x544F /* TO */, "Tonga" }, 304 { 0x5452 /* TR */, "Turkey" }, 305 { 0x5454 /* TT */, "Trinidad and Tobago" }, 306 { 0x5456 /* TV */, "Tuvalu" }, 307 { 0x5457 /* TW */, "Taiwan" }, 308 { 0x545A /* TZ */, "Tanzania" }, 309 { 0x5541 /* UA */, "Ukraine" }, 310 { 0x5547 /* UG */, "Uganda" }, 311 { 0x554D /* UM */, "U.S. Minor Outlying Islands" }, 312 { 0x5553 /* US */, "United States" }, 313 { 0x5559 /* UY */, "Uruguay" }, 314 { 0x555A /* UZ */, "Uzbekistan" }, 315 { 0x5641 /* VA */, "Vatican City State" }, 316 { 0x5643 /* VC */, "St. Vincent and Grenadines" }, 317 { 0x5645 /* VE */, "Venezuela" }, 318 { 0x5647 /* VG */, "Virgin Islands, British" }, 319 { 0x5649 /* VI */, "Virgin Islands, U.S." }, 320 { 0x564E /* VN */, "Viet Nam" }, 321 { 0x5655 /* VU */, "Vanuatu" }, 322 { 0x5746 /* WF */, "Wallis and Futuna" }, 323 { 0x5753 /* WS */, "Samoa" }, 324 { 0x5945 /* YE */, "Yemen" }, 325 { 0x5954 /* YT */, "Mayotte" }, 326 { 0x5A41 /* ZA */, "South Africa" }, 327 { 0x5A4D /* ZM */, "Zambia" }, 328 { 0x5A57 /* ZW */, "Zimbabwe" }, 329 { 0, "" } 330 }; 331 332 static const struct iwinfo_ops *backends[] = { 333 #ifdef USE_NL80211 334 &nl80211_ops, 335 #endif 336 #ifdef USE_MADWIFI 337 &madwifi_ops, 338 #endif 339 #ifdef USE_WL 340 &wl_ops, 341 #endif 342 &wext_ops, 343 }; 344 345 const char * iwinfo_type(const char *ifname) 346 { 347 const struct iwinfo_ops *ops = iwinfo_backend(ifname); 348 if (!ops) 349 return NULL; 350 351 return ops->name; 352 } 353 354 const struct iwinfo_ops * iwinfo_backend(const char *ifname) 355 { 356 int i; 357 358 for (i = 0; i < ARRAY_SIZE(backends); i++) 359 if (backends[i]->probe(ifname)) 360 return backends[i]; 361 362 return NULL; 363 } 364 365 const struct iwinfo_ops * iwinfo_backend_by_name(const char *name) 366 { 367 int i; 368 369 for (i = 0; i < ARRAY_SIZE(backends); i++) 370 if (!strcmp(backends[i]->name, name)) 371 return backends[i]; 372 373 return NULL; 374 } 375 376 void iwinfo_finish(void) 377 { 378 int i; 379 380 for (i = 0; i < ARRAY_SIZE(backends); i++) 381 backends[i]->close(); 382 383 iwinfo_close(); 384 } 385
This page was automatically generated by LXR 0.3.1. • OpenWrt