Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
libpcap.h
Go to the documentation of this file.
1
9#ifndef __W_LIBPCAP_H__
10#define __W_LIBPCAP_H__
11
12#include <wiretap/wtap.h>
13
14/* Magic numbers in "libpcap" files.
15
16 "libpcap" file records are written in the byte order of the host that
17 writes them, and the reader is expected to fix this up.
18
19 PCAP_MAGIC is the magic number, in host byte order; PCAP_SWAPPED_MAGIC
20 is a byte-swapped version of that.
21
22 PCAP_MODIFIED_MAGIC is for Alexey Kuznetsov's modified "libpcap"
23 format, as generated on Linux systems that have a "libpcap" with
24 his patches, at
25
26 http://ftp.sunet.se/pub/os/Linux/ip-routing/lbl-tools/
27
28 applied; PCAP_SWAPPED_MODIFIED_MAGIC is the byte-swapped version.
29
30 PCAP_IXIAMODIFIED_MAGIC is used by IXIA's lcap file format. It adds
31 a length field at the end of the file header (size of all records).
32 PCAP_SWAPPED_IXIAMODIFIED_MAGIC is the byte-swapped version.
33
34 PCAP_NSEC_MAGIC is for Ulf Lamping's modified "libpcap" format,
35 which uses the same common file format as PCAP_MAGIC, but the
36 timestamps are saved in nanosecond resolution instead of microseconds.
37 PCAP_SWAPPED_NSEC_MAGIC is a byte-swapped version of that. */
38#define PCAP_MAGIC 0xa1b2c3d4
39#define PCAP_SWAPPED_MAGIC 0xd4c3b2a1
40#define PCAP_MODIFIED_MAGIC 0xa1b2cd34
41#define PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1
42#define PCAP_IXIAHW_MAGIC 0x1c0001ac
43#define PCAP_SWAPPED_IXIAHW_MAGIC 0xac01001c
44#define PCAP_IXIASW_MAGIC 0x1c0001ab
45#define PCAP_SWAPPED_IXIASW_MAGIC 0xab01001c
46#define PCAP_NSEC_MAGIC 0xa1b23c4d
47#define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1
48
49/* "libpcap" file header (minus magic number). */
50struct pcap_hdr {
51 uint16_t version_major; /* major version number */
52 uint16_t version_minor; /* minor version number */
53 int32_t thiszone; /* GMT to local correction */
54 uint32_t sigfigs; /* accuracy of timestamps */
55 uint32_t snaplen; /* max length of captured packets, in octets */
56 uint32_t network; /* data link type */
57};
58
59/* "libpcap" record header. */
61 uint32_t ts_sec; /* timestamp seconds */
62 uint32_t ts_usec; /* timestamp microseconds (nsecs for PCAP_NSEC_MAGIC) */
63 uint32_t incl_len; /* number of octets of packet saved in file */
64 uint32_t orig_len; /* actual length of packet */
65};
66
67/* "libpcap" record header for Alexey's patched version. */
69 struct pcaprec_hdr hdr; /* the regular header */
70 uint32_t ifindex; /* index, in *capturing* machine's list of
71 interfaces, of the interface on which this
72 packet came in. */
73 uint16_t protocol; /* Ethernet packet type */
74 uint8_t pkt_type; /* broadcast/multicast/etc. indication */
75 uint8_t pad; /* pad to a 4-byte boundary */
76};
77
78/* "libpcap" record header for Alexey's patched version in its ss990915
79 incarnation; this version shows up in SuSE Linux 6.3. */
81 struct pcaprec_hdr hdr; /* the regular header */
82 uint32_t ifindex; /* index, in *capturing* machine's list of
83 interfaces, of the interface on which this
84 packet came in. */
85 uint16_t protocol; /* Ethernet packet type */
86 uint8_t pkt_type; /* broadcast/multicast/etc. indication */
87 uint8_t cpu1, cpu2; /* SMP debugging gunk? */
88 uint8_t pad[3]; /* pad to a 4-byte boundary */
89};
90
91/* "libpcap" record header for version used on some Nokia boxes (firewalls?) */
93 struct pcaprec_hdr hdr; /* the regular header */
94 uint8_t stuff[4]; /* mysterious stuff */
95};
96
97wtap_open_return_val libpcap_open(wtap *wth, int *err, char **err_info);
98
99#endif
Definition libpcap.h:50
Definition libpcap.h:60
Definition libpcap.h:68
Definition libpcap.h:92
Definition libpcap.h:80
Definition wtap-int.h:37