1PCAP_DUMP_OPEN(3PCAP)                                    PCAP_DUMP_OPEN(3PCAP)
2
3
4

NAME

6       pcap_dump_open, pcap_dump_fopen - open a file to which to write packets
7

SYNOPSIS

9       #include <pcap/pcap.h>
10
11       pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname);
12       pcap_dumper_t *pcap_dump_open_append(pcap_t *p, const char *fname);
13       pcap_dumper_t *pcap_dump_fopen(pcap_t *p, FILE *fp);
14

DESCRIPTION

16       pcap_dump_open()  is  called to open a ``savefile'' for writing.  fname
17       specifies the name of the file to open. The file  will  have  the  same
18       format  as those used by tcpdump(1) and tcpslice(1).  The name "-" is a
19       synonym for stdout.
20
21       pcap_dump_fopen() is called to write data to an  existing  open  stream
22       fp;   this   stream   will   be   closed   by   a  subsequent  call  to
23       pcap_dump_close(3PCAP).  Note that on Windows, that  stream  should  be
24       opened in binary mode.
25
26       p  is  a  capture or ``savefile'' handle returned by an earlier call to
27       pcap_create(3PCAP)   and   activated   by   an    earlier    call    to
28       pcap_activate(3PCAP),    or    returned   by   an   earlier   call   to
29       pcap_open_offline(3PCAP),           pcap_open_live(3PCAP),           or
30       pcap_open_dead(3PCAP).   The time stamp precision, link-layer type, and
31       snapshot length from p are used as the  link-layer  type  and  snapshot
32       length of the output file.
33
34       pcap_dump_open_append()  is  like  pcap_dump_open() but does not create
35       the file if it does not exist and, if it does already exist, and  is  a
36       pcap  file  with  the same byte order as the host opening the file, and
37       has the same time stamp precision, link-layer header type, and snapshot
38       length as p, it will write new packets at the end of the file.
39

RETURN VALUES

41       A   pointer   to   a  pcap_dumper_t  structure  to  use  in  subsequent
42       pcap_dump(3PCAP) and pcap_dump_close(3PCAP) calls is returned  on  suc‐
43       cess.    NULL   is   returned   on   failure.   If  NULL  is  returned,
44       pcap_geterr(3PCAP) can be used to get the error text.
45

BACKWARD COMPATIBILITY

47       The  pcap_dump_open_append()  function  became  available  in   libpcap
48       release 1.7.2.  In previous releases, there is no support for appending
49       packets to an existing savefile.
50

SEE ALSO

52       pcap(3PCAP), pcap-savefile(5)
53
54
55
56                                22 August 2018           PCAP_DUMP_OPEN(3PCAP)
Impressum