#include <wipal/pcap/frame_descriptor.hh>
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) | |
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_ |
Classes | |
struct | shared_data |
Data embedded in a frame descriptor . More... |
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_ptr<const pkthdr> pcapxx::frame_descriptor< PCAPDescriptor >::pkthdr_ptr |
Smart pointer to a frame's PCAP header.
typedef boost::shared_array<uint8_t> pcapxx::frame_descriptor< PCAPDescriptor >::bytes_ptr |
Smart pointer to a frame's bytes.
pcapxx::frame_descriptor< PCAPDescriptor >::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< 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. |
References pcapxx::frame_descriptor< PCAPDescriptor >::bytes(), pcapxx::internals::file_frame_header::caplen, pcapxx::pkthdr::caplen, tool::static_base< Bottom >::exact_ptr(), tool::extract_long_s(), tool::extract_long_u(), pcapxx::internals::file_frame_header::len, pcapxx::pkthdr::len, pcapxx::frame_descriptor< PCAPDescriptor >::pcap_header(), pcapxx::descriptor< Bottom >::swapped(), pcapxx::internals::file_frame_header::ts, pcapxx::pkthdr::ts, and pcapxx::descriptor< Bottom >::zone().
unsigned pcapxx::frame_descriptor< PCAPDescriptor >::id | ( | ) | const [inline] |
Get the frame index inside the trace.
bool pcapxx::frame_descriptor< PCAPDescriptor >::swapped | ( | ) | const [inline] |
Get whether this frame come from an endianness-swapped trace.
References pcapxx::frame_descriptor< PCAPDescriptor >::desc_ptr().
Referenced by wifi::frame::dissect(), phy::header< Bottom >::eq_80211(), and wifi::mactime_tracker< Bottom >::tick().
const PCAPDescriptor * pcapxx::frame_descriptor< PCAPDescriptor >::desc_ptr | ( | ) | const [inline] |
Get a pointer to the frame's PCAP descriptor. Might return 0.
Referenced by pcapxx::frame_descriptor< PCAPDescriptor >::print(), and pcapxx::frame_descriptor< PCAPDescriptor >::swapped().
const PCAPDescriptor & pcapxx::frame_descriptor< PCAPDescriptor >::desc | ( | ) | const [inline] |
Get the frame's PCAP descriptor.
Throws if frame has no such descriptor.
const frame_descriptor< PCAPDescriptor >::pkthdr_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::pcap_header | ( | ) | const [inline] |
Get a smart pointer to the frame's PCAP header.
Referenced by wifi::frame::dissect(), phy::header< Bottom >::eq_80211(), pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor(), wit::importer::operator()(), pcapxx::dumper::operator()(), and wifi::mactime_tracker< Bottom >::tick().
const frame_descriptor< PCAPDescriptor >::bytes_ptr & pcapxx::frame_descriptor< PCAPDescriptor >::bytes | ( | ) | const [inline] |
Get a smart pointer to the frame's data.
Referenced by wifi::frame::dissect(), phy::header< Bottom >::eq_80211(), pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor(), wit::importer::operator()(), pcapxx::dumper::operator()(), and wifi::mactime_tracker< Bottom >::tick().
std::ostream & pcapxx::frame_descriptor< PCAPDescriptor >::print | ( | std::ostream & | os | ) | const [inline] |
Dump a frame descriptor to a C++ stream.
References pcapxx::frame_descriptor< PCAPDescriptor >::desc_ptr().
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.