tcpprep_api.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2022 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 "config.h"
  22. #include "tcpreplay_api.h"
  23. #include <regex.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* default ports used for servers */
  28. #define DEFAULT_LOW_SERVER_PORT 0
  29. #define DEFAULT_HIGH_SERVER_PORT 1023
  30. #define MYARGS_LEN 1024
  31. typedef struct tcpprep_opt_s {
  32. pcap_t *pcap;
  33. #ifdef ENABLE_VERBOSE
  34. bool verbose;
  35. char *tcpdump_args;
  36. #endif
  37. tcpr_cache_t *cachedata;
  38. tcpr_cidr_t *cidrdata;
  39. char *maclist;
  40. tcpr_xX_t xX;
  41. tcpr_bpf_t bpf;
  42. tcpr_services_t services;
  43. char *comment; /* cache file comment */
  44. bool nocomment; /* don't include the cli in the comment */
  45. tcpprep_mode_t mode; /* our overall mode */
  46. tcpprep_mode_t automode; /* our auto mode */
  47. int min_mask;
  48. int max_mask;
  49. double ratio;
  50. regex_t preg;
  51. bool nonip;
  52. } tcpprep_opt_t;
  53. typedef struct tcpprep_s {
  54. tcpprep_opt_t *options;
  55. char *outfile;
  56. char *pcapfile;
  57. char errstr[TCPREPLAY_ERRSTR_LEN];
  58. char warnstr[TCPREPLAY_ERRSTR_LEN];
  59. #ifdef ENABLE_VERBOSE
  60. tcpdump_t tcpdump;
  61. #endif
  62. } tcpprep_t;
  63. _U_ char *tcpprep_geterr(tcpprep_t *);
  64. _U_ char *tcpprep_getwarn(tcpprep_t *);
  65. tcpprep_t *tcpprep_init();
  66. void tcpprep_close(tcpprep_t *);
  67. int tcpprep_post_args(tcpprep_t *, int, char *[]);
  68. #ifdef __cplusplus
  69. }
  70. #endif