tcpedit.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 _TCPEDIT_H_
  20. #define _TCPEDIT_H_
  21. #include "defines.h"
  22. #include "common.h"
  23. #include "tcpedit_types.h"
  24. #include "tcpedit_api.h"
  25. #include "parse_args.h"
  26. #include "plugins.h"
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**
  31. * libtcpedit common API
  32. */
  33. int tcpedit_init(tcpedit_t **tcpedit_ex, int dlt);
  34. char *tcpedit_geterr(tcpedit_t *tcpedit);
  35. char *tcpedit_getwarn(tcpedit_t *tcpedit);
  36. int tcpedit_checkerror(tcpedit_t *tcpedit, const int rcode, const char *prefix);
  37. int tcpedit_validate(tcpedit_t *tcpedit);
  38. int tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
  39. u_char **pktdata, tcpr_dir_t direction);
  40. int tcpedit_close(tcpedit_t *tcpedit);
  41. int tcpedit_get_output_dlt(tcpedit_t *tcpedit);
  42. const u_char *tcpedit_l3data(tcpedit_t *tcpedit, tcpedit_coder code, u_char *packet, const int pktlen);
  43. int tcpedit_l3proto(tcpedit_t *tcpedit, tcpedit_coder code, const u_char *packet, const int pktlen);
  44. COUNTER tcpedit_get_total_bytes(tcpedit_t *tcpedit);
  45. COUNTER tcpedit_get_pkts_edited(tcpedit_t *tcpedit);
  46. /*
  47. u_char *tcpedit_srcmac(tcpedit_t *tcpedit, tcpedit_coder code, u_char *packet, const int pktlen);
  48. u_char *tcpedit_dstmac(tcpedit_t *tcpedit, tcpedit_coder code, u_char *packet, const int pktlen);
  49. int tcpedit_maclen(tcpedit_t *tcpedit, tcpedit_coder code);
  50. */
  51. /**
  52. * These functions are seen by the outside world, but nobody should ever use them
  53. * outside of internal tcpedit functions
  54. */
  55. #define tcpedit_seterr(x, y, ...) __tcpedit_seterr(x, __FUNCTION__, __LINE__, __FILE__, y, __VA_ARGS__)
  56. void __tcpedit_seterr(tcpedit_t *tcpedit, const char *func, const int line, const char *file, const char *fmt, ...);
  57. void tcpedit_setwarn(tcpedit_t *tcpedit, const char *fmt, ...);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif