hdlc_types.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_hdlc_TYPES_H_
  20. #define _DLT_hdlc_TYPES_H_
  21. #include "plugins_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /*
  26. * structure to hold any data parsed from the packet by the decoder.
  27. * Example: Ethernet VLAN tag info
  28. */
  29. typedef struct {
  30. union {
  31. struct {
  32. int hdlc; /* set to 1 if values below are filled out */
  33. u_int8_t address;
  34. u_int8_t control;
  35. };
  36. u_char packet[MAXPACKET];
  37. };
  38. } hdlc_extra_t;
  39. /*
  40. * FIXME: structure to hold any data in the tcpeditdlt_plugin_t->config
  41. * Things like:
  42. * - Parsed user options
  43. * - State between packets
  44. * - Note, you should only use this for the encoder function, decoder functions should place
  45. * "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that
  46. * is available to any encoder plugin.
  47. */
  48. typedef struct {
  49. /* user defined values. 65535 == unset */
  50. u_int16_t address;
  51. u_int16_t control;
  52. } hdlc_config_t;
  53. /* Cisco HDLC has a simple 32 bit header */
  54. #define CISCO_HDLC_LEN 4
  55. typedef struct {
  56. u_int8_t address;
  57. #define CISCO_HDLC_ADDR_UNICAST 0x0F
  58. #define CISCO_HDLC_ADDR_BROADCAST 0x8F
  59. u_int8_t control; // always zero
  60. u_int16_t protocol;
  61. } cisco_hdlc_t;
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif