raw.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_raw_H_
  20. #define _DLT_raw_H_
  21. #include "plugins_types.h"
  22. int dlt_raw_register(tcpeditdlt_t *ctx);
  23. int dlt_raw_init(tcpeditdlt_t *ctx);
  24. int dlt_raw_cleanup(tcpeditdlt_t *ctx);
  25. int dlt_raw_parse_opts(tcpeditdlt_t *ctx);
  26. int dlt_raw_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  27. int dlt_raw_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir);
  28. int dlt_raw_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  29. u_char *dlt_raw_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen);
  30. u_char *dlt_raw_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data);
  31. tcpeditdlt_l2addr_type_t dlt_raw_l2addr_type(void);
  32. int dlt_raw_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen);
  33. u_char *dlt_raw_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen);
  34. /*
  35. * structure to hold any data parsed from the packet by the decoder.
  36. * Example: Ethernet VLAN tag info
  37. */
  38. struct raw_extra_s {
  39. u_char packet[MAXPACKET];
  40. };
  41. typedef struct raw_extra_s raw_extra_t;
  42. /*
  43. * FIXME: structure to hold any data in the tcpeditdlt_plugin_t->config
  44. * Things like:
  45. * - Parsed user options
  46. * - State between packets
  47. * - Note, you should only use this for the encoder function, decoder functions should place
  48. * "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that
  49. * is available to any encoder plugin.
  50. */
  51. struct raw_config_s {
  52. /* dummy entry for SunPro compiler which doesn't like empty structs */
  53. int dummy;
  54. };
  55. typedef struct raw_config_s raw_config_t;
  56. #endif