blob: d38608d47493a6e82389fe2a8001b43732d09827 [file] [log] [blame]
JP Abgrall511eca32014-02-12 13:46:45 -08001.\" @(#) $Header: /tcpdump/master/libpcap/pcap_open_offline.3pcap.in,v 1.1 2008-10-23 05:56:59 guy Exp $
2.\"
3.\" Copyright (c) 1994, 1996, 1997
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that: (1) source code distributions
8.\" retain the above copyright notice and this paragraph in its entirety, (2)
9.\" distributions including binary code include the above copyright notice and
10.\" this paragraph in its entirety in the documentation or other materials
11.\" provided with the distribution, and (3) all advertising materials mentioning
12.\" features or use of this software display the following acknowledgement:
13.\" ``This product includes software developed by the University of California,
14.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15.\" the University nor the names of its contributors may be used to endorse
16.\" or promote products derived from this software without specific prior
17.\" written permission.
18.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21.\"
22.TH PCAP_OPEN_OFFLINE 3PCAP "1 July 2013"
23.SH NAME
24pcap_open_offline, pcap_open_offline_with_tstamp_precision,
25pcap_fopen_offline, pcap_fopen_offline_with_tstamp_precision \- open a saved capture file for reading
26.SH SYNOPSIS
27.nf
28.ft B
29#include <pcap/pcap.h>
30.ft
31.LP
32.nf
33.ft B
34char errbuf[PCAP_ERRBUF_SIZE];
35.ft
36.LP
37.ft B
38pcap_t *pcap_open_offline(const char *fname, char *errbuf);
39pcap_t *pcap_open_offline_with_tstamp_precision(const char *fname,
40 u_int precision, char *errbuf);
41pcap_t *pcap_fopen_offline(FILE *fp, char *errbuf);
42pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *fp,
43 u_int precision, char *errbuf);
44.ft
45.fi
46.SH DESCRIPTION
47.B pcap_open_offline()
48and
49.B pcap_open_offline_with_tstamp_precision()
50are called to open a ``savefile'' for reading.
51.PP
52.I fname
53specifies the name of the file to open. The file can have the pcap file
54format as described in
55.BR pcap-savefile (@MAN_FILE_FORMATS@),
56which is the file format used by, among other programs,
57.BR tcpdump (1)
58and
59.BR tcpslice (1),
60or can have the pcap-ng file format, although not all pcap-ng files can
61be read.
62The name "-" in a synonym for
63.BR stdin .
64.PP
65.B pcap_open_offline_with_tstamp_precision()
66takes an additional
67.I precision
68argument specifying the time stamp precision desired;
69if
70.B PCAP_TSTAMP_PRECISION_MICRO
71is specified, packet time stamps will be supplied in seconds and
72microseconds,
73and if
74.B PCAP_TSTAMP_PRECISION_NANO
75is specified, packet time stamps will be supplied in seconds and
76nanoseconds. If the time stamps in the file do not have the same
77precision as the requested precision, they will be scaled up or down as
78necessary before being supplied.
79.PP
80Alternatively, you may call
81.B pcap_fopen_offline()
82or
83.B pcap_fopen_offline_with_tstamp_precision()
84to read dumped data from an existing open stream
85.IR fp .
86.B pcap_fopen_offline_with_tstamp_precision() takes an additional
87.I precision
88argument as described above.
89Note that on Windows, that stream should be opened in binary mode.
90.SH RETURN VALUE
91.BR pcap_open_offline() ,
92.BR pcap_open_offline_with_tstamp_precision() ,
93.BR pcap_fopen_offline() ,
94and
95.B pcap_fopen_offline_with_tstamp_precision()
96return a
97.I pcap_t *
98on success and
99.B NULL
100on failure.
101If
102.B NULL
103is returned,
104.I errbuf
105is filled in with an appropriate error message.
106.I errbuf
107is assumed to be able to hold at least
108.B PCAP_ERRBUF_SIZE
109chars.
110.SH SEE ALSO
111pcap(3PCAP), pcap-savefile(@MAN_FILE_FORMATS@)