edit_packet.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 _EDIT_PACKETS_H_
  20. #define _EDIT_PACKETS_H_
  21. #include "tcpedit.h"
  22. #include "common.h"
  23. int untrunc_packet(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr,
  24. u_char **pktdata, ipv4_hdr_t *ip_hdr, ipv6_hdr_t *ip6_hdr);
  25. int randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr,
  26. u_char *pktdata, ipv4_hdr_t *ip_hdr, const int l3len);
  27. int randomize_ipv6(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr,
  28. u_char *pktdata, ipv6_hdr_t *ip_hdr, const int l3len);
  29. int randomize_iparp(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr,
  30. u_char *pktdata, int datalink, const int l3len);
  31. int fix_ipv4_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr,
  32. ipv4_hdr_t *ip_hdr);
  33. int fix_ipv6_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr,
  34. ipv6_hdr_t *ip_hdr);
  35. void fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr);
  36. void fix_ipv6_length(struct pcap_pkthdr *pkthdr, ipv6_hdr_t *ip6_hdr);
  37. int extract_data(tcpedit_t *tcpedit, const u_char *pktdata,
  38. int caplen, char *l7data[]);
  39. int rewrite_ipv4l3(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, tcpr_dir_t direction,
  40. int l3len);
  41. int rewrite_ipv6l3(tcpedit_t *tcpedit, ipv6_hdr_t *ip_hdr, tcpr_dir_t direction,
  42. int l3len);
  43. int rewrite_iparp(tcpedit_t *tcpedit, arp_hdr_t *arp_hdr, int direction);
  44. int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr);
  45. int rewrite_ipv6_hlim(tcpedit_t *tcpedit, ipv6_hdr_t *ip6_hdr);
  46. #define BROADCAST_IP 4294967295
  47. #endif