fragroute.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
  4. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  5. * Copyright (c) 2013-2025 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
  6. *
  7. * The Tcpreplay Suite of tools is free software: you can redistribute it
  8. * and/or modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or with the authors permission any later version.
  11. *
  12. * The Tcpreplay Suite is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #pragma once
  21. #include "config.h"
  22. #include "pkt.h"
  23. #define FRAGROUTE_ERRBUF_LEN 1024
  24. /* Fragroute context. */
  25. struct fragroute_s {
  26. struct addr src;
  27. struct addr dst;
  28. struct addr smac;
  29. struct addr dmac;
  30. int dlt;
  31. int mtu;
  32. int first_packet; /* have we called getfragment() yet after process()? */
  33. int l2len;
  34. u_char l2header[50];
  35. char errbuf[FRAGROUTE_ERRBUF_LEN];
  36. struct pktq *pktq; /* packet chain */
  37. };
  38. typedef struct fragroute_s fragroute_t;
  39. int fragroute_process(fragroute_t *ctx, void *buf, size_t len);
  40. int fragroute_getfragment(fragroute_t *ctx, char **packet);
  41. fragroute_t *fragroute_init(const int mtu, const int dlt, const char *config, char *errbuf);
  42. void fragroute_close(fragroute_t *ctx);