1 /* $Id$ */
2 
3 /*
4  *   Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net>
5  *   Copyright (c) 2013-2018 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 
21 #ifndef __GET_H__
22 #define __GET_H__
23 
24 #include "config.h"
25 #include "defines.h"
26 #include "common.h"
27 
28 
29 int get_l2len(const u_char *pktdata, const int datalen, const int datalink);
30 
31 u_int16_t get_l2protocol(const u_char *pktdata, const uint32_t datalen, const int datalink);
32 
33 void *get_layer4_v4(const ipv4_hdr_t *ip_hdr, const int l3len);
34 void *get_layer4_v6(const ipv6_hdr_t *ip_hdr, const int l3len);
35 
36 u_int8_t get_ipv6_l4proto(const ipv6_hdr_t *ip6_hdr, const int l3len);
37 void *get_ipv6_next(struct tcpr_ipv6_ext_hdr_base *exthdr, const int l3len);
38 
39 const u_char *get_ipv4(const u_char *pktdata, int datalen, int datalink, u_char **newbuff);
40 const u_char *get_ipv6(const u_char *pktdata, int datalen, int datalink, u_char **newbuff);
41 
42 u_int32_t get_name2addr4(const char *hostname, bool dnslookup);
43 const char *get_addr2name4(const u_int32_t ip, bool dnslookup);
44 const char *get_addr2name6(const struct tcpr_in6_addr *addr, bool dnslookup);
45 const char *get_pcap_version(void);
46 
47 int get_name2addr6(const char *hostname, bool dnslookup, struct tcpr_in6_addr *addr);
48 
49 
50 const char *get_cidr2name(const tcpr_cidr_t *cidr_ptr, bool dnslookup);
51 
52 
53 #endif
54