2 * iwinfo - Wireless Information Library - Lua Headers
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 #ifndef __IWINFO_LUALUB_H_
20 #define __IWINFO_LUALIB_H_
27 #include "iwinfo_wext_scan.h"
30 const char *IWINFO_CIPHER_NAMES[] = {
41 const char *IWINFO_KMGMT_NAMES[] = {
47 const char *IWINFO_AUTH_NAMES[] = {
53 #define IWINFO_META "iwinfo"
54 #define IWINFO_WEXT_META "iwinfo.wext"
57 #define IWINFO_WL_META "iwinfo.wl"
61 #define IWINFO_MADWIFI_META "iwinfo.madwifi"
65 #define IWINFO_NL80211_META "iwinfo.nl80211"
69 #define LUA_REG(type,op) \
70 { #op, iwinfo_L_##type##_##op }
72 #define LUA_WRAP_INT(type,op) \
73 static int iwinfo_L_##type##_##op(lua_State *L) \
75 const char *ifname = luaL_checkstring(L, 1); \
77 if( !type##_get_##op(ifname, &rv) ) \
78 lua_pushnumber(L, rv); \
84 #define LUA_WRAP_STRING(type,op) \
85 static int iwinfo_L_##type##_##op(lua_State *L) \
87 const char *ifname = luaL_checkstring(L, 1); \
88 char rv[IWINFO_BUFSIZE]; \
89 memset(rv, 0, IWINFO_BUFSIZE); \
90 if( !type##_get_##op(ifname, rv) ) \
91 lua_pushstring(L, rv); \
97 #define LUA_WRAP_LIST(type,op) \
98 static int iwinfo_L_##type##_##op(lua_State *L) \
100 return iwinfo_L_##op(L, type##_get_##op); \