bridge.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 __BRIDGE_H__
  20. #define __BRIDGE_H__
  21. #include "config.h"
  22. #include "lib/tree.h"
  23. #include "tcpedit/tcpedit.h"
  24. /*
  25. * RBTree node object for tracking which side of tcpreplay where
  26. * each source MAC address lives
  27. */
  28. struct macsrc_t {
  29. RB_ENTRY(macsrc_t) node;
  30. u_char key[ETHER_ADDR_LEN];
  31. u_char source; /* interface device name we first saw the source MAC */
  32. sendpacket_t *sp; /* sendpacket handle to send packets out */
  33. };
  34. /* pri and secondary pcap interfaces */
  35. #define PCAP_INT1 0
  36. #define PCAP_INT2 1
  37. /* our custom pcap_dispatch handler user struct */
  38. struct live_data_t {
  39. u_int32_t linktype;
  40. int l2enabled;
  41. int l2len;
  42. u_char source;
  43. char *l2data;
  44. pcap_t *pcap;
  45. tcpedit_t *tcpedit;
  46. tcpbridge_opt_t *options;
  47. };
  48. void rbinit(void);
  49. void do_bridge(tcpbridge_opt_t *, tcpedit_t *);
  50. #endif