wme.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * hostapd / WMM (Wi-Fi Multimedia)
  3. * Copyright 2002-2003, Instant802 Networks, Inc.
  4. * Copyright 2005-2006, Devicescape Software, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Alternatively, this software may be distributed under the terms of BSD
  11. * license.
  12. *
  13. * See README and COPYING for more details.
  14. */
  15. #ifndef WME_H
  16. #define WME_H
  17. #ifdef __linux__
  18. #include <endian.h>
  19. #endif /* __linux__ */
  20. #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
  21. #include <sys/types.h>
  22. #include <sys/endian.h>
  23. #endif /* defined(__FreeBSD__) || defined(__NetBSD__) ||
  24. * defined(__DragonFly__) */
  25. struct wme_information_element {
  26. /* required fields for WME version 1 */
  27. u8 oui[3];
  28. u8 oui_type;
  29. u8 oui_subtype;
  30. u8 version;
  31. u8 acInfo;
  32. } __attribute__ ((packed));
  33. struct wme_ac_parameter {
  34. #if __BYTE_ORDER == __LITTLE_ENDIAN
  35. /* byte 1 */
  36. u8 aifsn:4,
  37. acm:1,
  38. aci:2,
  39. reserved:1;
  40. /* byte 2 */
  41. u8 eCWmin:4,
  42. eCWmax:4;
  43. #elif __BYTE_ORDER == __BIG_ENDIAN
  44. /* byte 1 */
  45. u8 reserved:1,
  46. aci:2,
  47. acm:1,
  48. aifsn:4;
  49. /* byte 2 */
  50. u8 eCWmax:4,
  51. eCWmin:4;
  52. #else
  53. #error "Please fix <endian.h>"
  54. #endif
  55. /* bytes 3 & 4 */
  56. le16 txopLimit;
  57. } __attribute__ ((packed));
  58. struct wme_parameter_element {
  59. /* required fields for WME version 1 */
  60. u8 oui[3];
  61. u8 oui_type;
  62. u8 oui_subtype;
  63. u8 version;
  64. u8 acInfo;
  65. u8 reserved;
  66. struct wme_ac_parameter ac[4];
  67. } __attribute__ ((packed));
  68. struct wme_tspec_info_element {
  69. u8 eid;
  70. u8 length;
  71. u8 oui[3];
  72. u8 oui_type;
  73. u8 oui_subtype;
  74. u8 version;
  75. u16 ts_info;
  76. u16 nominal_msdu_size;
  77. u16 maximum_msdu_size;
  78. u32 minimum_service_interval;
  79. u32 maximum_service_interval;
  80. u32 inactivity_interval;
  81. u32 start_time;
  82. u32 minimum_data_rate;
  83. u32 mean_data_rate;
  84. u32 maximum_burst_size;
  85. u32 minimum_phy_rate;
  86. u32 peak_data_rate;
  87. u32 delay_bound;
  88. u16 surplus_bandwidth_allowance;
  89. u16 medium_time;
  90. } __attribute__ ((packed));
  91. /* Access Categories */
  92. enum {
  93. WME_AC_BK = 1,
  94. WME_AC_BE = 0,
  95. WME_AC_VI = 2,
  96. WME_AC_VO = 3
  97. };
  98. struct ieee80211_mgmt;
  99. u8 * hostapd_eid_wme(struct hostapd_data *hapd, u8 *eid);
  100. int hostapd_eid_wme_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
  101. #ifdef NEED_MLME
  102. int hostapd_wme_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
  103. #else /* NEED_MLME */
  104. static inline int hostapd_wme_sta_config(struct hostapd_data *hapd,
  105. struct sta_info *sta)
  106. {
  107. return 0;
  108. }
  109. #endif /* NEED_MLME */
  110. void hostapd_wme_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
  111. size_t len);
  112. #endif /* WME_H */