tcpedit.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2024 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. #pragma once
  20. #include "defines.h"
  21. #include "common.h"
  22. #include "parse_args.h"
  23. #include "plugins.h"
  24. #include "tcpedit_api.h"
  25. #include "tcpedit_types.h"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /**
  30. * libtcpedit common API
  31. */
  32. int tcpedit_init(tcpedit_t **tcpedit_ex, int dlt);
  33. char *tcpedit_geterr(tcpedit_t *tcpedit);
  34. char *tcpedit_getwarn(tcpedit_t *tcpedit);
  35. int tcpedit_checkerror(tcpedit_t *tcpedit, int rcode, const char *prefix);
  36. int tcpedit_validate(tcpedit_t *tcpedit);
  37. int tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr, u_char **pktdata, tcpr_dir_t direction);
  38. int tcpedit_close(tcpedit_t **tcpedit_ex);
  39. int tcpedit_get_output_dlt(tcpedit_t *tcpedit);
  40. const u_char *tcpedit_l3data(tcpedit_t *tcpedit, tcpedit_coder code, u_char *packet, int pktlen);
  41. int tcpedit_l3proto(tcpedit_t *tcpedit, tcpedit_coder code, const u_char *packet, int pktlen);
  42. COUNTER tcpedit_get_total_bytes(tcpedit_t *tcpedit);
  43. COUNTER tcpedit_get_pkts_edited(tcpedit_t *tcpedit);
  44. /**
  45. * These functions are seen by the outside world, but nobody should ever use them
  46. * outside of internal tcpedit functions
  47. */
  48. #define tcpedit_seterr(x, y, ...) __tcpedit_seterr(x, __FUNCTION__, __LINE__, __FILE__, y, __VA_ARGS__)
  49. void __tcpedit_seterr(tcpedit_t *tcpedit, const char *func, int line, const char *file, const char *fmt, ...);
  50. void tcpedit_setwarn(tcpedit_t *tcpedit, const char *fmt, ...);
  51. #ifdef __cplusplus
  52. }
  53. #endif