Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
libpcap.h
Go to the documentation of this file.
1
8
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
52struct pcap_hdr {
53 uint16_t version_major;
54 uint16_t version_minor;
55 int32_t thiszone;
56 uint32_t sigfigs;
57 uint32_t snaplen;
58 uint32_t network;
59};
60
65 uint32_t ts_sec;
66 uint32_t ts_usec;
67 uint32_t incl_len;
68 uint32_t orig_len;
69};
70
76 uint32_t ifindex;
77 uint16_t protocol;
78 uint8_t pkt_type;
79 uint8_t pad;
80};
81
87 uint32_t ifindex;
88 uint16_t protocol;
89 uint8_t pkt_type;
90 uint8_t cpu1;
91 uint8_t cpu2;
92 uint8_t pad[3];
93};
94
100 uint8_t stuff[4];
101};
102
111wtap_open_return_val libpcap_open(wtap *wth, int *err, char **err_info);
112
113#endif
wtap_open_return_val libpcap_open(wtap *wth, int *err, char **err_info)
Opens a capture file using libpcap format.
Definition libpcap.c:188
File header for a libpcap capture file, immediately following the magic number.
Definition libpcap.h:52
uint16_t version_major
Definition libpcap.h:53
int32_t thiszone
Definition libpcap.h:55
uint16_t version_minor
Definition libpcap.h:54
uint32_t network
Definition libpcap.h:58
uint32_t sigfigs
Definition libpcap.h:56
uint32_t snaplen
Definition libpcap.h:57
Per-packet record header in a standard libpcap capture file.
Definition libpcap.h:64
uint32_t incl_len
Definition libpcap.h:67
uint32_t ts_sec
Definition libpcap.h:65
uint32_t orig_len
Definition libpcap.h:68
uint32_t ts_usec
Definition libpcap.h:66
Per-packet record header for Alexey Kuznetsov's modified libpcap format, extending the standard heade...
Definition libpcap.h:74
uint16_t protocol
Definition libpcap.h:77
uint8_t pkt_type
Definition libpcap.h:78
uint32_t ifindex
Definition libpcap.h:76
uint8_t pad
Definition libpcap.h:79
struct pcaprec_hdr hdr
Definition libpcap.h:75
Per-packet record header for the Nokia-variant libpcap format, as used on some Nokia firewall devices...
Definition libpcap.h:98
uint8_t stuff[4]
Definition libpcap.h:100
struct pcaprec_hdr hdr
Definition libpcap.h:99
Per-packet record header for the ss990915 incarnation of Alexey's modified libpcap format,...
Definition libpcap.h:85
struct pcaprec_hdr hdr
Definition libpcap.h:86
uint8_t cpu2
Definition libpcap.h:91
uint8_t cpu1
Definition libpcap.h:90
uint32_t ifindex
Definition libpcap.h:87
uint8_t pkt_type
Definition libpcap.h:89
uint8_t pad[3]
Definition libpcap.h:92
uint16_t protocol
Definition libpcap.h:88
Definition wtap_module.h:58
wtap_open_return_val
For registering file types that we can open.
Definition wtap.h:1851