1 .\" Copyright (c) 1994, 1996, 1997
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that: (1) source code distributions
6 .\" retain the above copyright notice and this paragraph in its entirety, (2)
7 .\" distributions including binary code include the above copyright notice and
8 .\" this paragraph in its entirety in the documentation or other materials
9 .\" provided with the distribution, and (3) all advertising materials mentioning
10 .\" features or use of this software display the following acknowledgement:
11 .\" ``This product includes software developed by the University of California,
12 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 .\" the University nor the names of its contributors may be used to endorse
14 .\" or promote products derived from this software without specific prior
15 .\" written permission.
16 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .TH PCAP_OPEN_OFFLINE 3PCAP "1 July 2013"
22 pcap_open_offline, pcap_open_offline_with_tstamp_precision,
23 pcap_fopen_offline, pcap_fopen_offline_with_tstamp_precision \- open a saved capture file for reading
27 #include <pcap/pcap.h>
32 char errbuf[PCAP_ERRBUF_SIZE];
36 pcap_t *pcap_open_offline(const char *fname, char *errbuf);
37 pcap_t *pcap_open_offline_with_tstamp_precision(const char *fname,
38 u_int precision, char *errbuf);
39 pcap_t *pcap_fopen_offline(FILE *fp, char *errbuf);
40 pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *fp,
41 u_int precision, char *errbuf);
45 .B pcap_open_offline()
47 .B pcap_open_offline_with_tstamp_precision()
48 are called to open a ``savefile'' for reading.
51 specifies the name of the file to open. The file can have the pcap file
52 format as described in
53 .BR pcap-savefile (@MAN_FILE_FORMATS@),
54 which is the file format used by, among other programs,
58 or can have the pcap-ng file format, although not all pcap-ng files can
60 The name "-" is a synonym for
63 .B pcap_open_offline_with_tstamp_precision()
66 argument specifying the time stamp precision desired;
68 .B PCAP_TSTAMP_PRECISION_MICRO
69 is specified, packet time stamps will be supplied in seconds and
72 .B PCAP_TSTAMP_PRECISION_NANO
73 is specified, packet time stamps will be supplied in seconds and
74 nanoseconds. If the time stamps in the file do not have the same
75 precision as the requested precision, they will be scaled up or down as
76 necessary before being supplied.
78 Alternatively, you may call
79 .B pcap_fopen_offline()
81 .B pcap_fopen_offline_with_tstamp_precision()
82 to read dumped data from an existing open stream
84 .B pcap_fopen_offline_with_tstamp_precision() takes an additional
86 argument as described above.
87 Note that on Windows, that stream should be opened in binary mode.
89 .BR pcap_open_offline() ,
90 .BR pcap_open_offline_with_tstamp_precision() ,
91 .BR pcap_fopen_offline() ,
93 .B pcap_fopen_offline_with_tstamp_precision()
103 is filled in with an appropriate error message.
105 is assumed to be able to hold at least
109 pcap(3PCAP), pcap-savefile(@MAN_FILE_FORMATS@)