1
0

radiotap.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2022 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_radiotap_H_
  20. #define _DLT_radiotap_H_
  21. #include "plugins_types.h"
  22. int dlt_radiotap_register(tcpeditdlt_t *ctx);
  23. int dlt_radiotap_init(tcpeditdlt_t *ctx);
  24. int dlt_radiotap_cleanup(tcpeditdlt_t *ctx);
  25. int dlt_radiotap_parse_opts(tcpeditdlt_t *ctx);
  26. int dlt_radiotap_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  27. int dlt_radiotap_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir);
  28. int dlt_radiotap_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  29. u_char *dlt_radiotap_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen);
  30. u_char *dlt_radiotap_merge_layer3(tcpeditdlt_t *ctx,
  31. u_char *packet,
  32. const int pktlen,
  33. u_char *ipv4_data,
  34. u_char *ipv6_data);
  35. tcpeditdlt_l2addr_type_t dlt_radiotap_l2addr_type(void);
  36. int dlt_radiotap_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  37. int dlt_radiotap_80211_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  38. u_char *dlt_radiotap_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen);
  39. /*
  40. * FIXME: structure to hold any data parsed from the packet by the decoder.
  41. * Example: Ethernet VLAN tag info
  42. */
  43. struct radiotap_extra_s {
  44. u_char packet[MAXPACKET];
  45. };
  46. typedef struct radiotap_extra_s radiotap_extra_t;
  47. /*
  48. * FIXME: structure to hold any data in the tcpeditdlt_plugin_t->config
  49. * Things like:
  50. * - Parsed user options
  51. * - State between packets
  52. * - Note, you should only use this for the encoder function, decoder functions should place
  53. * "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that
  54. * is available to any encoder plugin.
  55. */
  56. struct radiotap_config_s {
  57. /* dummy entry for SunPro compiler which doesn't like empty structs */
  58. int dummy;
  59. };
  60. typedef struct radiotap_config_s radiotap_config_t;
  61. /* note, all radiotap_hdr fields are in LITTLE endian! WTF??? */
  62. struct radiotap_hdr_s {
  63. u_int8_t version;
  64. u_int8_t pad;
  65. u_int16_t length; /* total header length */
  66. u_int32_t present; /* flags of present headers */
  67. };
  68. typedef struct radiotap_hdr_s radiotap_hdr_t;
  69. #endif