hdlc_types.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2017 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. int hdlc; /* set to 1 if values below are filled out */
  31. u_int8_t address;
  32. u_int8_t control;
  33. } hdlc_extra_t;
  34. /*
  35. * FIXME: structure to hold any data in the tcpeditdlt_plugin_t->config
  36. * Things like:
  37. * - Parsed user options
  38. * - State between packets
  39. * - Note, you should only use this for the encoder function, decoder functions should place
  40. * "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that
  41. * is available to any encoder plugin.
  42. */
  43. typedef struct {
  44. /* user defined values. 65535 == unset */
  45. u_int16_t address;
  46. u_int16_t control;
  47. } hdlc_config_t;
  48. /* Cisco HDLC has a simple 32 bit header */
  49. #define CISCO_HDLC_LEN 4
  50. typedef struct {
  51. u_int8_t address;
  52. #define CISCO_HDLC_ADDR_UNICAST 0x0F
  53. #define CISCO_HDLC_ADDR_BROADCAST 0x8F
  54. u_int8_t control; // always zero
  55. u_int16_t protocol;
  56. } cisco_hdlc_t;
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif