Opens or creates a file for writing packet capture data.
pcap Library (libpcap.a)
pcap_dumper_t *pcap_dump_open(pcap_t * p, char * fname);
The pcap_dump_open subroutine opens or creates the packet capture data file, known as the savefile. This action is specified through the fname parameter. The subroutine then writes the required packet capture file header to the file. The pcap_dump subroutine can then be called to write the packet capture data associated with the packet capture descriptor, p, into this file. The pcap_dump_open subroutine must be called before calling the pcap_dump subroutine.
|fname||Specifies the name of the file to open. A "-" indicates that standard output should be used instead of a file.|
|p||Specifies a packet capture descriptor returned by the pcap_open_offline or the pcap_open_live subroutine.|
Upon successful completion, the pcap_dump_open subroutine returns a pointer to a the file that was opened or created. This pointer is a pointer to a pcap_dumper_t, which is synonymous with FILE *. See the pcap_dump (pcap_dump Subroutine), pcap_dispatch (pcap_dispatch Subroutine), or the pcap_loop (pcap_loop Subroutine) subroutine for an example of how to use pcap_dumper_t. If the pcap_dump_open subroutine is unsuccessful, Null is returned. Use the pcap_geterr subroutine to obtain the specific error text.
The pcap_dispatch (pcap_dispatch Subroutine) subroutine, pcap_dump (pcap_dump Subroutine) subroutine, pcap_dump_close (pcap_dump_close Subroutine) subroutine, pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_loop (pcap_loop Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_open_offline (pcap_open_offline Subroutine) subroutine.