wme.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. extern inline u16 tsinfo(int tag1d, int contention_based, int direction)
  26. {
  27. return (tag1d << 11) | (contention_based << 7) | (direction << 5) |
  28. (tag1d << 1);
  29. }
  30. struct wme_information_element {
  31. /* required fields for WME version 1 */
  32. u8 oui[3];
  33. u8 oui_type;
  34. u8 oui_subtype;
  35. u8 version;
  36. u8 acInfo;
  37. } __attribute__ ((packed));
  38. struct wme_ac_parameter {
  39. #if __BYTE_ORDER == __LITTLE_ENDIAN
  40. /* byte 1 */
  41. u8 aifsn:4,
  42. acm:1,
  43. aci:2,
  44. reserved:1;
  45. /* byte 2 */
  46. u8 eCWmin:4,
  47. eCWmax:4;
  48. #elif __BYTE_ORDER == __BIG_ENDIAN
  49. /* byte 1 */
  50. u8 reserved:1,
  51. aci:2,
  52. acm:1,
  53. aifsn:4;
  54. /* byte 2 */
  55. u8 eCWmax:4,
  56. eCWmin:4;
  57. #else
  58. #error "Please fix <endian.h>"
  59. #endif
  60. /* bytes 3 & 4 */
  61. le16 txopLimit;
  62. } __attribute__ ((packed));
  63. struct wme_parameter_element {
  64. /* required fields for WME version 1 */
  65. u8 oui[3];
  66. u8 oui_type;
  67. u8 oui_subtype;
  68. u8 version;
  69. u8 acInfo;
  70. u8 reserved;
  71. struct wme_ac_parameter ac[4];
  72. } __attribute__ ((packed));
  73. struct wme_tspec_info_element {
  74. u8 eid;
  75. u8 length;
  76. u8 oui[3];
  77. u8 oui_type;
  78. u8 oui_subtype;
  79. u8 version;
  80. u16 ts_info;
  81. u16 nominal_msdu_size;
  82. u16 maximum_msdu_size;
  83. u32 minimum_service_interval;
  84. u32 maximum_service_interval;
  85. u32 inactivity_interval;
  86. u32 start_time;
  87. u32 minimum_data_rate;
  88. u32 mean_data_rate;
  89. u32 maximum_burst_size;
  90. u32 minimum_phy_rate;
  91. u32 peak_data_rate;
  92. u32 delay_bound;
  93. u16 surplus_bandwidth_allowance;
  94. u16 medium_time;
  95. } __attribute__ ((packed));
  96. /* Access Categories */
  97. enum {
  98. WME_AC_BK = 1,
  99. WME_AC_BE = 0,
  100. WME_AC_VI = 2,
  101. WME_AC_VO = 3
  102. };
  103. struct ieee80211_mgmt;
  104. u8 * hostapd_eid_wme(struct hostapd_data *hapd, u8 *eid);
  105. int hostapd_eid_wme_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
  106. #ifdef NEED_MLME
  107. int hostapd_wme_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
  108. #else /* NEED_MLME */
  109. static inline int hostapd_wme_sta_config(struct hostapd_data *hapd,
  110. struct sta_info *sta)
  111. {
  112. return 0;
  113. }
  114. #endif /* NEED_MLME */
  115. void hostapd_wme_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
  116. size_t len);
  117. #endif /* WME_H */