const struct iwinfo_ops * iwinfo_backend(const char *ifname) { const char *type; struct iwinfo_ops *ops; type = iwinfo_type(ifname); if (!type) return NULL; #ifdef USE_NL80211 if (!strcmp(type, "nl80211")) return &nl80211_ops; else #endif #ifdef USE_MADWIFI if (!strcmp(type, "madwifi")) return &madwifi_ops; else #endif #ifdef USE_WL if (!strcmp(type, "wl")) return &wl_ops; else #endif if (!strcmp(type, "wext")) return &wext_ops; return NULL; }
/* Determine type */ static int iwinfo_L_type(lua_State *L) { const char *ifname = luaL_checkstring(L, 1); const char *type = iwinfo_type(ifname); if (type) lua_pushstring(L, type); else lua_pushnil(L); return 1; }
static const char * print_type(const struct iwinfo_ops *iw, const char *ifname) { const char *type = iwinfo_type(ifname); return type ? type : "unknown"; }