#include <Dumper.h>
Public Member Functions | |
void | close () |
Closes the savefile or the stream associated with the Dumper. | |
pcap_dumper_t const * | cobj () const |
Get the underlying libpcap C structure. | |
pcap_dumper_t * | cobj () |
Get the underlying libpcap C structure. | |
void | dump (Packet const &packet) |
Writes a packet to the savefile. | |
void | flush () |
Flushes the output buffer. | |
long | ftell () const |
Gets the current file position. | |
FILE * | get_file () const |
Gets the current standard I/O stream of the savefile. | |
std::string const & | get_filename () const |
Gets the name of the current savefile. | |
bool | is_open () const |
Gets the status of the Dumper. | |
void | open (FILE *stream) |
Open a Dumper to write packets to an open stream. | |
void | open (std::string const &filename=STD_OUTPUT) |
Open a Dumper to write packets to a savefile. | |
operator bool () const | |
An alias for is_open(). | |
Static Public Attributes | |
static std::string | STD_OUTPUT = "-" |
Friends | |
Dumper & | operator<< (Dumper &dumper, Packet const &packet) |
Writes a packet to the savefile (like dump()). |
void pcappp::Dumper::close | ( | ) |
pcap_dumper_t const* pcappp::Dumper::cobj | ( | ) | const [inline] |
Get the underlying libpcap C structure.
pcap_dumper_t* pcappp::Dumper::cobj | ( | ) | [inline] |
Get the underlying libpcap C structure.
void pcappp::Dumper::dump | ( | Packet const & | packet | ) | [inline] |
void pcappp::Dumper::flush | ( | ) |
Flushes the output buffer.
Flushes the output buffer to the savefile, so that any packets written with dump() but not yet written to the savefile will be written
PcapError,DumperClosed |
long pcappp::Dumper::ftell | ( | ) | const |
Gets the current file position.
PcapError,DumperClosed |
FILE * pcappp::Dumper::get_file | ( | ) | const |
std::string const & pcappp::Dumper::get_filename | ( | ) | const |
Gets the name of the current savefile.
DumperClosed |
bool pcappp::Dumper::is_open | ( | ) | const [inline] |
void pcappp::Dumper::open | ( | FILE * | stream | ) |
void pcappp::Dumper::open | ( | std::string const & | filename = STD_OUTPUT |
) |
Open a Dumper to write packets to a savefile.
If the Dumper is already open, the old savefile or stream is closed, and the Dumper is open again
filename | The name of the savefile, or Dumper::STD_OUTPUT to write the packets to the standard output stream (stdout) |
PcapError |
pcappp::Dumper::operator bool | ( | ) | const [inline] |
An alias for is_open().
std::string pcappp::Dumper::STD_OUTPUT = "-" [static] |