tcpreplay.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* $Id: tcpreplay.h 2047 2008-05-22 22:09:51Z aturner $ */
  2. /*
  3. * Copyright (c) 2001-2008 Aaron Turner.
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the names of the copyright owners nor the names of its
  16. * contributors may be used to endorse or promote products derived from
  17. * this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  20. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  21. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  23. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  25. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  27. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  28. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  29. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #ifndef __TCPREPLAY_H__
  32. #define __TCPREPLAY_H__
  33. #include "config.h"
  34. #include "defines.h"
  35. #include "common/sendpacket.h"
  36. #include "common/tcpdump.h"
  37. #include <sys/types.h>
  38. #include <sys/stat.h>
  39. #include <fcntl.h>
  40. #ifdef ENABLE_DMALLOC
  41. #include <dmalloc.h>
  42. #endif
  43. struct packet_cache_s {
  44. struct pcap_pkthdr pkthdr;
  45. u_char *pktdata;
  46. struct packet_cache_s *next;
  47. };
  48. typedef struct packet_cache_s packet_cache_t;
  49. typedef struct {
  50. int index;
  51. int cached;
  52. packet_cache_t *packet_cache;
  53. } file_cache_t;
  54. /* run-time options */
  55. struct tcpreplay_opt_s {
  56. /* input/output */
  57. char *intf1_name;
  58. char *intf2_name;
  59. sendpacket_t *intf1;
  60. sendpacket_t *intf2;
  61. tcpr_speed_t speed;
  62. u_int32_t loop;
  63. int sleep_accel;
  64. /* tcpprep cache data */
  65. COUNTER cache_packets;
  66. char *cachedata;
  67. char *comment; /* tcpprep comment */
  68. /* deal with MTU/packet len issues */
  69. int mtu;
  70. int truncate;
  71. /* accurate mode to use */
  72. int accurate;
  73. #define ACCURATE_NANOSLEEP 0
  74. #define ACCURATE_SELECT 1
  75. #define ACCURATE_RDTSC 2
  76. #define ACCURATE_IOPORT 3
  77. #define ACCURATE_GTOD 4
  78. #define ACCURATE_ABS_TIME 5
  79. char *files[MAX_FILES];
  80. COUNTER limit_send;
  81. #ifdef ENABLE_VERBOSE
  82. /* tcpdump verbose printing */
  83. int verbose;
  84. char *tcpdump_args;
  85. tcpdump_t *tcpdump;
  86. #endif
  87. /* pcap file caching */
  88. int enable_file_cache;
  89. file_cache_t *file_cache;
  90. };
  91. typedef struct tcpreplay_opt_s tcpreplay_opt_t;
  92. #endif
  93. /*
  94. Local Variables:
  95. mode:c
  96. indent-tabs-mode:nil
  97. c-basic-offset:4
  98. End:
  99. */