forked from appneta/tcpreplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_packet.h
77 lines (55 loc) · 2.82 KB
/
edit_packet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* $Id$ */
/*
* Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
* Copyright (c) 2013-2022 Fred Klassen <tcpreplay at appneta dot com> - AppNeta
*
* The Tcpreplay Suite of tools is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or with the authors permission any later version.
*
* The Tcpreplay Suite is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Tcpreplay Suite. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _EDIT_PACKETS_H_
#define _EDIT_PACKETS_H_
#include "tcpedit.h"
#include "common.h"
int untrunc_packet(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr,
u_char **pktdata, ipv4_hdr_t *ip_hdr, ipv6_hdr_t *ip6_hdr);
int randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr,
u_char *pktdata, ipv4_hdr_t *ip_hdr, const int l3len);
int randomize_ipv6(tcpedit_t *tcpedit, struct pcap_pkthdr *pktdhr,
u_char *pktdata, ipv6_hdr_t *ip_hdr, const int l3len);
int randomize_iparp(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr,
u_char *pktdata, int datalink, const int l3len);
int fix_ipv4_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr,
ipv4_hdr_t *ip_hdr, const size_t l2len);
int fix_ipv6_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkdhdr,
ipv6_hdr_t *ip_hdr, const size_t l2len);
int fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr,
const size_t l2len);
int fix_ipv6_length(struct pcap_pkthdr *pkthdr, ipv6_hdr_t *ip6_hdr,
const size_t l2len);
int extract_data(tcpedit_t *tcpedit, const u_char *pktdata,
int caplen, char *l7data[]);
int rewrite_ipv4l3(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, tcpr_dir_t direction,
int l3len);
int rewrite_ipv6l3(tcpedit_t *tcpedit, ipv6_hdr_t *ip_hdr, tcpr_dir_t direction,
int l3len);
int rewrite_iparp(tcpedit_t *tcpedit, arp_hdr_t *arp_hdr, int direction);
int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr);
int rewrite_ipv6_hlim(tcpedit_t *tcpedit, ipv6_hdr_t *ip6_hdr);
int extract_ipv4_multicast_mac(tcpedit_t *tcpedit,
uint32_t ip,
u_char *mac[ETHER_ADDR_LEN]);
int extract_ipv6_multicast_mac(tcpedit_t *tcpedit,
struct tcpr_in6_addr *ip6,
u_char *mac[ETHER_ADDR_LEN]);
#define BROADCAST_IP 4294967295
#endif