main.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Exports from main to helper modules
  2. *
  3. * See copyright notice in main.c
  4. */
  5. #ifndef _ORINOCO_MAIN_H_
  6. #define _ORINOCO_MAIN_H_
  7. #include <linux/ieee80211.h>
  8. #include "orinoco.h"
  9. /********************************************************************/
  10. /* Compile time configuration and compatibility stuff */
  11. /********************************************************************/
  12. /* We do this this way to avoid ifdefs in the actual code */
  13. #ifdef WIRELESS_SPY
  14. #define SPY_NUMBER(priv) (priv->spy_data.spy_number)
  15. #else
  16. #define SPY_NUMBER(priv) 0
  17. #endif /* WIRELESS_SPY */
  18. /********************************************************************/
  19. /* Export module parameter */
  20. extern int force_monitor;
  21. /* Forward declarations */
  22. struct net_device;
  23. struct work_struct;
  24. void set_port_type(struct orinoco_private *priv);
  25. int __orinoco_program_rids(struct net_device *dev);
  26. void orinoco_reset(struct work_struct *work);
  27. /* Information element helpers - find a home for these... */
  28. static inline u8 *orinoco_get_ie(u8 *data, size_t len,
  29. enum ieee80211_eid eid)
  30. {
  31. u8 *p = data;
  32. while ((p + 2) < (data + len)) {
  33. if (p[0] == eid)
  34. return p;
  35. p += p[1] + 2;
  36. }
  37. return NULL;
  38. }
  39. #define WPA_OUI_TYPE "\x00\x50\xF2\x01"
  40. #define WPA_SELECTOR_LEN 4
  41. static inline u8 *orinoco_get_wpa_ie(u8 *data, size_t len)
  42. {
  43. u8 *p = data;
  44. while ((p + 2 + WPA_SELECTOR_LEN) < (data + len)) {
  45. if ((p[0] == WLAN_EID_GENERIC) &&
  46. (memcmp(&p[2], WPA_OUI_TYPE, WPA_SELECTOR_LEN) == 0))
  47. return p;
  48. p += p[1] + 2;
  49. }
  50. return NULL;
  51. }
  52. #endif /* _ORINOCO_MAIN_H_ */