edit_packet.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* $Id$ */
  2. /*
  3. * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
  4. * Copyright (c) 2013-2024 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. #pragma once
  20. #include "common.h"
  21. #include "tcpedit.h"
  22. int untrunc_packet(tcpedit_t *tcpedit,
  23. struct pcap_pkthdr *pkthdr,
  24. u_char **pktdata,
  25. ipv4_hdr_t *ip_hdr,
  26. ipv6_hdr_t *ip6_hdr);
  27. int
  28. randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr, const u_char *pktdata, ipv4_hdr_t *ip_hdr, int l3len);
  29. int
  30. randomize_ipv6(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr, const u_char *pktdata, ipv6_hdr_t *ip_hdr, int l3len);
  31. int randomize_iparp(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, const u_char *pktdata, int datalink, int l3len);
  32. int fix_ipv4_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr, ipv4_hdr_t *ip_hdr, size_t l2len);
  33. int fix_ipv6_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr, ipv6_hdr_t *ip_hdr, size_t l2len);
  34. int fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr, size_t l2len);
  35. int fix_ipv6_length(struct pcap_pkthdr *pkthdr, ipv6_hdr_t *ip6_hdr, size_t l2len);
  36. int extract_data(tcpedit_t *tcpedit, const u_char *pktdata, int caplen, char *l7data[]);
  37. int rewrite_ipv4l3(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, tcpr_dir_t direction, int l3len);
  38. int rewrite_ipv6l3(tcpedit_t *tcpedit, ipv6_hdr_t *ip_hdr, tcpr_dir_t direction, int l3len);
  39. int rewrite_iparp(tcpedit_t *tcpedit, arp_hdr_t *arp_hdr, int direction);
  40. int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr);
  41. int rewrite_ipv6_hlim(tcpedit_t *tcpedit, ipv6_hdr_t *ip6_hdr);
  42. int extract_ipv4_multicast_mac(tcpedit_t *tcpedit, uint32_t ip, u_char *mac[ETHER_ADDR_LEN]);
  43. int extract_ipv6_multicast_mac(tcpedit_t *tcpedit, struct tcpr_in6_addr *ip6, u_char *mac[ETHER_ADDR_LEN]);
  44. #define BROADCAST_IP 4294967295