wme.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. /*
  26. * WMM Information Element (used in (Re)Association Request frames; may also be
  27. * used in Beacon frames)
  28. */
  29. struct wmm_information_element {
  30. /* Element ID: 221 (0xdd); Length: 7 */
  31. /* required fields for WMM version 1 */
  32. u8 oui[3]; /* 00:50:f2 */
  33. u8 oui_type; /* 2 */
  34. u8 oui_subtype; /* 0 */
  35. u8 version; /* 1 for WMM version 1.0 */
  36. u8 qos_info; /* AP/STA specific QoS info */
  37. } __attribute__ ((packed));
  38. struct wmm_ac_parameter {
  39. #if __BYTE_ORDER == __LITTLE_ENDIAN
  40. /* byte 1: ACI/AIFSN */
  41. u8 aifsn:4,
  42. acm:1,
  43. aci:2,
  44. reserved:1;
  45. /* byte 2: ECWmin/ECWmax (CW = 2^ECW - 1) */
  46. u8 e_cw_min:4,
  47. e_cw_max:4;
  48. #elif __BYTE_ORDER == __BIG_ENDIAN
  49. /* byte 1: ACI/AIFSN */
  50. u8 reserved:1,
  51. aci:2,
  52. acm:1,
  53. aifsn:4;
  54. /* byte 2: ECWmin/ECWmax */
  55. u8 e_cw_max:4,
  56. e_cw_min:4;
  57. #else
  58. #error "Please fix <endian.h>"
  59. #endif
  60. /* bytes 3 & 4 */
  61. le16 txop_limit;
  62. } __attribute__ ((packed));
  63. /*
  64. * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
  65. * Response frmaes)
  66. */
  67. struct wmm_parameter_element {
  68. /* Element ID: 221 (0xdd); Length: 24 */
  69. /* required fields for WMM version 1 */
  70. u8 oui[3]; /* 00:50:f2 */
  71. u8 oui_type; /* 2 */
  72. u8 oui_subtype; /* 1 */
  73. u8 version; /* 1 for WMM version 1.0 */
  74. u8 qos_info; /* AP/STA specif QoS info */
  75. u8 reserved; /* 0 */
  76. struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
  77. } __attribute__ ((packed));
  78. /* WMM TSPEC Element */
  79. struct wmm_tspec_element {
  80. u8 eid; /* 221 = 0xdd */
  81. u8 length; /* 6 + 55 = 61 */
  82. u8 oui[3]; /* 00:50:f2 */
  83. u8 oui_type; /* 2 */
  84. u8 oui_subtype; /* 2 */
  85. u8 version; /* 1 */
  86. /* WMM TSPEC body (55 octets): */
  87. u8 ts_info[3];
  88. le16 nominal_msdu_size;
  89. le16 maximum_msdu_size;
  90. le32 minimum_service_interval;
  91. le32 maximum_service_interval;
  92. le32 inactivity_interval;
  93. le32 suspension_interval;
  94. le32 service_start_time;
  95. le32 minimum_data_rate;
  96. le32 mean_data_rate;
  97. le32 peak_data_rate;
  98. le32 maximum_burst_size;
  99. le32 delay_bound;
  100. le32 minimum_phy_rate;
  101. le16 surplus_bandwidth_allowance;
  102. le16 medium_time;
  103. } __attribute__ ((packed));
  104. /* Access Categories / ACI to AC coding */
  105. enum {
  106. WMM_AC_BE = 0 /* Best Effort */,
  107. WMM_AC_BK = 1 /* Background */,
  108. WMM_AC_VI = 2 /* Video */,
  109. WMM_AC_VO = 3 /* Voice */
  110. };
  111. struct ieee80211_mgmt;
  112. u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
  113. int hostapd_eid_wmm_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
  114. #ifdef NEED_MLME
  115. int hostapd_wmm_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
  116. #else /* NEED_MLME */
  117. static inline int hostapd_wmm_sta_config(struct hostapd_data *hapd,
  118. struct sta_info *sta)
  119. {
  120. return 0;
  121. }
  122. #endif /* NEED_MLME */
  123. void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
  124. size_t len);
  125. #endif /* WME_H */