pcapxx::frame_descriptor Struct Reference

Describe a PCAP frame/packet. More...

#include <wipal/pcap/frame_descriptor.hh>

List of all members.

Public Types

typedef boost::shared_ptr
< const pkthdr
pkthdr_ptr
typedef boost::shared_array
< uint8_t > 
bytes_ptr

Public Member Functions

 frame_descriptor (const pkthdr *header, const void *bytes)
 frame_descriptor (const pkthdr_ptr header, const bytes_ptr bytes)
 frame_descriptor (std::istream &stream, unsigned idx, bool swap, int32_t zone, std::streampos *pos)
const pkthdr_ptrpcap_header () const
const bytes_ptrbytes () const
std::ostream & print (std::ostream &) const
Equality checks
bool operator== (const frame_descriptor &) const
bool operator!= (const frame_descriptor &) const


Detailed Description

Describe a PCAP frame/packet.

A frame descriptor holds a frame's PCAP header and bytes.

Upon construction, both the frame's PCAP header and bytes are deep-copied into the descriptor. You may therefore work with the frame descriptor after the original frame information has been invalidated.

Frame descriptors use shared pointers to store frame information. You may copy them efficiently. You may also retrieve smart pointer to both the frame's PCAP header and bytes.


Member Typedef Documentation

typedef boost::shared_ptr<const pkthdr> pcapxx::frame_descriptor::pkthdr_ptr

Smart pointer to a frame's PCAP header.

typedef boost::shared_array<uint8_t> pcapxx::frame_descriptor::bytes_ptr

Smart pointer to a frame's bytes.


Constructor & Destructor Documentation

pcapxx::frame_descriptor::frame_descriptor ( const pkthdr header,
const void *  bytes 
) [inline]

Build a PCAP frame descriptor from corresponding PCAP header and bytes.

The content of header and bytes are deep-copied into the frame descriptor at construction. The descriptor does therefore remain valid even after header and bytes have bee invalidated.

References pcap_header().

pcapxx::frame_descriptor::frame_descriptor ( const pkthdr_ptr  header,
const bytes_ptr  bytes 
) [inline]

Construct a PCAP frame descriptor from shared pointers to headers and bytes.

Since this constructor uses shared pointers, it does not perform any deep copy.

pcapxx::frame_descriptor::frame_descriptor ( std::istream &  stream,
unsigned  idx,
bool  swap,
int32_t  zone,
std::streampos *  pos 
) [inline]

Build a PCAP frame descriptor from an input stream.

The stream position must be at the begining of a PCAP packet header.

Parameters:
[in] stream Input stream.
[in] idx Packet index.
[in] swap Does the input stream use a swapped representation.
[in] zone Input stream's time zone.
[out] pos If not null, *pos is incremented with the number of read bytes.

References pcapxx::internals::file_frame_header::caplen, pcapxx::pkthdr::caplen, tool::extract_long_s(), tool::extract_long_u(), pcapxx::pkthdr::id, pcapxx::internals::file_frame_header::len, pcapxx::pkthdr::len, pcap_header(), pcapxx::pkthdr::swapped, pcapxx::internals::file_frame_header::ts, and pcapxx::pkthdr::ts.


Member Function Documentation

const frame_descriptor::pkthdr_ptr & pcapxx::frame_descriptor::pcap_header (  )  const [inline]

const frame_descriptor::bytes_ptr & pcapxx::frame_descriptor::bytes (  )  const [inline]

std::ostream & pcapxx::frame_descriptor::print ( std::ostream &  os  )  const [inline]

Dump a frame descriptor to a C++ stream.

References pcap_header().

Referenced by pcapxx::operator<<().


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

Generated on Fri Mar 28 14:53:32 2008 for wipal by  doxygen 1.5.5