tcpbridge.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* $Id: tcpbridge.h 1462 2006-04-13 05:10:27Z aturner $ */
  2. /*
  3. * Copyright (c) 2005 Aaron Turner <aturner@pobox.com>.
  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 __TCPBRIDGE_H__
  32. #define __TCPBRIDGE_H__
  33. #include "config.h"
  34. #include "defines.h"
  35. #include "common.h"
  36. #include "tcpedit/tcpedit.h"
  37. #include <sys/types.h>
  38. #include <sys/stat.h>
  39. #include <fcntl.h>
  40. #include <regex.h>
  41. /* run-time options */
  42. struct tcpbridge_opt_s {
  43. char *intf1;
  44. char *intf2;
  45. libnet_t *send1;
  46. libnet_t *send2;
  47. /* truncate packet ? */
  48. int truncate;
  49. COUNTER limit_send;
  50. pcap_t *listen1;
  51. pcap_t *listen2;
  52. int unidir;
  53. int snaplen;
  54. int to_ms;
  55. int promisc;
  56. int poll_timeout;
  57. #ifdef HAVE_TCPDUMP
  58. /* tcpdump verbose printing */
  59. int verbose;
  60. char *tcpdump_args;
  61. tcpdump_t *tcpdump;
  62. #endif
  63. /* rewrite src/dst MAC addresses */
  64. tcpr_macaddr_t intf1_dmac;
  65. tcpr_macaddr_t intf1_smac;
  66. tcpr_macaddr_t intf2_dmac;
  67. tcpr_macaddr_t intf2_smac;
  68. int mac_mask;
  69. #define SMAC1 0x1
  70. #define SMAC2 0x2
  71. #define DMAC1 0x4
  72. #define DMAC2 0x8
  73. /* rewrite tcp/udp ports */
  74. tcpedit_portmap_t *portmap;
  75. /* rewrite end-point IP addresses between cidrmap1 & cidrmap2 */
  76. tcpr_cidrmap_t *cidrmap1;
  77. tcpr_cidrmap_t *cidrmap2;
  78. /* filter options */
  79. tcpr_xX_t xX;
  80. tcpr_bpf_t bpf;
  81. regex_t preg;
  82. tcpr_cidr_t *cidrdata;
  83. /* required for rewrite_l2.c */
  84. l2_t l2;
  85. #define FIXLEN_PAD 1
  86. #define FIXLEN_TRUNC 2
  87. int fixlen;
  88. int mtu;
  89. int maxpacket;
  90. int fixcsum;
  91. /* 802.1q vlan stuff */
  92. #define VLAN_DEL 1 /* strip 802.1q and rewrite as standard 802.3 Ethernet */
  93. #define VLAN_ADD 2 /* add/replace 802.1q vlan tag */
  94. int vlan;
  95. u_int16_t l2proto;
  96. u_int16_t l2_mem_align; /* keep things 4 byte aligned */
  97. };
  98. typedef struct tcpbridge_opt_s tcpbridge_opt_t;
  99. #endif
  100. /*
  101. Local Variables:
  102. mode:c
  103. indent-tabs-mode:nil
  104. c-basic-offset:4
  105. End:
  106. */