#include <wipal/pcap/frame_descriptor.hh>
Classes | |
struct | shared_data |
Data embedded in a frame descriptor . More... | |
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_ptr & | pcap_header () const |
const bytes_ptr & | bytes () 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_data > | data_ |
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.
typedef boost::shared_array<uint8_t> pcapxx::frame_descriptor< PCAPDescriptor >::bytes_ptr |
Smart pointer to a frame's bytes.
typedef boost::shared_ptr<const pkthdr> pcapxx::frame_descriptor< PCAPDescriptor >::pkthdr_ptr |
Smart pointer to a frame's PCAP header.
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.
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.
[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. |
const frame_descriptor< PCAPDescriptor >::bytes_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::bytes | ( | ) | const [inline] |
Get a smart pointer to the frame's data.
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.
const PCAPDescriptor & pcapxx::frame_descriptor< PCAPDescriptor >::desc | ( | ) | const [inline] |
Get the frame's PCAP descriptor.
Throws if frame has no such descriptor.
const PCAPDescriptor * pcapxx::frame_descriptor< PCAPDescriptor >::desc_ptr | ( | ) | const [inline] |
Get a pointer to the frame's PCAP descriptor. Might return 0.
unsigned pcapxx::frame_descriptor< PCAPDescriptor >::id | ( | ) | const [inline] |
Get the frame index inside the trace.
const frame_descriptor< PCAPDescriptor >::pkthdr_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::pcap_header | ( | ) | const [inline] |
Get a smart pointer to the frame's PCAP header.
std::ostream & pcapxx::frame_descriptor< PCAPDescriptor >::print | ( | std::ostream & | os | ) | const [inline] |
Dump a frame descriptor to a C++ stream.
bool pcapxx::frame_descriptor< PCAPDescriptor >::swapped | ( | ) | const [inline] |
Get whether this frame come from an endianness-swapped trace.