1PCAP_OPEN_OFFLINE(3PCAP) PCAP_OPEN_OFFLINE(3PCAP)
2
3
4
6 pcap_open_offline, pcap_open_offline_with_tstamp_precision,
7 pcap_fopen_offline, pcap_fopen_offline_with_tstamp_precision - open a
8 saved capture file for reading
9
11 #include <pcap/pcap.h>
12
13 char errbuf[PCAP_ERRBUF_SIZE];
14
15 pcap_t *pcap_open_offline(const char *fname, char *errbuf);
16 pcap_t *pcap_open_offline_with_tstamp_precision(const char *fname,
17 u_int precision, char *errbuf);
18 pcap_t *pcap_fopen_offline(FILE *fp, char *errbuf);
19 pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *fp,
20 u_int precision, char *errbuf);
21
23 pcap_open_offline() and pcap_open_offline_with_tstamp_precision() are
24 called to open a ``savefile'' for reading.
25
26 fname specifies the name of the file to open. The file can have the
27 pcap file format as described in pcap-savefile(5), which is the file
28 format used by, among other programs, tcpdump(1) and tcpslice(1), or
29 can have the pcap-ng file format, although not all pcap-ng files can be
30 read. The name "-" in a synonym for stdin.
31
32 pcap_open_offline_with_tstamp_precision() takes an additional precision
33 argument specifying the time stamp precision desired; if
34 PCAP_TSTAMP_PRECISION_MICRO is specified, packet time stamps will be
35 supplied in seconds and microseconds, and if PCAP_TSTAMP_PRECISION_NANO
36 is specified, packet time stamps will be supplied in seconds and
37 nanoseconds. If the time stamps in the file do not have the same pre‐
38 cision as the requested precision, they will be scaled up or down as
39 necessary before being supplied.
40
41 Alternatively, you may call pcap_fopen_offline() or pcap_fopen_off‐
42 line_with_tstamp_precision() to read dumped data from an existing open
43 stream fp. pcap_fopen_offline_with_tstamp_precision() takes an addi‐
44 tional precision argument as described above. Note that on Windows,
45 that stream should be opened in binary mode.
46
48 pcap_open_offline(), pcap_open_offline_with_tstamp_precision(),
49 pcap_fopen_offline(), and pcap_fopen_offline_with_tstamp_precision()
50 return a pcap_t * on success and NULL on failure. If NULL is returned,
51 errbuf is filled in with an appropriate error message. errbuf is
52 assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.
53
55 pcap(3PCAP), pcap-savefile(5)
56
57
58
59 1 July 2013 PCAP_OPEN_OFFLINE(3PCAP)