* Reworked scanner registration. Scanners are getting cleanly unregistered

on wlan stack shutdown, now.
* Added patch by mmlr to support IBSS (aka Ad-hoc) mode. To activate IBSS mode
  one would need recompile the wlan stack, though, once the constant in
  start_wlan() is switched from IEEE80211_M_STA to IEEE80211_M_IBSS. There is
  no runtime configuration, yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther
2009-12-30 00:37:23 +00:00
parent bfaa8fac89
commit 5ce504e289
4 changed files with 30 additions and 21 deletions
@@ -268,24 +268,18 @@ void ieee80211_load_module(const char *);
*/ */
#define _IEEE80211_POLICY_MODULE(policy, name, version) \ #define _IEEE80211_POLICY_MODULE(policy, name, version) \
typedef void (*policy##_setup)(int); \ typedef void (*policy##_setup)(int); \
SET_DECLARE(policy##_set, policy##_setup); \ SET_DECLARE(policy##_set, policy##_setup);
/* /*
* Scanner modules provide scanning policy. * Scanner modules provide scanning policy.
*/ */
#define IEEE80211_SCANNER_MODULE(name, version) \ #define IEEE80211_SCANNER_MODULE(name, version)
_IEEE80211_POLICY_MODULE(scanner, name, version) #define IEEE80211_SCANNER_ALG(name, alg, v)
void ieee80211_scan_sta_init(void);
void ieee80211_scan_sta_uninit(void);
#define IEEE80211_SCANNER_ALG(name, alg, v) \
static void \
name##_modevent(int type) \
{ \
if (type == MOD_LOAD) \
ieee80211_scanner_register(alg, &v); \
else \
ieee80211_scanner_unregister(alg, &v); \
} \
TEXT_SET(scanner_set, name##_modevent); \
struct ieee80211req; struct ieee80211req;
typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *, typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
@@ -117,8 +117,9 @@ ieee80211_scan_attach(struct ieee80211com *ic)
ic->ic_scan_curchan = scan_curchan; ic->ic_scan_curchan = scan_curchan;
ic->ic_scan_mindwell = scan_mindwell; ic->ic_scan_mindwell = scan_mindwell;
#if defined(__HAIKU__)
ieee80211_scan_sta_init(); ieee80211_scan_sta_init();
#endif
} }
void void
@@ -142,6 +143,11 @@ ieee80211_scan_detach(struct ieee80211com *ic)
ic->ic_scan = NULL; ic->ic_scan = NULL;
free(SCAN_PRIVATE(ss), M_80211_SCAN); free(SCAN_PRIVATE(ss), M_80211_SCAN);
} }
#if defined(__HAIKU__)
ieee80211_scan_sta_uninit();
#endif
} }
static const struct ieee80211_roamparam defroam[IEEE80211_MODE_MAX] = { static const struct ieee80211_roamparam defroam[IEEE80211_MODE_MAX] = {
@@ -123,7 +123,6 @@ struct ieee80211_scan_state {
#define IEEE80211_SCAN_NOSSID 0x80000000 /* don't update ssid list */ #define IEEE80211_SCAN_NOSSID 0x80000000 /* don't update ssid list */
struct ieee80211com; struct ieee80211com;
void ieee80211_scan_sta_init(void);
void ieee80211_scan_attach(struct ieee80211com *); void ieee80211_scan_attach(struct ieee80211com *);
void ieee80211_scan_detach(struct ieee80211com *); void ieee80211_scan_detach(struct ieee80211com *);
void ieee80211_scan_vattach(struct ieee80211vap *); void ieee80211_scan_vattach(struct ieee80211vap *);
@@ -1450,12 +1450,6 @@ static const struct ieee80211_scanner sta_default = {
.scan_assoc_success = sta_assoc_success, .scan_assoc_success = sta_assoc_success,
}; };
void ieee80211_scan_sta_init()
{
ieee80211_scanner_register(IEEE80211_M_STA, &sta_default);
}
/* /*
* Adhoc mode-specific support. * Adhoc mode-specific support.
*/ */
@@ -1929,3 +1923,19 @@ static const struct ieee80211_scanner mesh_default = {
}; };
IEEE80211_SCANNER_ALG(mesh, IEEE80211_M_MBSS, mesh_default); IEEE80211_SCANNER_ALG(mesh, IEEE80211_M_MBSS, mesh_default);
#endif /* IEEE80211_SUPPORT_MESH */ #endif /* IEEE80211_SUPPORT_MESH */
#if defined(__HAIKU__)
void
ieee80211_scan_sta_init()
{
ieee80211_scanner_register(IEEE80211_M_STA, &sta_default);
ieee80211_scanner_register(IEEE80211_M_IBSS, &adhoc_default);
}
void
ieee80211_scan_sta_uninit()
{
ieee80211_scanner_unregister(IEEE80211_M_STA, &sta_default);
ieee80211_scanner_unregister(IEEE80211_M_IBSS, &adhoc_default);
}
#endif /* __HAIKU__ */