wme.h 3.2 KB

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