+++ /dev/null
-/*
- * iwinfo - Wireless Information Library - Broadcom wl.o Headers
- *
- * Copyright (C) 2009-2010 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_WL_H_
-#define __IWINFO_WL_H_
-
-#include <fcntl.h>
-
-#include "iwinfo.h"
-#include "iwinfo/utils.h"
-#include "iwinfo/api/broadcom.h"
-
-int wl_probe(const char *ifname);
-int wl_get_mode(const char *ifname, int *buf);
-int wl_get_ssid(const char *ifname, char *buf);
-int wl_get_bssid(const char *ifname, char *buf);
-int wl_get_country(const char *ifname, char *buf);
-int wl_get_channel(const char *ifname, int *buf);
-int wl_get_frequency(const char *ifname, int *buf);
-int wl_get_frequency_offset(const char *ifname, int *buf);
-int wl_get_txpower(const char *ifname, int *buf);
-int wl_get_txpower_offset(const char *ifname, int *buf);
-int wl_get_bitrate(const char *ifname, int *buf);
-int wl_get_signal(const char *ifname, int *buf);
-int wl_get_noise(const char *ifname, int *buf);
-int wl_get_quality(const char *ifname, int *buf);
-int wl_get_quality_max(const char *ifname, int *buf);
-int wl_get_enctype(const char *ifname, char *buf);
-int wl_get_encryption(const char *ifname, char *buf);
-int wl_get_phyname(const char *ifname, char *buf);
-int wl_get_assoclist(const char *ifname, char *buf, int *len);
-int wl_get_txpwrlist(const char *ifname, char *buf, int *len);
-int wl_get_scanlist(const char *ifname, char *buf, int *len);
-int wl_get_freqlist(const char *ifname, char *buf, int *len);
-int wl_get_countrylist(const char *ifname, char *buf, int *len);
-int wl_get_hwmodelist(const char *ifname, int *buf);
-int wl_get_mbssid_support(const char *ifname, int *buf);
-int wl_get_hardware_id(const char *ifname, char *buf);
-int wl_get_hardware_name(const char *ifname, char *buf);
-void wl_close(void);
-
-static const struct iwinfo_ops wl_ops = {
- .name = "wl",
- .probe = wl_probe,
- .channel = wl_get_channel,
- .frequency = wl_get_frequency,
- .frequency_offset = wl_get_frequency_offset,
- .txpower = wl_get_txpower,
- .txpower_offset = wl_get_txpower_offset,
- .bitrate = wl_get_bitrate,
- .signal = wl_get_signal,
- .noise = wl_get_noise,
- .quality = wl_get_quality,
- .quality_max = wl_get_quality_max,
- .mbssid_support = wl_get_mbssid_support,
- .hwmodelist = wl_get_hwmodelist,
- .mode = wl_get_mode,
- .ssid = wl_get_ssid,
- .bssid = wl_get_bssid,
- .country = wl_get_country,
- .hardware_id = wl_get_hardware_id,
- .hardware_name = wl_get_hardware_name,
- .encryption = wl_get_encryption,
- .phyname = wl_get_phyname,
- .assoclist = wl_get_assoclist,
- .txpwrlist = wl_get_txpwrlist,
- .scanlist = wl_get_scanlist,
- .freqlist = wl_get_freqlist,
- .countrylist = wl_get_countrylist,
- .close = wl_close
-};
-
-#endif
#ifdef USE_WL
/* Broadcom */
-LUA_WRAP_INT(wl,channel)
-LUA_WRAP_INT(wl,frequency)
-LUA_WRAP_INT(wl,frequency_offset)
-LUA_WRAP_INT(wl,txpower)
-LUA_WRAP_INT(wl,txpower_offset)
-LUA_WRAP_INT(wl,bitrate)
-LUA_WRAP_INT(wl,signal)
-LUA_WRAP_INT(wl,noise)
-LUA_WRAP_INT(wl,quality)
-LUA_WRAP_INT(wl,quality_max)
-LUA_WRAP_STRING(wl,ssid)
-LUA_WRAP_STRING(wl,bssid)
-LUA_WRAP_STRING(wl,country)
-LUA_WRAP_STRING(wl,hardware_name)
-LUA_WRAP_STRING(wl,phyname)
-LUA_WRAP_STRUCT(wl,mode)
-LUA_WRAP_STRUCT(wl,assoclist)
-LUA_WRAP_STRUCT(wl,txpwrlist)
-LUA_WRAP_STRUCT(wl,scanlist)
-LUA_WRAP_STRUCT(wl,freqlist)
-LUA_WRAP_STRUCT(wl,countrylist)
-LUA_WRAP_STRUCT(wl,hwmodelist)
-LUA_WRAP_STRUCT(wl,encryption)
-LUA_WRAP_STRUCT(wl,mbssid_support)
-LUA_WRAP_STRUCT(wl,hardware_id)
+LUA_WRAP_INT_OP(wl,channel)
+LUA_WRAP_INT_OP(wl,frequency)
+LUA_WRAP_INT_OP(wl,frequency_offset)
+LUA_WRAP_INT_OP(wl,txpower)
+LUA_WRAP_INT_OP(wl,txpower_offset)
+LUA_WRAP_INT_OP(wl,bitrate)
+LUA_WRAP_INT_OP(wl,signal)
+LUA_WRAP_INT_OP(wl,noise)
+LUA_WRAP_INT_OP(wl,quality)
+LUA_WRAP_INT_OP(wl,quality_max)
+LUA_WRAP_STRING_OP(wl,ssid)
+LUA_WRAP_STRING_OP(wl,bssid)
+LUA_WRAP_STRING_OP(wl,country)
+LUA_WRAP_STRING_OP(wl,hardware_name)
+LUA_WRAP_STRING_OP(wl,phyname)
+LUA_WRAP_STRUCT_OP(wl,mode)
+LUA_WRAP_STRUCT_OP(wl,assoclist)
+LUA_WRAP_STRUCT_OP(wl,txpwrlist)
+LUA_WRAP_STRUCT_OP(wl,scanlist)
+LUA_WRAP_STRUCT_OP(wl,freqlist)
+LUA_WRAP_STRUCT_OP(wl,countrylist)
+LUA_WRAP_STRUCT_OP(wl,hwmodelist)
+LUA_WRAP_STRUCT_OP(wl,encryption)
+LUA_WRAP_STRUCT_OP(wl,mbssid_support)
+LUA_WRAP_STRUCT_OP(wl,hardware_id)
#endif
#ifdef USE_MADWIFI
* This code is based on the wlc.c utility published by OpenWrt.org .
*/
-#include "iwinfo/wl.h"
+#include "iwinfo.h"
+#include "iwinfo/api/broadcom.h"
static int wl_ioctl(const char *name, int cmd, void *buf, int len)
{
}
-int wl_probe(const char *ifname)
+static int wl_probe(const char *ifname)
{
int magic;
return (!wl_ioctl(ifname, WLC_GET_MAGIC, &magic, sizeof(magic)) &&
(magic == WLC_IOCTL_MAGIC));
}
-void wl_close(void)
+static void wl_close(void)
{
/* Nop */
}
-int wl_get_mode(const char *ifname, int *buf)
+static int wl_get_mode(const char *ifname, int *buf)
{
int ret = -1;
int ap, infra, passive;
return 0;
}
-int wl_get_ssid(const char *ifname, char *buf)
+static int wl_get_ssid(const char *ifname, char *buf)
{
int ret = -1;
wlc_ssid_t ssid;
return ret;
}
-int wl_get_bssid(const char *ifname, char *buf)
+static int wl_get_bssid(const char *ifname, char *buf)
{
int ret = -1;
char bssid[6];
return ret;
}
-int wl_get_channel(const char *ifname, int *buf)
+static int wl_get_channel(const char *ifname, int *buf)
{
return wl_ioctl(ifname, WLC_GET_CHANNEL, buf, sizeof(buf));
}
-int wl_get_frequency(const char *ifname, int *buf)
+static int wl_get_frequency(const char *ifname, int *buf)
{
return wext_ops.frequency(ifname, buf);
}
-int wl_get_txpower(const char *ifname, int *buf)
+static int wl_get_txpower(const char *ifname, int *buf)
{
/* WLC_GET_VAR "qtxpower" */
return wext_ops.txpower(ifname, buf);
}
-int wl_get_bitrate(const char *ifname, int *buf)
+static int wl_get_bitrate(const char *ifname, int *buf)
{
int ret = -1;
int rate = 0;
return ret;
}
-int wl_get_signal(const char *ifname, int *buf)
+static int wl_get_signal(const char *ifname, int *buf)
{
unsigned int ap, rssi, i, rssi_count;
int ioctl_req_version = 0x2000;
return 0;
}
-int wl_get_noise(const char *ifname, int *buf)
+static int wl_get_noise(const char *ifname, int *buf)
{
unsigned int ap, noise;
int ioctl_req_version = 0x2000;
return 0;
}
-int wl_get_quality(const char *ifname, int *buf)
+static int wl_get_quality(const char *ifname, int *buf)
{
return wext_ops.quality(ifname, buf);
}
-int wl_get_quality_max(const char *ifname, int *buf)
+static int wl_get_quality_max(const char *ifname, int *buf)
{
return wext_ops.quality_max(ifname, buf);
}
-int wl_get_encryption(const char *ifname, char *buf)
+static int wl_get_encryption(const char *ifname, char *buf)
{
uint32_t wsec, wauth, wpa;
struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf;
return 0;
}
-int wl_get_phyname(const char *ifname, char *buf)
+static int wl_get_phyname(const char *ifname, char *buf)
{
char *p;
return 0;
}
-int wl_get_enctype(const char *ifname, char *buf)
+static int wl_get_enctype(const char *ifname, char *buf)
{
uint32_t wsec, wpa;
char algo[11];
}
}
-int wl_get_assoclist(const char *ifname, char *buf, int *len)
+static int wl_get_assoclist(const char *ifname, char *buf, int *len)
{
int i, j, noise;
int ap, infra, passive;
return -1;
}
-int wl_get_txpwrlist(const char *ifname, char *buf, int *len)
+static int wl_get_txpwrlist(const char *ifname, char *buf, int *len)
{
struct iwinfo_txpwrlist_entry entry;
uint8_t dbm[11] = { 0, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 };
return 0;
}
-int wl_get_scanlist(const char *ifname, char *buf, int *len)
+static int wl_get_scanlist(const char *ifname, char *buf, int *len)
{
return wext_ops.scanlist(ifname, buf, len);
}
-int wl_get_freqlist(const char *ifname, char *buf, int *len)
+static int wl_get_freqlist(const char *ifname, char *buf, int *len)
{
return wext_ops.freqlist(ifname, buf, len);
}
-int wl_get_country(const char *ifname, char *buf)
+static int wl_get_country(const char *ifname, char *buf)
{
char ccode[WLC_CNTRY_BUF_SZ];
return -1;
}
-int wl_get_countrylist(const char *ifname, char *buf, int *len)
+static int wl_get_countrylist(const char *ifname, char *buf, int *len)
{
int i, count;
char cdata[WLC_IOCTL_MAXLEN];
return -1;
}
-int wl_get_hwmodelist(const char *ifname, int *buf)
+static int wl_get_hwmodelist(const char *ifname, int *buf)
{
int phytype;
uint i, band[WLC_BAND_ALL], bands;
return -1;
}
-int wl_get_mbssid_support(const char *ifname, int *buf)
+static int wl_get_mbssid_support(const char *ifname, int *buf)
{
wlc_rev_info_t revinfo;
return -1;
}
-int wl_get_hardware_id(const char *ifname, char *buf)
+static int wl_get_hardware_id(const char *ifname, char *buf)
{
wlc_rev_info_t revinfo;
struct iwinfo_hardware_id *ids = (struct iwinfo_hardware_id *)buf;
return 0;
}
-int wl_get_hardware_name(const char *ifname, char *buf)
+static int wl_get_hardware_name(const char *ifname, char *buf)
{
struct iwinfo_hardware_id ids;
return 0;
}
-int wl_get_txpower_offset(const char *ifname, int *buf)
+static int wl_get_txpower_offset(const char *ifname, int *buf)
{
FILE *p;
char off[8];
return 0;
}
-int wl_get_frequency_offset(const char *ifname, int *buf)
+static int wl_get_frequency_offset(const char *ifname, int *buf)
{
/* Stub */
*buf = 0;
return -1;
}
+
+const struct iwinfo_ops wl_ops = {
+ .name = "wl",
+ .probe = wl_probe,
+ .channel = wl_get_channel,
+ .frequency = wl_get_frequency,
+ .frequency_offset = wl_get_frequency_offset,
+ .txpower = wl_get_txpower,
+ .txpower_offset = wl_get_txpower_offset,
+ .bitrate = wl_get_bitrate,
+ .signal = wl_get_signal,
+ .noise = wl_get_noise,
+ .quality = wl_get_quality,
+ .quality_max = wl_get_quality_max,
+ .mbssid_support = wl_get_mbssid_support,
+ .hwmodelist = wl_get_hwmodelist,
+ .mode = wl_get_mode,
+ .ssid = wl_get_ssid,
+ .bssid = wl_get_bssid,
+ .country = wl_get_country,
+ .hardware_id = wl_get_hardware_id,
+ .hardware_name = wl_get_hardware_name,
+ .encryption = wl_get_encryption,
+ .phyname = wl_get_phyname,
+ .assoclist = wl_get_assoclist,
+ .txpwrlist = wl_get_txpwrlist,
+ .scanlist = wl_get_scanlist,
+ .freqlist = wl_get_freqlist,
+ .countrylist = wl_get_countrylist,
+ .close = wl_close
+};