mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
iwinfo: keep an array of backends, reduce the number of ifdefs and hardcoded strcmp calls
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40809 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -148,6 +148,9 @@ extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[];
|
||||
|
||||
|
||||
struct iwinfo_ops {
|
||||
const char *name;
|
||||
|
||||
int (*probe)(const char *ifname);
|
||||
int (*mode)(const char *, int *);
|
||||
int (*channel)(const char *, int *);
|
||||
int (*frequency)(const char *, int *);
|
||||
|
||||
@@ -54,6 +54,8 @@ 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,
|
||||
|
||||
@@ -96,6 +96,8 @@ int nl80211_get_hardware_name(const char *ifname, char *buf);
|
||||
void nl80211_close(void);
|
||||
|
||||
static const struct iwinfo_ops nl80211_ops = {
|
||||
.name = "nl80211",
|
||||
.probe = nl80211_probe,
|
||||
.channel = nl80211_get_channel,
|
||||
.frequency = nl80211_get_frequency,
|
||||
.frequency_offset = nl80211_get_frequency_offset,
|
||||
|
||||
@@ -55,6 +55,8 @@ int wext_get_hardware_name(const char *ifname, char *buf);
|
||||
void wext_close(void);
|
||||
|
||||
static const struct iwinfo_ops wext_ops = {
|
||||
.name = "wext",
|
||||
.probe = wext_probe,
|
||||
.channel = wext_get_channel,
|
||||
.frequency = wext_get_frequency,
|
||||
.frequency_offset = wext_get_frequency_offset,
|
||||
|
||||
@@ -55,6 +55,8 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user