ieee802_11_common.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * IEEE 802.11 Common routines
  3. * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #ifndef IEEE802_11_COMMON_H
  15. #define IEEE802_11_COMMON_H
  16. /* Parsed Information Elements */
  17. struct ieee802_11_elems {
  18. const u8 *ssid;
  19. const u8 *supp_rates;
  20. const u8 *fh_params;
  21. const u8 *ds_params;
  22. const u8 *cf_params;
  23. const u8 *tim;
  24. const u8 *ibss_params;
  25. const u8 *challenge;
  26. const u8 *erp_info;
  27. const u8 *ext_supp_rates;
  28. const u8 *wpa_ie;
  29. const u8 *rsn_ie;
  30. const u8 *wmm; /* WMM Information or Parameter Element */
  31. const u8 *wmm_tspec;
  32. const u8 *wps_ie;
  33. const u8 *power_cap;
  34. const u8 *supp_channels;
  35. const u8 *mdie;
  36. const u8 *ftie;
  37. const u8 *timeout_int;
  38. const u8 *ht_capabilities;
  39. const u8 *ht_operation;
  40. const u8 *vendor_ht_cap;
  41. const u8 *p2p;
  42. const u8 *link_id;
  43. u8 ssid_len;
  44. u8 supp_rates_len;
  45. u8 fh_params_len;
  46. u8 ds_params_len;
  47. u8 cf_params_len;
  48. u8 tim_len;
  49. u8 ibss_params_len;
  50. u8 challenge_len;
  51. u8 erp_info_len;
  52. u8 ext_supp_rates_len;
  53. u8 wpa_ie_len;
  54. u8 rsn_ie_len;
  55. u8 wmm_len; /* 7 = WMM Information; 24 = WMM Parameter */
  56. u8 wmm_tspec_len;
  57. u8 wps_ie_len;
  58. u8 power_cap_len;
  59. u8 supp_channels_len;
  60. u8 mdie_len;
  61. u8 ftie_len;
  62. u8 timeout_int_len;
  63. u8 ht_capabilities_len;
  64. u8 ht_operation_len;
  65. u8 vendor_ht_cap_len;
  66. u8 p2p_len;
  67. };
  68. typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
  69. ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
  70. struct ieee802_11_elems *elems,
  71. int show_errors);
  72. int ieee802_11_ie_count(const u8 *ies, size_t ies_len);
  73. struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
  74. u32 oui_type);
  75. struct ieee80211_hdr;
  76. const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len);
  77. #endif /* IEEE802_11_COMMON_H */