#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 *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_ptr & | pcap_header () const |
const bytes_ptr & | bytes () const |
std::ostream & | print (std::ostream &) const |
Equality checks | |
bool | operator== (const frame_descriptor &) const |
bool | operator!= (const frame_descriptor &) const |
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::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.
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.
[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.
const frame_descriptor::pkthdr_ptr & pcapxx::frame_descriptor::pcap_header | ( | ) | const [inline] |
Get a smart pointer to the frame's PCAP header.
Referenced by phy::header< Bottom >::eq_80211(), frame_descriptor(), wit::importer::operator()(), pcapxx::dumper::operator()(), print(), and wifi::mactime_tracker< Bottom >::tick().
const frame_descriptor::bytes_ptr & pcapxx::frame_descriptor::bytes | ( | ) | const [inline] |
Get a smart pointer to the frame's data.
Referenced by phy::header< Bottom >::eq_80211(), wit::importer::operator()(), pcapxx::dumper::operator()(), and wifi::mactime_tracker< Bottom >::tick().
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<<().