xref: /haiku/src/tests/system/network/tcp_shell/pcap.h (revision 1322e37a03386ffe6321ca3fbb03bd3c4e443074)
1 /*
2  * Copyright 2023, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef PCAP_H
6 #define PCAP_H
7 
8 #include <SupportDefs.h>
9 
10 
11 struct pcap_header {
12 	uint32 magic;
13 	uint16 version_major;
14 	uint16 version_minor;
15 	int32  timezone;
16 	uint32 timestamp_accuracy;
17 	uint32 max_packet_length;
18 	uint32 linktype;
19 } _PACKED;
20 
21 #define PCAP_MAGIC	(0xa1b2c3d4)
22 
23 #define PCAP_LINKTYPE_RAW		(101)		/* Raw IPv4/IPv6 */
24 #define PCAP_LINKTYPE_IPV4		(228)
25 #define PCAP_LINKTYPE_IPV6		(229)
26 
27 
28 struct pcap_packet_header {
29 	uint32 ts_sec;
30 	uint32 ts_usec;
31 	uint32 included_len;
32 	uint32 original_len;
33 } _PACKED;
34 
35 
36 #endif	// PCAP_H
37