diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-09 02:02:46 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-09 02:02:46 +0000 |
commit | 87460e8a05faef9c4bb2c68735eef4f5c5ac15d0 (patch) | |
tree | f48ae15da981d9d02c00672dc33a45dedc905a0f /libs/iwinfo/src/iwinfo_lualib.h | |
parent | 68fb58dbcafe7f86b47821fc826f157bb9ef0924 (diff) |
libs: introduce iwinfo - wireless information abstraction for proprietary broadcom, madwifi and mac80211 drivers.
Diffstat (limited to 'libs/iwinfo/src/iwinfo_lualib.h')
-rw-r--r-- | libs/iwinfo/src/iwinfo_lualib.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libs/iwinfo/src/iwinfo_lualib.h b/libs/iwinfo/src/iwinfo_lualib.h new file mode 100644 index 0000000000..410a084f35 --- /dev/null +++ b/libs/iwinfo/src/iwinfo_lualib.h @@ -0,0 +1,69 @@ +/* + * iwinfo - Wireless Information Library - Lua Headers + * + * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org> + * + * The iwinfo library is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * The iwinfo library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the iwinfo library. If not, see http://www.gnu.org/licenses/. + */ + +#ifndef __IWINFO_LUALUB_H_ +#define __IWINFO_LUALIB_H_ + +#include <lua.h> +#include <lualib.h> +#include <lauxlib.h> + +#include "iwinfo.h" + + +#define IWINFO_META "iwinfo" +#define IWINFO_WL_META "iwinfo.wl" +#define IWINFO_MADWIFI_META "iwinfo.madwifi" +#define IWINFO_WEXT_META "iwinfo.wext" + +#define LUA_REG(type,op) \ + { #op, iwinfo_L_##type##_##op } + +#define LUA_WRAP_INT(type,op) \ + int iwinfo_L_##type##_##op(lua_State *L) \ + { \ + const char *ifname = luaL_checkstring(L, 1); \ + int rv; \ + if( !type##_get_##op(ifname, &rv) ) \ + lua_pushnumber(L, rv); \ + else \ + lua_pushnil(L); \ + return 1; \ + } + +#define LUA_WRAP_STRING(type,op) \ + int iwinfo_L_##type##_##op(lua_State *L) \ + { \ + const char *ifname = luaL_checkstring(L, 1); \ + char rv[IWINFO_BUFSIZE]; \ + if( !type##_get_##op(ifname, rv) ) \ + lua_pushstring(L, rv); \ + else \ + lua_pushnil(L); \ + return 1; \ + } + +#define LUA_WRAP_ASSOCLIST(type) \ + int iwinfo_L_##type##_assoclist(lua_State *L) \ + { \ + return iwinfo_L_assoclist(L, \ + type##_get_assoclist); \ + } + +#endif + |