1PCAP_DUMP_OPEN(3PCAP) PCAP_DUMP_OPEN(3PCAP)
2
3
4
6 pcap_dump_open, pcap_dump_fopen - open a file to which to write packets
7
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_fopen(pcap_t *p, FILE *fp);
13
15 pcap_dump_open() is called to open a ``savefile'' for writing. fname
16 specifies the name of the file to open. The file will have the same
17 format as those used by tcpdump(1) and tcpslice(1). The name "-" in a
18 synonym for stdout.
19
20 pcap_dump_fopen() is called to write data to an existing open stream
21 fp. Note that on Windows, that stream should be opened in binary mode.
22
23 p is a capture or ``savefile'' handle returned by an earlier call to
24 pcap_create() and activated by an earlier call to pcap_activate(), or
25 returned by an earlier call to pcap_open_offline(), pcap_open_live(),
26 or pcap_open_dead(). The link-layer type and snapshot length from p
27 are used as the link-layer type and snapshot length of the output file.
28
30 A pointer to a pcap_dumper_t structure to use in subsequent pcap_dump()
31 and pcap_dump_close() calls is returned on success. NULL is returned
32 on failure. If NULL is returned, pcap_geterr(p) can be used to get the
33 error text.
34
36 pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), pcap_open_off‐
37 line(3PCAP), pcap_open_live(3PCAP), pcap_open_dead(3PCAP),
38 pcap_dump(3PCAP), pcap_dump_close(3PCAP), pcap_geterr(3PCAP), pcap-
39 savefile(5)
40
41
42
43 5 April 2008 PCAP_DUMP_OPEN(3PCAP)