[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pcap_dump_open Subroutine

Purpose

Opens or creates a file for writing packet capture data.

Library

pcap Library (libpcap.a)

Syntax


#include <pcap.h>


pcap_dumper_t *pcap_dump_open(pcap_t * p, char * fname);

Description

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.

Parameters


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.

Return Values

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.

Related Information

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.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]