ieee80211_types.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  5. *
  6. * The Tcpreplay Suite of tools is free software: you can redistribute it
  7. * and/or modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or with the authors permission any later version.
  10. *
  11. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _DLT_ieee80211_TYPES_H_
  20. #define _DLT_ieee80211_TYPES_H_
  21. #include "plugins_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* 802.11 packet header w/ 3 addresses (non-WDS) */
  26. typedef struct {
  27. u_int16_t frame_control;
  28. /* version is first two bytes */
  29. #define ieee80211_FC_VERSION_MASK 0x0300
  30. /* type is second 2 bytes */
  31. #define ieee80211_FC_TYPE_MASK 0x0F00
  32. #define ieee80211_FC_TYPE_DATA 0x0800
  33. #define ieee80211_FC_TYPE_MGMT 0x0000
  34. #define ieee80211_FC_TYPE_CONTROL 0x0400
  35. /* subtype is the 4 high bytes */
  36. #define ieee80211_FC_SUBTYPE_MASK 0xF000
  37. #define ieee80211_FC_SUBTYPE_QOS 0x8000 /* high bit is QoS, but there are sub-sub types for QoS */
  38. #define ieee80211_FC_SUBTYPE_NULL 0xC000 /* no data */
  39. /* Direction */
  40. #define ieee80211_FC_TO_DS_MASK 0x0001
  41. #define ieee80211_FC_FROM_DS_MASK 0x0002
  42. /* Flags */
  43. #define ieee80211_FC_MORE_FRAG 0x0004
  44. #define ieee80211_FC_RETRY_MASK 0x0008
  45. #define ieee80211_FC_PWR_MGMT_MASK 0x0010
  46. #define ieee80211_FC_MORE_DATA_MASK 0x0020
  47. #define ieee80211_FC_WEP_MASK 0x0040
  48. #define ieee80211_FC_ORDER_MASK 0x0080
  49. u_int16_t duration;
  50. u_char addr1[6];
  51. u_char addr2[6];
  52. u_char addr3[6];
  53. u_int16_t fragid;
  54. } ieee80211_hdr_t;
  55. typedef struct {
  56. u_int16_t frame_control;
  57. u_int16_t duration;
  58. u_char addr1[6];
  59. u_char addr2[6];
  60. u_char addr3[6];
  61. u_char addr4[6];
  62. u_int16_t fragid;
  63. } ieee80211_addr4_hdr_t;
  64. #define ieee80211_USE_4(frame_control) \
  65. (frame_control & (ieee80211_FC_TO_DS_MASK + ieee80211_FC_FROM_DS_MASK)) == \
  66. (ieee80211_FC_TO_DS_MASK + ieee80211_FC_FROM_DS_MASK)
  67. /*
  68. * FIXME: structure to hold any data parsed from the packet by the decoder.
  69. * Example: Ethernet VLAN tag info
  70. */
  71. typedef struct {
  72. u_char packet[MAXPACKET];
  73. } ieee80211_extra_t;
  74. /*
  75. * FIXME: structure to hold any data in the tcpeditdlt_plugin_t->config
  76. * Things like:
  77. * - Parsed user options
  78. * - State between packets
  79. * - Note, you should only use this for the encoder function, decoder functions should place
  80. * "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that
  81. * is available to any encoder plugin.
  82. */
  83. typedef struct {
  84. /* dummy entry for SunPro compiler which doesn't like empty structs */
  85. int dummy;
  86. } ieee80211_config_t;
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif