void iwinfo_finish(void);
extern const struct iwinfo_ops wext_ops;
+extern const struct iwinfo_ops madwifi_ops;
#ifdef USE_WL
#include "iwinfo/wl.h"
#endif
-#ifdef USE_MADWIFI
-#include "iwinfo/madwifi.h"
-#endif
-
#ifdef USE_NL80211
#include "iwinfo/nl80211.h"
#endif
+++ /dev/null
-/*
- * iwinfo - Wireless Information Library - Madwifi 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_MADWIFI_H_
-#define __IWINFO_MADWIFI_H_
-
-#include <fcntl.h>
-
-#include "iwinfo.h"
-#include "iwinfo/utils.h"
-#include "iwinfo/api/madwifi.h"
-
-int madwifi_probe(const char *ifname);
-int madwifi_get_mode(const char *ifname, int *buf);
-int madwifi_get_ssid(const char *ifname, char *buf);
-int madwifi_get_bssid(const char *ifname, char *buf);
-int madwifi_get_country(const char *ifname, char *buf);
-int madwifi_get_channel(const char *ifname, int *buf);
-int madwifi_get_frequency(const char *ifname, int *buf);
-int madwifi_get_frequency_offset(const char *ifname, int *buf);
-int madwifi_get_txpower(const char *ifname, int *buf);
-int madwifi_get_txpower_offset(const char *ifname, int *buf);
-int madwifi_get_bitrate(const char *ifname, int *buf);
-int madwifi_get_signal(const char *ifname, int *buf);
-int madwifi_get_noise(const char *ifname, int *buf);
-int madwifi_get_quality(const char *ifname, int *buf);
-int madwifi_get_quality_max(const char *ifname, int *buf);
-int madwifi_get_encryption(const char *ifname, char *buf);
-int madwifi_get_phyname(const char *ifname, char *buf);
-int madwifi_get_assoclist(const char *ifname, char *buf, int *len);
-int madwifi_get_txpwrlist(const char *ifname, char *buf, int *len);
-int madwifi_get_scanlist(const char *ifname, char *buf, int *len);
-int madwifi_get_freqlist(const char *ifname, char *buf, int *len);
-int madwifi_get_countrylist(const char *ifname, char *buf, int *len);
-int madwifi_get_hwmodelist(const char *ifname, int *buf);
-int madwifi_get_mbssid_support(const char *ifname, int *buf);
-int madwifi_get_hardware_id(const char *ifname, char *buf);
-int madwifi_get_hardware_name(const char *ifname, char *buf);
-void madwifi_close(void);
-
-static const struct iwinfo_ops madwifi_ops = {
- .name = "madwifi",
- .probe = madwifi_probe,
- .channel = madwifi_get_channel,
- .frequency = madwifi_get_frequency,
- .frequency_offset = madwifi_get_frequency_offset,
- .txpower = madwifi_get_txpower,
- .txpower_offset = madwifi_get_txpower_offset,
- .bitrate = madwifi_get_bitrate,
- .signal = madwifi_get_signal,
- .noise = madwifi_get_noise,
- .quality = madwifi_get_quality,
- .quality_max = madwifi_get_quality_max,
- .mbssid_support = madwifi_get_mbssid_support,
- .hwmodelist = madwifi_get_hwmodelist,
- .mode = madwifi_get_mode,
- .ssid = madwifi_get_ssid,
- .bssid = madwifi_get_bssid,
- .country = madwifi_get_country,
- .hardware_id = madwifi_get_hardware_id,
- .hardware_name = madwifi_get_hardware_name,
- .encryption = madwifi_get_encryption,
- .phyname = madwifi_get_phyname,
- .assoclist = madwifi_get_assoclist,
- .txpwrlist = madwifi_get_txpwrlist,
- .scanlist = madwifi_get_scanlist,
- .freqlist = madwifi_get_freqlist,
- .countrylist = madwifi_get_countrylist,
- .close = madwifi_close
-};
-
-#endif
#ifdef USE_MADWIFI
/* Madwifi */
-LUA_WRAP_INT(madwifi,channel)
-LUA_WRAP_INT(madwifi,frequency)
-LUA_WRAP_INT(madwifi,frequency_offset)
-LUA_WRAP_INT(madwifi,txpower)
-LUA_WRAP_INT(madwifi,txpower_offset)
-LUA_WRAP_INT(madwifi,bitrate)
-LUA_WRAP_INT(madwifi,signal)
-LUA_WRAP_INT(madwifi,noise)
-LUA_WRAP_INT(madwifi,quality)
-LUA_WRAP_INT(madwifi,quality_max)
-LUA_WRAP_STRING(madwifi,ssid)
-LUA_WRAP_STRING(madwifi,bssid)
-LUA_WRAP_STRING(madwifi,country)
-LUA_WRAP_STRING(madwifi,hardware_name)
-LUA_WRAP_STRING(madwifi,phyname)
-LUA_WRAP_STRUCT(madwifi,mode)
-LUA_WRAP_STRUCT(madwifi,assoclist)
-LUA_WRAP_STRUCT(madwifi,txpwrlist)
-LUA_WRAP_STRUCT(madwifi,scanlist)
-LUA_WRAP_STRUCT(madwifi,freqlist)
-LUA_WRAP_STRUCT(madwifi,countrylist)
-LUA_WRAP_STRUCT(madwifi,hwmodelist)
-LUA_WRAP_STRUCT(madwifi,encryption)
-LUA_WRAP_STRUCT(madwifi,mbssid_support)
-LUA_WRAP_STRUCT(madwifi,hardware_id)
+LUA_WRAP_INT_OP(madwifi,channel)
+LUA_WRAP_INT_OP(madwifi,frequency)
+LUA_WRAP_INT_OP(madwifi,frequency_offset)
+LUA_WRAP_INT_OP(madwifi,txpower)
+LUA_WRAP_INT_OP(madwifi,txpower_offset)
+LUA_WRAP_INT_OP(madwifi,bitrate)
+LUA_WRAP_INT_OP(madwifi,signal)
+LUA_WRAP_INT_OP(madwifi,noise)
+LUA_WRAP_INT_OP(madwifi,quality)
+LUA_WRAP_INT_OP(madwifi,quality_max)
+LUA_WRAP_STRING_OP(madwifi,ssid)
+LUA_WRAP_STRING_OP(madwifi,bssid)
+LUA_WRAP_STRING_OP(madwifi,country)
+LUA_WRAP_STRING_OP(madwifi,hardware_name)
+LUA_WRAP_STRING_OP(madwifi,phyname)
+LUA_WRAP_STRUCT_OP(madwifi,mode)
+LUA_WRAP_STRUCT_OP(madwifi,assoclist)
+LUA_WRAP_STRUCT_OP(madwifi,txpwrlist)
+LUA_WRAP_STRUCT_OP(madwifi,scanlist)
+LUA_WRAP_STRUCT_OP(madwifi,freqlist)
+LUA_WRAP_STRUCT_OP(madwifi,countrylist)
+LUA_WRAP_STRUCT_OP(madwifi,hwmodelist)
+LUA_WRAP_STRUCT_OP(madwifi,encryption)
+LUA_WRAP_STRUCT_OP(madwifi,mbssid_support)
+LUA_WRAP_STRUCT_OP(madwifi,hardware_id)
#endif
#ifdef USE_NL80211
* inspired by the hostapd madwifi driver.
*/
-#include "iwinfo/madwifi.h"
#include "iwinfo_wext.h"
+#include "iwinfo/api/madwifi.h"
/*
}
-int madwifi_probe(const char *ifname)
+static int madwifi_probe(const char *ifname)
{
return ( !!madwifi_isvap(ifname, NULL) || madwifi_iswifi(ifname) );
}
-void madwifi_close(void)
+static void madwifi_close(void)
{
/* Nop */
}
-int madwifi_get_mode(const char *ifname, int *buf)
+static int madwifi_get_mode(const char *ifname, int *buf)
{
return wext_ops.mode(ifname, buf);
}
-int madwifi_get_ssid(const char *ifname, char *buf)
+static int madwifi_get_ssid(const char *ifname, char *buf)
{
return wext_ops.ssid(ifname, buf);
}
-int madwifi_get_bssid(const char *ifname, char *buf)
+static int madwifi_get_bssid(const char *ifname, char *buf)
{
return wext_ops.bssid(ifname, buf);
}
-int madwifi_get_channel(const char *ifname, int *buf)
+static int madwifi_get_channel(const char *ifname, int *buf)
{
int i;
uint16_t freq;
return -1;
}
-int madwifi_get_frequency(const char *ifname, int *buf)
+static int madwifi_get_frequency(const char *ifname, int *buf)
{
struct iwreq wrq;
return -1;
}
-int madwifi_get_txpower(const char *ifname, int *buf)
+static int madwifi_get_txpower(const char *ifname, int *buf)
{
return wext_ops.txpower(ifname, buf);
}
-int madwifi_get_bitrate(const char *ifname, int *buf)
+static int madwifi_get_bitrate(const char *ifname, int *buf)
{
unsigned int mode, len, rate, rate_count;
uint8_t tmp[24*1024];
return -1;
}
-int madwifi_get_signal(const char *ifname, int *buf)
+static int madwifi_get_signal(const char *ifname, int *buf)
{
unsigned int mode, len, rssi, rssi_count;
uint8_t tmp[24*1024];
return -1;
}
-int madwifi_get_noise(const char *ifname, int *buf)
+static int madwifi_get_noise(const char *ifname, int *buf)
{
return wext_ops.noise(ifname, buf);
}
-int madwifi_get_quality(const char *ifname, int *buf)
+static int madwifi_get_quality(const char *ifname, int *buf)
{
unsigned int mode, len, quality, quality_count;
uint8_t tmp[24*1024];
return -1;
}
-int madwifi_get_quality_max(const char *ifname, int *buf)
+static int madwifi_get_quality_max(const char *ifname, int *buf)
{
return wext_ops.quality_max(ifname, buf);
}
-int madwifi_get_encryption(const char *ifname, char *buf)
+static int madwifi_get_encryption(const char *ifname, char *buf)
{
int ciphers = 0, key_len = 0;
char keybuf[IW_ENCODING_TOKEN_MAX];
return 0;
}
-int madwifi_get_phyname(const char *ifname, char *buf)
+static int madwifi_get_phyname(const char *ifname, char *buf)
{
const char *wifidev;
return -1;
}
-int madwifi_get_assoclist(const char *ifname, char *buf, int *len)
+static int madwifi_get_assoclist(const char *ifname, char *buf, int *len)
{
int bl, tl, noise;
uint8_t *cp;
return -1;
}
-int madwifi_get_txpwrlist(const char *ifname, char *buf, int *len)
+static int madwifi_get_txpwrlist(const char *ifname, char *buf, int *len)
{
int rc = -1;
char *res;
return rc;
}
-int madwifi_get_scanlist(const char *ifname, char *buf, int *len)
+static int madwifi_get_scanlist(const char *ifname, char *buf, int *len)
{
int ret;
char *res;
return ret;
}
-int madwifi_get_freqlist(const char *ifname, char *buf, int *len)
+static int madwifi_get_freqlist(const char *ifname, char *buf, int *len)
{
int i, bl;
int rc = -1;
return -1;
}
-int madwifi_get_country(const char *ifname, char *buf)
+static int madwifi_get_country(const char *ifname, char *buf)
{
int i, fd, ccode = -1;
char buffer[34];
return -1;
}
-int madwifi_get_countrylist(const char *ifname, char *buf, int *len)
+static int madwifi_get_countrylist(const char *ifname, char *buf, int *len)
{
int i, count;
struct ISO3166_to_CCode *e, *p = NULL;
return 0;
}
-int madwifi_get_hwmodelist(const char *ifname, int *buf)
+static int madwifi_get_hwmodelist(const char *ifname, int *buf)
{
char chans[IWINFO_BUFSIZE] = { 0 };
struct iwinfo_freqlist_entry *e = NULL;
return -1;
}
-int madwifi_get_mbssid_support(const char *ifname, int *buf)
+static int madwifi_get_mbssid_support(const char *ifname, int *buf)
{
/* Test whether we can create another interface */
char *nif = madwifi_ifadd(ifname);
return -1;
}
-int madwifi_get_hardware_id(const char *ifname, char *buf)
+static int madwifi_get_hardware_id(const char *ifname, char *buf)
{
char vendor[64];
char device[64];
return iwinfo_hardware(&id);
}
-int madwifi_get_hardware_name(const char *ifname, char *buf)
+static int madwifi_get_hardware_name(const char *ifname, char *buf)
{
const struct iwinfo_hardware_entry *hw;
return 0;
}
-int madwifi_get_txpower_offset(const char *ifname, int *buf)
+static int madwifi_get_txpower_offset(const char *ifname, int *buf)
{
const struct iwinfo_hardware_entry *hw;
return 0;
}
-int madwifi_get_frequency_offset(const char *ifname, int *buf)
+static int madwifi_get_frequency_offset(const char *ifname, int *buf)
{
const struct iwinfo_hardware_entry *hw;
*buf = hw->frequency_offset;
return 0;
}
+
+const struct iwinfo_ops madwifi_ops = {
+ .name = "madwifi",
+ .probe = madwifi_probe,
+ .channel = madwifi_get_channel,
+ .frequency = madwifi_get_frequency,
+ .frequency_offset = madwifi_get_frequency_offset,
+ .txpower = madwifi_get_txpower,
+ .txpower_offset = madwifi_get_txpower_offset,
+ .bitrate = madwifi_get_bitrate,
+ .signal = madwifi_get_signal,
+ .noise = madwifi_get_noise,
+ .quality = madwifi_get_quality,
+ .quality_max = madwifi_get_quality_max,
+ .mbssid_support = madwifi_get_mbssid_support,
+ .hwmodelist = madwifi_get_hwmodelist,
+ .mode = madwifi_get_mode,
+ .ssid = madwifi_get_ssid,
+ .bssid = madwifi_get_bssid,
+ .country = madwifi_get_country,
+ .hardware_id = madwifi_get_hardware_id,
+ .hardware_name = madwifi_get_hardware_name,
+ .encryption = madwifi_get_encryption,
+ .phyname = madwifi_get_phyname,
+ .assoclist = madwifi_get_assoclist,
+ .txpwrlist = madwifi_get_txpwrlist,
+ .scanlist = madwifi_get_scanlist,
+ .freqlist = madwifi_get_freqlist,
+ .countrylist = madwifi_get_countrylist,
+ .close = madwifi_close
+};