JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1 | .\" @(#) $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 |
| 24 | pcap_open_offline, pcap_open_offline_with_tstamp_precision, |
| 25 | pcap_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 |
| 34 | char errbuf[PCAP_ERRBUF_SIZE]; |
| 35 | .ft |
| 36 | .LP |
| 37 | .ft B |
| 38 | pcap_t *pcap_open_offline(const char *fname, char *errbuf); |
| 39 | pcap_t *pcap_open_offline_with_tstamp_precision(const char *fname, |
| 40 | u_int precision, char *errbuf); |
| 41 | pcap_t *pcap_fopen_offline(FILE *fp, char *errbuf); |
| 42 | pcap_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() |
| 48 | and |
| 49 | .B pcap_open_offline_with_tstamp_precision() |
| 50 | are called to open a ``savefile'' for reading. |
| 51 | .PP |
| 52 | .I fname |
| 53 | specifies the name of the file to open. The file can have the pcap file |
| 54 | format as described in |
| 55 | .BR pcap-savefile (@MAN_FILE_FORMATS@), |
| 56 | which is the file format used by, among other programs, |
| 57 | .BR tcpdump (1) |
| 58 | and |
| 59 | .BR tcpslice (1), |
| 60 | or can have the pcap-ng file format, although not all pcap-ng files can |
| 61 | be read. |
| 62 | The name "-" in a synonym for |
| 63 | .BR stdin . |
| 64 | .PP |
| 65 | .B pcap_open_offline_with_tstamp_precision() |
| 66 | takes an additional |
| 67 | .I precision |
| 68 | argument specifying the time stamp precision desired; |
| 69 | if |
| 70 | .B PCAP_TSTAMP_PRECISION_MICRO |
| 71 | is specified, packet time stamps will be supplied in seconds and |
| 72 | microseconds, |
| 73 | and if |
| 74 | .B PCAP_TSTAMP_PRECISION_NANO |
| 75 | is specified, packet time stamps will be supplied in seconds and |
| 76 | nanoseconds. If the time stamps in the file do not have the same |
| 77 | precision as the requested precision, they will be scaled up or down as |
| 78 | necessary before being supplied. |
| 79 | .PP |
| 80 | Alternatively, you may call |
| 81 | .B pcap_fopen_offline() |
| 82 | or |
| 83 | .B pcap_fopen_offline_with_tstamp_precision() |
| 84 | to 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 |
| 88 | argument as described above. |
| 89 | Note 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() , |
| 94 | and |
| 95 | .B pcap_fopen_offline_with_tstamp_precision() |
| 96 | return a |
| 97 | .I pcap_t * |
| 98 | on success and |
| 99 | .B NULL |
| 100 | on failure. |
| 101 | If |
| 102 | .B NULL |
| 103 | is returned, |
| 104 | .I errbuf |
| 105 | is filled in with an appropriate error message. |
| 106 | .I errbuf |
| 107 | is assumed to be able to hold at least |
| 108 | .B PCAP_ERRBUF_SIZE |
| 109 | chars. |
| 110 | .SH SEE ALSO |
| 111 | pcap(3PCAP), pcap-savefile(@MAN_FILE_FORMATS@) |