pcappp::Dumper Class Reference

#include <Dumper.h>

List of all members.

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

Dumperoperator<< (Dumper &dumper, Packet const &packet)
 Writes a packet to the savefile (like dump()).


Member Function Documentation

void pcappp::Dumper::close (  ) 

Closes the savefile or the stream associated with the Dumper.

If the Dumper is already closed, it has no effect

pcap_dumper_t const* pcappp::Dumper::cobj (  )  const [inline]

Get the underlying libpcap C structure.

Returns:
A const pointer to the underlying pcap_dumper_t

pcap_dumper_t* pcappp::Dumper::cobj (  )  [inline]

Get the underlying libpcap C structure.

Returns:
A pointer to the underlying pcap_dumper_t

void pcappp::Dumper::dump ( Packet const &  packet  )  [inline]

Writes a packet to the savefile.

Exceptions:
DumperClosed 

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

Exceptions:
PcapError,DumperClosed 

long pcappp::Dumper::ftell (  )  const

Gets the current file position.

Returns:
The current file position for the savefile, representing the number of bytes written so far
Exceptions:
PcapError,DumperClosed 

FILE * pcappp::Dumper::get_file (  )  const

Gets the current standard I/O stream of the savefile.

Exceptions:
DumperClosed 

std::string const & pcappp::Dumper::get_filename (  )  const

Gets the name of the current savefile.

Returns:
The name of the savefile, or an empty string if writing packets to a stream
Exceptions:
DumperClosed 

bool pcappp::Dumper::is_open (  )  const [inline]

Gets the status of the Dumper.

Returns:
Whether the Dumper is currently open

void pcappp::Dumper::open ( FILE *  stream  ) 

Open a Dumper to write packets to an open stream.

If the Dumper is already open, the old savefile or stream is closed, and the Dumper is open again

Parameters:
stream The stream, which must be open for writing
Exceptions:
PcapError 

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

Parameters:
filename The name of the savefile, or Dumper::STD_OUTPUT to write the packets to the standard output stream (stdout)
Exceptions:
PcapError 

pcappp::Dumper::operator bool (  )  const [inline]

An alias for is_open().


Friends And Related Function Documentation

Dumper& operator<< ( Dumper dumper,
Packet const &  packet 
) [friend]

Writes a packet to the savefile (like dump()).

Exceptions:
DumperClosed 


Member Data Documentation

std::string pcappp::Dumper::STD_OUTPUT = "-" [static]


The documentation for this class was generated from the following files:

Generated on Tue Apr 15 17:36:29 2008 for libpcap++ by  doxygen 1.5.5