aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
Diffstat (limited to 'package/network')
-rw-r--r--package/network/utils/iwinfo/src/include/iwinfo.h5
-rw-r--r--package/network/utils/iwinfo/src/include/iwinfo/wl.h88
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_lua.c50
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_wl.c90
4 files changed, 88 insertions, 145 deletions
diff --git a/package/network/utils/iwinfo/src/include/iwinfo.h b/package/network/utils/iwinfo/src/include/iwinfo.h
index 099eca617f..d11f128eb0 100644
--- a/package/network/utils/iwinfo/src/include/iwinfo.h
+++ b/package/network/utils/iwinfo/src/include/iwinfo.h
@@ -186,9 +186,8 @@ void iwinfo_finish(void);
extern const struct iwinfo_ops wext_ops;
extern const struct iwinfo_ops madwifi_ops;
extern const struct iwinfo_ops nl80211_ops;
+extern const struct iwinfo_ops wl_ops;
-#ifdef USE_WL
-#include "iwinfo/wl.h"
-#endif
+#include "iwinfo/utils.h"
#endif
diff --git a/package/network/utils/iwinfo/src/include/iwinfo/wl.h b/package/network/utils/iwinfo/src/include/iwinfo/wl.h
deleted file mode 100644
index 535a43dc37..0000000000
--- a/package/network/utils/iwinfo/src/include/iwinfo/wl.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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
diff --git a/package/network/utils/iwinfo/src/iwinfo_lua.c b/package/network/utils/iwinfo/src/iwinfo_lua.c
index 0cc9f52bac..9b7d6554db 100644
--- a/package/network/utils/iwinfo/src/iwinfo_lua.c
+++ b/package/network/utils/iwinfo/src/iwinfo_lua.c
@@ -611,31 +611,31 @@ static int iwinfo_L_countrylist(lua_State *L, int (*func)(const char *, char *,
#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
diff --git a/package/network/utils/iwinfo/src/iwinfo_wl.c b/package/network/utils/iwinfo/src/iwinfo_wl.c
index d5a2793aa5..95240add70 100644
--- a/package/network/utils/iwinfo/src/iwinfo_wl.c
+++ b/package/network/utils/iwinfo/src/iwinfo_wl.c
@@ -18,7 +18,8 @@
* 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)
{
@@ -72,19 +73,19 @@ static struct wl_maclist * wl_read_assoclist(const char *ifname)
}
-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;
@@ -110,7 +111,7 @@ int wl_get_mode(const char *ifname, int *buf)
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;
@@ -121,7 +122,7 @@ int wl_get_ssid(const char *ifname, char *buf)
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];
@@ -135,23 +136,23 @@ int wl_get_bssid(const char *ifname, char *buf)
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;
@@ -162,7 +163,7 @@ int wl_get_bitrate(const char *ifname, int *buf)
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;
@@ -206,7 +207,7 @@ int wl_get_signal(const char *ifname, int *buf)
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;
@@ -232,17 +233,17 @@ int wl_get_noise(const char *ifname, int *buf)
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;
@@ -323,7 +324,7 @@ int wl_get_encryption(const char *ifname, char *buf)
return 0;
}
-int wl_get_phyname(const char *ifname, char *buf)
+static int wl_get_phyname(const char *ifname, char *buf)
{
char *p;
@@ -335,7 +336,7 @@ int wl_get_phyname(const char *ifname, char *buf)
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];
@@ -420,7 +421,7 @@ static void wl_get_assoclist_cb(const char *ifname,
}
}
-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;
@@ -500,7 +501,7 @@ int wl_get_assoclist(const char *ifname, char *buf, int *len)
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 };
@@ -518,17 +519,17 @@ int wl_get_txpwrlist(const char *ifname, char *buf, int *len)
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];
@@ -551,7 +552,7 @@ int wl_get_country(const char *ifname, char *buf)
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];
@@ -583,7 +584,7 @@ int wl_get_countrylist(const char *ifname, char *buf, int *len)
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;
@@ -627,7 +628,7 @@ int wl_get_hwmodelist(const char *ifname, int *buf)
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;
@@ -644,7 +645,7 @@ int wl_get_mbssid_support(const char *ifname, int *buf)
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;
@@ -660,7 +661,7 @@ int wl_get_hardware_id(const char *ifname, char *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;
@@ -672,7 +673,7 @@ int wl_get_hardware_name(const char *ifname, char *buf)
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];
@@ -690,9 +691,40 @@ int wl_get_txpower_offset(const char *ifname, int *buf)
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
+};