pcapxx::frame_descriptor< PCAPDescriptor > Struct Template Reference

#include <wipal/pcap/frame_descriptor.hh>

List of all members.


Detailed Description

template<class PCAPDescriptor = tool::undefined_type>
struct pcapxx::frame_descriptor< PCAPDescriptor >

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.

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_ptr &header, const bytes_ptr &bytes, unsigned idx=0, const PCAPDescriptor *desc=0)
template<class D>
 frame_descriptor (const descriptor< D > &desc, std::istream &stream, unsigned idx, std::streampos *pos)
template<class OtherDescriptor>
 frame_descriptor (const frame_descriptor< OtherDescriptor > &)
unsigned id () const
bool swapped () const
const PCAPDescriptor * desc_ptr () const
const PCAPDescriptor & desc () const
const pkthdr_ptrpcap_header () const
const bytes_ptrbytes () const
std::ostream & print (std::ostream &) const
const boost::shared_ptr
< shared_data > & 
data () const
Equality checks
bool operator== (const frame_descriptor &) const
bool operator!= (const frame_descriptor &) const

Protected Attributes

boost::shared_ptr< shared_datadata_

Classes

struct  shared_data
 Data embedded in a frame descriptor . More...


Member Typedef Documentation

template<class PCAPDescriptor = tool::undefined_type>
typedef boost::shared_ptr<const pkthdr> pcapxx::frame_descriptor< PCAPDescriptor >::pkthdr_ptr

Smart pointer to a frame's PCAP header.

template<class PCAPDescriptor = tool::undefined_type>
typedef boost::shared_array<uint8_t> pcapxx::frame_descriptor< PCAPDescriptor >::bytes_ptr

Smart pointer to a frame's bytes.


Constructor & Destructor Documentation

template<class PCAPDescriptor>
pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor ( const pkthdr_ptr header,
const bytes_ptr bytes,
unsigned  idx = 0,
const PCAPDescriptor *  desc = 0 
) [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.

template<class PCAPDescriptor>
template<class D>
pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor ( const descriptor< D > &  desc,
std::istream &  stream,
unsigned  idx,
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] desc The descriptor the stream comes from.
[in] stream Input stream.
[in] idx Packet index.
[out] pos If not null, *pos is incremented with the number of read bytes.


Member Function Documentation

template<class PCAPDescriptor>
unsigned pcapxx::frame_descriptor< PCAPDescriptor >::id (  )  const [inline]

Get the frame index inside the trace.

template<class PCAPDescriptor>
bool pcapxx::frame_descriptor< PCAPDescriptor >::swapped (  )  const [inline]

Get whether this frame come from an endianness-swapped trace.

template<class PCAPDescriptor>
const PCAPDescriptor * pcapxx::frame_descriptor< PCAPDescriptor >::desc_ptr (  )  const [inline]

Get a pointer to the frame's PCAP descriptor. Might return 0.

template<class PCAPDescriptor>
const PCAPDescriptor & pcapxx::frame_descriptor< PCAPDescriptor >::desc (  )  const [inline]

Get the frame's PCAP descriptor.

Throws if frame has no such descriptor.

template<class PCAPDescriptor>
const frame_descriptor< PCAPDescriptor >::pkthdr_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::pcap_header (  )  const [inline]

Get a smart pointer to the frame's PCAP header.

template<class PCAPDescriptor>
const frame_descriptor< PCAPDescriptor >::bytes_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::bytes (  )  const [inline]

Get a smart pointer to the frame's data.

template<class PCAPDescriptor>
std::ostream & pcapxx::frame_descriptor< PCAPDescriptor >::print ( std::ostream &  os  )  const [inline]

Dump a frame descriptor to a C++ stream.

template<class PCAPDescriptor>
const boost::shared_ptr< typename frame_descriptor< PCAPDescriptor >::shared_data > & pcapxx::frame_descriptor< PCAPDescriptor >::data (  )  const [inline]

Return the object's shared data.

Designed for conversions between frame_descriptor<T1> and frame_descriptor<T2> (in frame_descriptor's constructors). Do not rely on any field in the returned object. Please do not use.


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

Generated on Tue Dec 2 11:12:17 2008 for wipal by  doxygen 1.5.6