From: Felix Fietkau Date: Wed, 21 May 2014 12:33:18 +0000 (+0000) Subject: iwinfo: move madwifi_ops to iwinfo_madwifi.c, make functions static X-Git-Tag: reboot~7230 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6c02355830a47bff8d8b5d7b0d770df6b4a4410a;p=openwrt%2Fstaging%2Fblogic.git iwinfo: move madwifi_ops to iwinfo_madwifi.c, make functions static Signed-off-by: Felix Fietkau SVN-Revision: 40811 --- diff --git a/package/network/utils/iwinfo/src/include/iwinfo.h b/package/network/utils/iwinfo/src/include/iwinfo.h index 072688c7bc5c..3aa0891c6eec 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo.h +++ b/package/network/utils/iwinfo/src/include/iwinfo.h @@ -184,15 +184,12 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname); 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 diff --git a/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h b/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h deleted file mode 100644 index 0de9fea6e315..000000000000 --- a/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * iwinfo - Wireless Information Library - Madwifi Headers - * - * Copyright (C) 2009 Jo-Philipp Wich - * - * 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 - -#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 diff --git a/package/network/utils/iwinfo/src/iwinfo_lua.c b/package/network/utils/iwinfo/src/iwinfo_lua.c index 541156b400c1..23d72d9bdb0b 100644 --- a/package/network/utils/iwinfo/src/iwinfo_lua.c +++ b/package/network/utils/iwinfo/src/iwinfo_lua.c @@ -640,31 +640,31 @@ LUA_WRAP_STRUCT(wl,hardware_id) #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 diff --git a/package/network/utils/iwinfo/src/iwinfo_madwifi.c b/package/network/utils/iwinfo/src/iwinfo_madwifi.c index be41c50951bb..75b0c9f77998 100644 --- a/package/network/utils/iwinfo/src/iwinfo_madwifi.c +++ b/package/network/utils/iwinfo/src/iwinfo_madwifi.c @@ -20,8 +20,8 @@ * inspired by the hostapd madwifi driver. */ -#include "iwinfo/madwifi.h" #include "iwinfo_wext.h" +#include "iwinfo/api/madwifi.h" /* @@ -337,32 +337,32 @@ static void madwifi_ifdel(const char *ifname) } -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; @@ -394,7 +394,7 @@ int madwifi_get_channel(const char *ifname, int *buf) return -1; } -int madwifi_get_frequency(const char *ifname, int *buf) +static int madwifi_get_frequency(const char *ifname, int *buf) { struct iwreq wrq; @@ -407,12 +407,12 @@ int madwifi_get_frequency(const char *ifname, int *buf) 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]; @@ -458,7 +458,7 @@ int madwifi_get_bitrate(const char *ifname, int *buf) 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]; @@ -504,12 +504,12 @@ int madwifi_get_signal(const char *ifname, int *buf) 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]; @@ -555,12 +555,12 @@ int madwifi_get_quality(const char *ifname, int *buf) 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]; @@ -721,7 +721,7 @@ int madwifi_get_encryption(const char *ifname, char *buf) return 0; } -int madwifi_get_phyname(const char *ifname, char *buf) +static int madwifi_get_phyname(const char *ifname, char *buf) { const char *wifidev; @@ -741,7 +741,7 @@ int madwifi_get_phyname(const char *ifname, char *buf) 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; @@ -797,7 +797,7 @@ int madwifi_get_assoclist(const char *ifname, char *buf, int *len) 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; @@ -821,7 +821,7 @@ int madwifi_get_txpwrlist(const char *ifname, char *buf, int *len) 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; @@ -881,7 +881,7 @@ int madwifi_get_scanlist(const char *ifname, char *buf, int *len) 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; @@ -931,7 +931,7 @@ int madwifi_get_freqlist(const char *ifname, char *buf, int *len) 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]; @@ -969,7 +969,7 @@ int madwifi_get_country(const char *ifname, char *buf) 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; @@ -997,7 +997,7 @@ int madwifi_get_countrylist(const char *ifname, char *buf, int *len) 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; @@ -1024,7 +1024,7 @@ int madwifi_get_hwmodelist(const char *ifname, int *buf) 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); @@ -1042,7 +1042,7 @@ int madwifi_get_mbssid_support(const char *ifname, int *buf) 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]; @@ -1067,7 +1067,7 @@ madwifi_get_hardware_entry(const char *ifname) 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; @@ -1079,7 +1079,7 @@ int madwifi_get_hardware_name(const char *ifname, char *buf) 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; @@ -1090,7 +1090,7 @@ int madwifi_get_txpower_offset(const char *ifname, int *buf) 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; @@ -1100,3 +1100,34 @@ int madwifi_get_frequency_offset(const char *ifname, int *buf) *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 +};