2 * iwinfo - Wireless Information Library - Lua Bindings
4 * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
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.
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.
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/.
19 #include "iwinfo/lua.h"
23 static int iwinfo_L_type(lua_State
*L
)
25 const char *ifname
= luaL_checkstring(L
, 1);
26 const char *type
= iwinfo_type(ifname
);
29 lua_pushstring(L
, type
);
36 /* Shutdown backends */
37 static int iwinfo_L__gc(lua_State
*L
)
44 * Build a short textual description of the crypto info
47 static char * iwinfo_crypto_print_ciphers(int ciphers
)
49 static char str
[128] = { 0 };
52 if (ciphers
& IWINFO_CIPHER_WEP40
)
53 pos
+= sprintf(pos
, "WEP-40, ");
55 if (ciphers
& IWINFO_CIPHER_WEP104
)
56 pos
+= sprintf(pos
, "WEP-104, ");
58 if (ciphers
& IWINFO_CIPHER_TKIP
)
59 pos
+= sprintf(pos
, "TKIP, ");
61 if (ciphers
& IWINFO_CIPHER_CCMP
)
62 pos
+= sprintf(pos
, "CCMP, ");
64 if (ciphers
& IWINFO_CIPHER_WRAP
)
65 pos
+= sprintf(pos
, "WRAP, ");
67 if (ciphers
& IWINFO_CIPHER_AESOCB
)
68 pos
+= sprintf(pos
, "AES-OCB, ");
70 if (ciphers
& IWINFO_CIPHER_CKIP
)
71 pos
+= sprintf(pos
, "CKIP, ");
73 if (!ciphers
|| (ciphers
& IWINFO_CIPHER_NONE
))
74 pos
+= sprintf(pos
, "NONE, ");
81 static char * iwinfo_crypto_print_suites(int suites
)
83 static char str
[64] = { 0 };
86 if (suites
& IWINFO_KMGMT_PSK
)
87 pos
+= sprintf(pos
, "PSK/");
89 if (suites
& IWINFO_KMGMT_8021x
)
90 pos
+= sprintf(pos
, "802.1X/");
92 if (!suites
|| (suites
& IWINFO_KMGMT_NONE
))
93 pos
+= sprintf(pos
, "NONE/");
100 static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry
*c
)
102 static char desc
[512] = { 0 };
109 if (c
->auth_algs
&& !c
->wpa_version
)
111 if ((c
->auth_algs
& IWINFO_AUTH_OPEN
) &&
112 (c
->auth_algs
& IWINFO_AUTH_SHARED
))
114 sprintf(desc
, "WEP Open/Shared (%s)",
115 iwinfo_crypto_print_ciphers(c
->pair_ciphers
));
117 else if (c
->auth_algs
& IWINFO_AUTH_OPEN
)
119 sprintf(desc
, "WEP Open System (%s)",
120 iwinfo_crypto_print_ciphers(c
->pair_ciphers
));
122 else if (c
->auth_algs
& IWINFO_AUTH_SHARED
)
124 sprintf(desc
, "WEP Shared Auth (%s)",
125 iwinfo_crypto_print_ciphers(c
->pair_ciphers
));
130 else if (c
->wpa_version
)
132 switch (c
->wpa_version
) {
134 sprintf(desc
, "mixed WPA/WPA2 %s (%s)",
135 iwinfo_crypto_print_suites(c
->auth_suites
),
136 iwinfo_crypto_print_ciphers(
137 c
->pair_ciphers
& c
->group_ciphers
));
141 sprintf(desc
, "WPA2 %s (%s)",
142 iwinfo_crypto_print_suites(c
->auth_suites
),
143 iwinfo_crypto_print_ciphers(
144 c
->pair_ciphers
& c
->group_ciphers
));
148 sprintf(desc
, "WPA %s (%s)",
149 iwinfo_crypto_print_suites(c
->auth_suites
),
150 iwinfo_crypto_print_ciphers(
151 c
->pair_ciphers
& c
->group_ciphers
));
157 sprintf(desc
, "None");
162 sprintf(desc
, "None");
167 sprintf(desc
, "Unknown");
173 /* Build Lua table from crypto data */
174 static void iwinfo_L_cryptotable(lua_State
*L
, struct iwinfo_crypto_entry
*c
)
180 lua_pushboolean(L
, c
->enabled
);
181 lua_setfield(L
, -2, "enabled");
183 lua_pushstring(L
, iwinfo_crypto_desc(c
));
184 lua_setfield(L
, -2, "description");
186 lua_pushboolean(L
, (c
->enabled
&& !c
->wpa_version
));
187 lua_setfield(L
, -2, "wep");
189 lua_pushinteger(L
, c
->wpa_version
);
190 lua_setfield(L
, -2, "wpa");
193 for (i
= 0, j
= 1; i
< 8; i
++)
195 if (c
->pair_ciphers
& (1 << i
))
197 lua_pushstring(L
, IWINFO_CIPHER_NAMES
[i
]);
198 lua_rawseti(L
, -2, j
++);
201 lua_setfield(L
, -2, "pair_ciphers");
204 for (i
= 0, j
= 1; i
< 8; i
++)
206 if (c
->group_ciphers
& (1 << i
))
208 lua_pushstring(L
, IWINFO_CIPHER_NAMES
[i
]);
209 lua_rawseti(L
, -2, j
++);
212 lua_setfield(L
, -2, "group_ciphers");
215 for (i
= 0, j
= 1; i
< 8; i
++)
217 if (c
->auth_suites
& (1 << i
))
219 lua_pushstring(L
, IWINFO_KMGMT_NAMES
[i
]);
220 lua_rawseti(L
, -2, j
++);
223 lua_setfield(L
, -2, "auth_suites");
226 for (i
= 0, j
= 1; i
< 8; i
++)
228 if (c
->auth_algs
& (1 << i
))
230 lua_pushstring(L
, IWINFO_AUTH_NAMES
[i
]);
231 lua_rawseti(L
, -2, j
++);
234 lua_setfield(L
, -2, "auth_algs");
238 /* Wrapper for mode */
239 static int iwinfo_L_mode(lua_State
*L
, int (*func
)(const char *, int *))
242 const char *ifname
= luaL_checkstring(L
, 1);
244 if ((*func
)(ifname
, &mode
))
245 mode
= IWINFO_OPMODE_UNKNOWN
;
247 lua_pushstring(L
, IWINFO_OPMODE_NAMES
[mode
]);
251 /* Wrapper for assoclist */
252 static int iwinfo_L_assoclist(lua_State
*L
, int (*func
)(const char *, char *, int *))
255 char rv
[IWINFO_BUFSIZE
];
257 const char *ifname
= luaL_checkstring(L
, 1);
258 struct iwinfo_assoclist_entry
*e
;
261 memset(rv
, 0, sizeof(rv
));
263 if (!(*func
)(ifname
, rv
, &len
))
265 for (i
= 0; i
< len
; i
+= sizeof(struct iwinfo_assoclist_entry
))
267 e
= (struct iwinfo_assoclist_entry
*) &rv
[i
];
269 sprintf(macstr
, "%02X:%02X:%02X:%02X:%02X:%02X",
270 e
->mac
[0], e
->mac
[1], e
->mac
[2],
271 e
->mac
[3], e
->mac
[4], e
->mac
[5]);
275 lua_pushnumber(L
, e
->signal
);
276 lua_setfield(L
, -2, "signal");
278 lua_pushnumber(L
, e
->noise
);
279 lua_setfield(L
, -2, "noise");
281 lua_pushnumber(L
, e
->inactive
);
282 lua_setfield(L
, -2, "inactive");
284 lua_pushnumber(L
, e
->rx_packets
);
285 lua_setfield(L
, -2, "rx_packets");
287 lua_pushnumber(L
, e
->tx_packets
);
288 lua_setfield(L
, -2, "tx_packets");
290 lua_pushnumber(L
, e
->rx_rate
.rate
);
291 lua_setfield(L
, -2, "rx_rate");
293 lua_pushnumber(L
, e
->tx_rate
.rate
);
294 lua_setfield(L
, -2, "tx_rate");
296 if (e
->rx_rate
.mcs
>= 0)
298 lua_pushnumber(L
, e
->rx_rate
.mcs
);
299 lua_setfield(L
, -2, "rx_mcs");
301 lua_pushboolean(L
, e
->rx_rate
.is_40mhz
);
302 lua_setfield(L
, -2, "rx_40mhz");
304 lua_pushboolean(L
, e
->rx_rate
.is_short_gi
);
305 lua_setfield(L
, -2, "rx_short_gi");
308 if (e
->tx_rate
.mcs
>= 0)
310 lua_pushnumber(L
, e
->tx_rate
.mcs
);
311 lua_setfield(L
, -2, "tx_mcs");
313 lua_pushboolean(L
, e
->tx_rate
.is_40mhz
);
314 lua_setfield(L
, -2, "tx_40mhz");
316 lua_pushboolean(L
, e
->tx_rate
.is_short_gi
);
317 lua_setfield(L
, -2, "tx_short_gi");
320 lua_setfield(L
, -2, macstr
);
327 /* Wrapper for tx power list */
328 static int iwinfo_L_txpwrlist(lua_State
*L
, int (*func
)(const char *, char *, int *))
331 char rv
[IWINFO_BUFSIZE
];
332 const char *ifname
= luaL_checkstring(L
, 1);
333 struct iwinfo_txpwrlist_entry
*e
;
336 memset(rv
, 0, sizeof(rv
));
338 if (!(*func
)(ifname
, rv
, &len
))
340 for (i
= 0, x
= 1; i
< len
; i
+= sizeof(struct iwinfo_txpwrlist_entry
), x
++)
342 e
= (struct iwinfo_txpwrlist_entry
*) &rv
[i
];
346 lua_pushnumber(L
, e
->mw
);
347 lua_setfield(L
, -2, "mw");
349 lua_pushnumber(L
, e
->dbm
);
350 lua_setfield(L
, -2, "dbm");
352 lua_rawseti(L
, -2, x
);
359 /* Wrapper for scan list */
360 static int iwinfo_L_scanlist(lua_State
*L
, int (*func
)(const char *, char *, int *))
363 char rv
[IWINFO_BUFSIZE
];
365 const char *ifname
= luaL_checkstring(L
, 1);
366 struct iwinfo_scanlist_entry
*e
;
369 memset(rv
, 0, sizeof(rv
));
371 if (!(*func
)(ifname
, rv
, &len
))
373 for (i
= 0, x
= 1; i
< len
; i
+= sizeof(struct iwinfo_scanlist_entry
), x
++)
375 e
= (struct iwinfo_scanlist_entry
*) &rv
[i
];
380 sprintf(macstr
, "%02X:%02X:%02X:%02X:%02X:%02X",
381 e
->mac
[0], e
->mac
[1], e
->mac
[2],
382 e
->mac
[3], e
->mac
[4], e
->mac
[5]);
384 lua_pushstring(L
, macstr
);
385 lua_setfield(L
, -2, "bssid");
390 lua_pushstring(L
, (char *) e
->ssid
);
391 lua_setfield(L
, -2, "ssid");
395 lua_pushinteger(L
, e
->channel
);
396 lua_setfield(L
, -2, "channel");
399 lua_pushstring(L
, IWINFO_OPMODE_NAMES
[e
->mode
]);
400 lua_setfield(L
, -2, "mode");
402 /* Quality, Signal */
403 lua_pushinteger(L
, e
->quality
);
404 lua_setfield(L
, -2, "quality");
406 lua_pushinteger(L
, e
->quality_max
);
407 lua_setfield(L
, -2, "quality_max");
409 lua_pushnumber(L
, (e
->signal
- 0x100));
410 lua_setfield(L
, -2, "signal");
413 iwinfo_L_cryptotable(L
, &e
->crypto
);
414 lua_setfield(L
, -2, "encryption");
416 lua_rawseti(L
, -2, x
);
423 /* Wrapper for frequency list */
424 static int iwinfo_L_freqlist(lua_State
*L
, int (*func
)(const char *, char *, int *))
427 char rv
[IWINFO_BUFSIZE
];
428 const char *ifname
= luaL_checkstring(L
, 1);
429 struct iwinfo_freqlist_entry
*e
;
432 memset(rv
, 0, sizeof(rv
));
434 if (!(*func
)(ifname
, rv
, &len
))
436 for (i
= 0, x
= 1; i
< len
; i
+= sizeof(struct iwinfo_freqlist_entry
), x
++)
438 e
= (struct iwinfo_freqlist_entry
*) &rv
[i
];
443 lua_pushinteger(L
, e
->mhz
);
444 lua_setfield(L
, -2, "mhz");
447 lua_pushinteger(L
, e
->channel
);
448 lua_setfield(L
, -2, "channel");
450 /* Restricted (DFS/TPC/Radar) */
451 lua_pushboolean(L
, e
->restricted
);
452 lua_setfield(L
, -2, "restricted");
454 lua_rawseti(L
, -2, x
);
461 /* Wrapper for crypto settings */
462 static int iwinfo_L_encryption(lua_State
*L
, int (*func
)(const char *, char *))
464 const char *ifname
= luaL_checkstring(L
, 1);
465 struct iwinfo_crypto_entry c
= { 0 };
467 if (!(*func
)(ifname
, (char *)&c
))
469 iwinfo_L_cryptotable(L
, &c
);
477 /* Wrapper for hwmode list */
478 static int iwinfo_L_hwmodelist(lua_State
*L
, int (*func
)(const char *, int *))
480 const char *ifname
= luaL_checkstring(L
, 1);
483 if (!(*func
)(ifname
, &hwmodes
))
487 lua_pushboolean(L
, hwmodes
& IWINFO_80211_A
);
488 lua_setfield(L
, -2, "a");
490 lua_pushboolean(L
, hwmodes
& IWINFO_80211_B
);
491 lua_setfield(L
, -2, "b");
493 lua_pushboolean(L
, hwmodes
& IWINFO_80211_G
);
494 lua_setfield(L
, -2, "g");
496 lua_pushboolean(L
, hwmodes
& IWINFO_80211_N
);
497 lua_setfield(L
, -2, "n");
506 /* Wrapper for mbssid_support */
507 static int iwinfo_L_mbssid_support(lua_State
*L
, int (*func
)(const char *, int *))
509 const char *ifname
= luaL_checkstring(L
, 1);
512 if (!(*func
)(ifname
, &support
))
514 lua_pushboolean(L
, support
);
522 /* Wrapper for hardware_id */
523 static int iwinfo_L_hardware_id(lua_State
*L
, int (*func
)(const char *, char *))
525 const char *ifname
= luaL_checkstring(L
, 1);
526 struct iwinfo_hardware_id ids
;
528 if (!(*func
)(ifname
, (char *)&ids
))
532 lua_pushnumber(L
, ids
.vendor_id
);
533 lua_setfield(L
, -2, "vendor_id");
535 lua_pushnumber(L
, ids
.device_id
);
536 lua_setfield(L
, -2, "device_id");
538 lua_pushnumber(L
, ids
.subsystem_vendor_id
);
539 lua_setfield(L
, -2, "subsystem_vendor_id");
541 lua_pushnumber(L
, ids
.subsystem_device_id
);
542 lua_setfield(L
, -2, "subsystem_device_id");
552 /* Wrapper for country list */
553 static char * iwinfo_L_country_lookup(char *buf
, int len
, int iso3166
)
556 struct iwinfo_country_entry
*c
;
558 for (i
= 0; i
< len
; i
+= sizeof(struct iwinfo_country_entry
))
560 c
= (struct iwinfo_country_entry
*) &buf
[i
];
562 if (c
->iso3166
== iso3166
)
569 static int iwinfo_L_countrylist(lua_State
*L
, int (*func
)(const char *, char *, int *))
572 char rv
[IWINFO_BUFSIZE
], alpha2
[3];
574 const char *ifname
= luaL_checkstring(L
, 1);
575 const struct iwinfo_iso3166_label
*l
;
578 memset(rv
, 0, sizeof(rv
));
580 if (!(*func
)(ifname
, rv
, &len
))
582 for (l
= IWINFO_ISO3166_NAMES
, j
= 1; l
->iso3166
; l
++)
584 if ((ccode
= iwinfo_L_country_lookup(rv
, len
, l
->iso3166
)) != NULL
)
586 sprintf(alpha2
, "%c%c",
587 (l
->iso3166
/ 256), (l
->iso3166
% 256));
591 lua_pushstring(L
, alpha2
);
592 lua_setfield(L
, -2, "alpha2");
594 lua_pushstring(L
, ccode
);
595 lua_setfield(L
, -2, "ccode");
597 lua_pushstring(L
, l
->name
);
598 lua_setfield(L
, -2, "name");
600 lua_rawseti(L
, -2, j
++);
611 LUA_WRAP_INT(wl
,channel
)
612 LUA_WRAP_INT(wl
,frequency
)
613 LUA_WRAP_INT(wl
,frequency_offset
)
614 LUA_WRAP_INT(wl
,txpower
)
615 LUA_WRAP_INT(wl
,txpower_offset
)
616 LUA_WRAP_INT(wl
,bitrate
)
617 LUA_WRAP_INT(wl
,signal
)
618 LUA_WRAP_INT(wl
,noise
)
619 LUA_WRAP_INT(wl
,quality
)
620 LUA_WRAP_INT(wl
,quality_max
)
621 LUA_WRAP_STRING(wl
,ssid
)
622 LUA_WRAP_STRING(wl
,bssid
)
623 LUA_WRAP_STRING(wl
,country
)
624 LUA_WRAP_STRING(wl
,hardware_name
)
625 LUA_WRAP_STRUCT(wl
,mode
)
626 LUA_WRAP_STRUCT(wl
,assoclist
)
627 LUA_WRAP_STRUCT(wl
,txpwrlist
)
628 LUA_WRAP_STRUCT(wl
,scanlist
)
629 LUA_WRAP_STRUCT(wl
,freqlist
)
630 LUA_WRAP_STRUCT(wl
,countrylist
)
631 LUA_WRAP_STRUCT(wl
,hwmodelist
)
632 LUA_WRAP_STRUCT(wl
,encryption
)
633 LUA_WRAP_STRUCT(wl
,mbssid_support
)
634 LUA_WRAP_STRUCT(wl
,hardware_id
)
639 LUA_WRAP_INT(madwifi
,channel
)
640 LUA_WRAP_INT(madwifi
,frequency
)
641 LUA_WRAP_INT(madwifi
,frequency_offset
)
642 LUA_WRAP_INT(madwifi
,txpower
)
643 LUA_WRAP_INT(madwifi
,txpower_offset
)
644 LUA_WRAP_INT(madwifi
,bitrate
)
645 LUA_WRAP_INT(madwifi
,signal
)
646 LUA_WRAP_INT(madwifi
,noise
)
647 LUA_WRAP_INT(madwifi
,quality
)
648 LUA_WRAP_INT(madwifi
,quality_max
)
649 LUA_WRAP_STRING(madwifi
,ssid
)
650 LUA_WRAP_STRING(madwifi
,bssid
)
651 LUA_WRAP_STRING(madwifi
,country
)
652 LUA_WRAP_STRING(madwifi
,hardware_name
)
653 LUA_WRAP_STRUCT(madwifi
,mode
)
654 LUA_WRAP_STRUCT(madwifi
,assoclist
)
655 LUA_WRAP_STRUCT(madwifi
,txpwrlist
)
656 LUA_WRAP_STRUCT(madwifi
,scanlist
)
657 LUA_WRAP_STRUCT(madwifi
,freqlist
)
658 LUA_WRAP_STRUCT(madwifi
,countrylist
)
659 LUA_WRAP_STRUCT(madwifi
,hwmodelist
)
660 LUA_WRAP_STRUCT(madwifi
,encryption
)
661 LUA_WRAP_STRUCT(madwifi
,mbssid_support
)
662 LUA_WRAP_STRUCT(madwifi
,hardware_id
)
667 LUA_WRAP_INT(nl80211
,channel
)
668 LUA_WRAP_INT(nl80211
,frequency
)
669 LUA_WRAP_INT(nl80211
,frequency_offset
)
670 LUA_WRAP_INT(nl80211
,txpower
)
671 LUA_WRAP_INT(nl80211
,txpower_offset
)
672 LUA_WRAP_INT(nl80211
,bitrate
)
673 LUA_WRAP_INT(nl80211
,signal
)
674 LUA_WRAP_INT(nl80211
,noise
)
675 LUA_WRAP_INT(nl80211
,quality
)
676 LUA_WRAP_INT(nl80211
,quality_max
)
677 LUA_WRAP_STRING(nl80211
,ssid
)
678 LUA_WRAP_STRING(nl80211
,bssid
)
679 LUA_WRAP_STRING(nl80211
,country
)
680 LUA_WRAP_STRING(nl80211
,hardware_name
)
681 LUA_WRAP_STRUCT(nl80211
,mode
)
682 LUA_WRAP_STRUCT(nl80211
,assoclist
)
683 LUA_WRAP_STRUCT(nl80211
,txpwrlist
)
684 LUA_WRAP_STRUCT(nl80211
,scanlist
)
685 LUA_WRAP_STRUCT(nl80211
,freqlist
)
686 LUA_WRAP_STRUCT(nl80211
,countrylist
)
687 LUA_WRAP_STRUCT(nl80211
,hwmodelist
)
688 LUA_WRAP_STRUCT(nl80211
,encryption
)
689 LUA_WRAP_STRUCT(nl80211
,mbssid_support
)
690 LUA_WRAP_STRUCT(nl80211
,hardware_id
)
694 LUA_WRAP_INT(wext
,channel
)
695 LUA_WRAP_INT(wext
,frequency
)
696 LUA_WRAP_INT(wext
,frequency_offset
)
697 LUA_WRAP_INT(wext
,txpower
)
698 LUA_WRAP_INT(wext
,txpower_offset
)
699 LUA_WRAP_INT(wext
,bitrate
)
700 LUA_WRAP_INT(wext
,signal
)
701 LUA_WRAP_INT(wext
,noise
)
702 LUA_WRAP_INT(wext
,quality
)
703 LUA_WRAP_INT(wext
,quality_max
)
704 LUA_WRAP_STRING(wext
,ssid
)
705 LUA_WRAP_STRING(wext
,bssid
)
706 LUA_WRAP_STRING(wext
,country
)
707 LUA_WRAP_STRING(wext
,hardware_name
)
708 LUA_WRAP_STRUCT(wext
,mode
)
709 LUA_WRAP_STRUCT(wext
,assoclist
)
710 LUA_WRAP_STRUCT(wext
,txpwrlist
)
711 LUA_WRAP_STRUCT(wext
,scanlist
)
712 LUA_WRAP_STRUCT(wext
,freqlist
)
713 LUA_WRAP_STRUCT(wext
,countrylist
)
714 LUA_WRAP_STRUCT(wext
,hwmodelist
)
715 LUA_WRAP_STRUCT(wext
,encryption
)
716 LUA_WRAP_STRUCT(wext
,mbssid_support
)
717 LUA_WRAP_STRUCT(wext
,hardware_id
)
721 static const luaL_reg R_wl
[] = {
723 LUA_REG(wl
,frequency
),
724 LUA_REG(wl
,frequency_offset
),
726 LUA_REG(wl
,txpower_offset
),
731 LUA_REG(wl
,quality_max
),
736 LUA_REG(wl
,assoclist
),
737 LUA_REG(wl
,txpwrlist
),
738 LUA_REG(wl
,scanlist
),
739 LUA_REG(wl
,freqlist
),
740 LUA_REG(wl
,countrylist
),
741 LUA_REG(wl
,hwmodelist
),
742 LUA_REG(wl
,encryption
),
743 LUA_REG(wl
,mbssid_support
),
744 LUA_REG(wl
,hardware_id
),
745 LUA_REG(wl
,hardware_name
),
752 static const luaL_reg R_madwifi
[] = {
753 LUA_REG(madwifi
,channel
),
754 LUA_REG(madwifi
,frequency
),
755 LUA_REG(madwifi
,frequency_offset
),
756 LUA_REG(madwifi
,txpower
),
757 LUA_REG(madwifi
,txpower_offset
),
758 LUA_REG(madwifi
,bitrate
),
759 LUA_REG(madwifi
,signal
),
760 LUA_REG(madwifi
,noise
),
761 LUA_REG(madwifi
,quality
),
762 LUA_REG(madwifi
,quality_max
),
763 LUA_REG(madwifi
,mode
),
764 LUA_REG(madwifi
,ssid
),
765 LUA_REG(madwifi
,bssid
),
766 LUA_REG(madwifi
,country
),
767 LUA_REG(madwifi
,assoclist
),
768 LUA_REG(madwifi
,txpwrlist
),
769 LUA_REG(madwifi
,scanlist
),
770 LUA_REG(madwifi
,freqlist
),
771 LUA_REG(madwifi
,countrylist
),
772 LUA_REG(madwifi
,hwmodelist
),
773 LUA_REG(madwifi
,encryption
),
774 LUA_REG(madwifi
,mbssid_support
),
775 LUA_REG(madwifi
,hardware_id
),
776 LUA_REG(madwifi
,hardware_name
),
783 static const luaL_reg R_nl80211
[] = {
784 LUA_REG(nl80211
,channel
),
785 LUA_REG(nl80211
,frequency
),
786 LUA_REG(nl80211
,frequency_offset
),
787 LUA_REG(nl80211
,txpower
),
788 LUA_REG(nl80211
,txpower_offset
),
789 LUA_REG(nl80211
,bitrate
),
790 LUA_REG(nl80211
,signal
),
791 LUA_REG(nl80211
,noise
),
792 LUA_REG(nl80211
,quality
),
793 LUA_REG(nl80211
,quality_max
),
794 LUA_REG(nl80211
,mode
),
795 LUA_REG(nl80211
,ssid
),
796 LUA_REG(nl80211
,bssid
),
797 LUA_REG(nl80211
,country
),
798 LUA_REG(nl80211
,assoclist
),
799 LUA_REG(nl80211
,txpwrlist
),
800 LUA_REG(nl80211
,scanlist
),
801 LUA_REG(nl80211
,freqlist
),
802 LUA_REG(nl80211
,countrylist
),
803 LUA_REG(nl80211
,hwmodelist
),
804 LUA_REG(nl80211
,encryption
),
805 LUA_REG(nl80211
,mbssid_support
),
806 LUA_REG(nl80211
,hardware_id
),
807 LUA_REG(nl80211
,hardware_name
),
813 static const luaL_reg R_wext
[] = {
814 LUA_REG(wext
,channel
),
815 LUA_REG(wext
,frequency
),
816 LUA_REG(wext
,frequency_offset
),
817 LUA_REG(wext
,txpower
),
818 LUA_REG(wext
,txpower_offset
),
819 LUA_REG(wext
,bitrate
),
820 LUA_REG(wext
,signal
),
822 LUA_REG(wext
,quality
),
823 LUA_REG(wext
,quality_max
),
827 LUA_REG(wext
,country
),
828 LUA_REG(wext
,assoclist
),
829 LUA_REG(wext
,txpwrlist
),
830 LUA_REG(wext
,scanlist
),
831 LUA_REG(wext
,freqlist
),
832 LUA_REG(wext
,countrylist
),
833 LUA_REG(wext
,hwmodelist
),
834 LUA_REG(wext
,encryption
),
835 LUA_REG(wext
,mbssid_support
),
836 LUA_REG(wext
,hardware_id
),
837 LUA_REG(wext
,hardware_name
),
842 static const luaL_reg R_common
[] = {
843 { "type", iwinfo_L_type
},
844 { "__gc", iwinfo_L__gc
},
849 LUALIB_API
int luaopen_iwinfo(lua_State
*L
) {
850 luaL_register(L
, IWINFO_META
, R_common
);
853 luaL_newmetatable(L
, IWINFO_WL_META
);
854 luaL_register(L
, NULL
, R_wl
);
855 lua_pushvalue(L
, -1);
856 lua_setfield(L
, -2, "__index");
857 lua_setfield(L
, -2, "wl");
861 luaL_newmetatable(L
, IWINFO_MADWIFI_META
);
862 luaL_register(L
, NULL
, R_madwifi
);
863 lua_pushvalue(L
, -1);
864 lua_setfield(L
, -2, "__index");
865 lua_setfield(L
, -2, "madwifi");
869 luaL_newmetatable(L
, IWINFO_NL80211_META
);
870 luaL_register(L
, NULL
, R_nl80211
);
871 lua_pushvalue(L
, -1);
872 lua_setfield(L
, -2, "__index");
873 lua_setfield(L
, -2, "nl80211");
876 luaL_newmetatable(L
, IWINFO_WEXT_META
);
877 luaL_register(L
, NULL
, R_wext
);
878 lua_pushvalue(L
, -1);
879 lua_setfield(L
, -2, "__index");
880 lua_setfield(L
, -2, "wext");
This page took 0.099173 seconds and 5 git commands to generate.