wme.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. /*
  18. * WMM Information Element (used in (Re)Association Request frames; may also be
  19. * used in Beacon frames)
  20. */
  21. struct wmm_information_element {
  22. /* Element ID: 221 (0xdd); Length: 7 */
  23. /* required fields for WMM version 1 */
  24. u8 oui[3]; /* 00:50:f2 */
  25. u8 oui_type; /* 2 */
  26. u8 oui_subtype; /* 0 */
  27. u8 version; /* 1 for WMM version 1.0 */
  28. u8 qos_info; /* AP/STA specific QoS info */
  29. } __attribute__ ((packed));
  30. #define WMM_AC_AIFSN_MASK 0x0f
  31. #define WMM_AC_AIFNS_SHIFT 0
  32. #define WMM_AC_ACM 0x10
  33. #define WMM_AC_ACI_MASK 0x60
  34. #define WMM_AC_ACI_SHIFT 5
  35. #define WMM_AC_ECWMIN_MASK 0x0f
  36. #define WMM_AC_ECWMIN_SHIFT 0
  37. #define WMM_AC_ECWMAX_MASK 0xf0
  38. #define WMM_AC_ECWMAX_SHIFT 4
  39. struct wmm_ac_parameter {
  40. u8 aci_aifsn; /* AIFSN, ACM, ACI */
  41. u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
  42. le16 txop_limit;
  43. } __attribute__ ((packed));
  44. /*
  45. * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
  46. * Response frmaes)
  47. */
  48. struct wmm_parameter_element {
  49. /* Element ID: 221 (0xdd); Length: 24 */
  50. /* required fields for WMM version 1 */
  51. u8 oui[3]; /* 00:50:f2 */
  52. u8 oui_type; /* 2 */
  53. u8 oui_subtype; /* 1 */
  54. u8 version; /* 1 for WMM version 1.0 */
  55. u8 qos_info; /* AP/STA specif QoS info */
  56. u8 reserved; /* 0 */
  57. struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
  58. } __attribute__ ((packed));
  59. /* WMM TSPEC Element */
  60. struct wmm_tspec_element {
  61. u8 eid; /* 221 = 0xdd */
  62. u8 length; /* 6 + 55 = 61 */
  63. u8 oui[3]; /* 00:50:f2 */
  64. u8 oui_type; /* 2 */
  65. u8 oui_subtype; /* 2 */
  66. u8 version; /* 1 */
  67. /* WMM TSPEC body (55 octets): */
  68. u8 ts_info[3];
  69. le16 nominal_msdu_size;
  70. le16 maximum_msdu_size;
  71. le32 minimum_service_interval;
  72. le32 maximum_service_interval;
  73. le32 inactivity_interval;
  74. le32 suspension_interval;
  75. le32 service_start_time;
  76. le32 minimum_data_rate;
  77. le32 mean_data_rate;
  78. le32 peak_data_rate;
  79. le32 maximum_burst_size;
  80. le32 delay_bound;
  81. le32 minimum_phy_rate;
  82. le16 surplus_bandwidth_allowance;
  83. le16 medium_time;
  84. } __attribute__ ((packed));
  85. /* Access Categories / ACI to AC coding */
  86. enum {
  87. WMM_AC_BE = 0 /* Best Effort */,
  88. WMM_AC_BK = 1 /* Background */,
  89. WMM_AC_VI = 2 /* Video */,
  90. WMM_AC_VO = 3 /* Voice */
  91. };
  92. struct ieee80211_mgmt;
  93. u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
  94. int hostapd_eid_wmm_valid(struct hostapd_data *hapd, u8 *eid, size_t len);
  95. #ifdef NEED_MLME
  96. int hostapd_wmm_sta_config(struct hostapd_data *hapd, struct sta_info *sta);
  97. #else /* NEED_MLME */
  98. static inline int hostapd_wmm_sta_config(struct hostapd_data *hapd,
  99. struct sta_info *sta)
  100. {
  101. return 0;
  102. }
  103. #endif /* NEED_MLME */
  104. void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
  105. size_t len);
  106. #endif /* WME_H */