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