phy::header< Bottom > Struct Template Reference

Base class for all PHY headers. More...

#include <wipal/phy/phy.hh>

Inheritance diagram for phy::header< Bottom >:

tool::static_base< Bottom > phy::empty_header< Bottom >

List of all members.

Public Types

Static hierarchies related types
typedef HIDDEN exact_type
typedef HIDDEN time_type

Public Member Functions

size_t len (size_t caplen, bool swapped) const
const void * decapsulate (size_t caplen, bool swapped) const
time_type time_get (bool swapped) const
void time_set (const time_type &time, bool swapped)
Downcast methods
const exact_typeexact () const
exact_typeexact ()
const exact_typeexact_ptr () const
exact_typeexact_ptr ()

Static Public Member Functions

template<class D1, class D2>
static bool eq_80211 (const pcapxx::frame_descriptor< D1 > &lhs, const pcapxx::frame_descriptor< D2 > &rhs, tool::endian::endianness phy_end=tool::endian::guess)
template<class D1, class D2>
static bool eq_time_and_80211 (const pcapxx::frame_descriptor< D1 > &lhs, const pcapxx::frame_descriptor< D2 > &rhs, tool::endian::endianness phy_end=tool::endian::guess, unsigned precision=phy::eq_time_default_precision)


Detailed Description

template<class Bottom = tool::bottom>
struct phy::header< Bottom >

Base class for all PHY headers.

All PHY headers shall subclass this class. It provides a common interface so WiPal's internals work whatever the PHY header.

To subclass, you must define the time_type virtual type, implement len_impl(), time_get_impl(), time_set_impl(), and eq_time().

time_type is the type of the PHY header's timing information. Use phy::empty_time if your PHY header has no timing information.

time_get_impl() and time_set_impl() retrieve and set this PHY header's timing information.

eq_time() indicates whether two frames are equals with respect to timestamps. If no timestamps are available, implement it by comparing PCAP timestamps.

len_impl() returns the size of the PHY header.

See also:
prism::header, phy::empty_header

Member Typedef Documentation

template<class Bottom = tool::bottom>
typedef HIDDEN phy::header< Bottom >::exact_type

Exact type for this template instanciation.

See also:
static_base

Reimplemented from tool::static_base< Bottom >.

Reimplemented in avs::header, phy::empty_header< Bottom >, prism::header, and rtap::header.


Member Function Documentation

template<class B>
size_t phy::header< B >::len ( size_t  caplen,
bool  swapped 
) const [inline]

Get the PHY header length.

Never override this method. Define len_impl() in subclasses instead.

References tool::static_base< Bottom >::exact().

Referenced by phy::header< Bottom >::decapsulate().

template<class B>
const void * phy::header< B >::decapsulate ( size_t  caplen,
bool  swapped 
) const [inline]

Get the embedded IEEE 802.11 frame.

Return 0 if len() > caplen.

This method relies on len(). You should not need to override it if your subclasses define a proper len_impl().

References tool::static_base< Bottom >::exact(), and phy::header< Bottom >::len().

template<class B>
header< B >::time_type phy::header< B >::time_get ( bool  swapped  )  const [inline]

Extract timing information from the PHY header.

Never override this method. Define time_get_impl() in subclasses instead.

References tool::static_base< Bottom >::exact().

template<class B>
void phy::header< B >::time_set ( const time_type &  time,
bool  swapped 
) [inline]

Set the PHY header's timing information.

Never override this method. Define time_set_impl() in subclasses instead.

References tool::static_base< Bottom >::exact().

template<class B>
template<class D1, class D2>
bool phy::header< B >::eq_80211 ( const pcapxx::frame_descriptor< D1 > &  lhs,
const pcapxx::frame_descriptor< D2 > &  rhs,
tool::endian::endianness  phy_end = tool::endian::guess 
) [inline, static]

Compare the IEEE 802.11 bytes beyond the PHY header.

Return whether the two IEEE 802.11 frames embedded inside the PHY headers are equals. This function does not compare the PHY headers.

In case there is not enough bytes to decide whether frames are equal (caplen < sizeof prism::header), consider they are not. This is a conservative approach: when merging two traces, this will lead to both frames having their entry in the merged trace.

This method relies on decapsulate(). You should not need to override it if your subclasses define a proper decapsulate_impl().

References pcapxx::frame_descriptor< PCAPDescriptor >::bytes(), pcapxx::pkthdr::caplen, tool::endian::need_swap(), pcapxx::frame_descriptor< PCAPDescriptor >::pcap_header(), and pcapxx::frame_descriptor< PCAPDescriptor >::swapped().

Referenced by phy::header< Bottom >::eq_time_and_80211().

template<class B>
template<class D1, class D2>
bool phy::header< B >::eq_time_and_80211 ( const pcapxx::frame_descriptor< D1 > &  lhs,
const pcapxx::frame_descriptor< D2 > &  rhs,
tool::endian::endianness  phy_end = tool::endian::guess,
unsigned  precision = phy::eq_time_default_precision 
) [inline, static]

Compare the IEEE 802.11 bytes beyond PHY headers, but also check timestamps.

Return whether the two IEEE 802.11 frames embedded inside the PHY headers are equals. Also compare the timestamps of PHY headers if available (or the PCAP timestamps else). When the time difference between each header's field is less than precision, then consider the field equals.

In case there is not enough bytes to decide whether frames are equal (caplen < sizeof prism::header), consider they are not. This is a conservative approach: when merging two traces, this will lead to both frames having their entry in the merged trace.

This method relies on eq_time(). You should not need to override it if your subclasses define a proper eq_time().

References phy::header< Bottom >::eq_80211().

template<class Bottom>
const static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact (  )  const [inline, inherited]

template<class Bottom>
static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact (  )  [inline, inherited]

Safely downcast to the exact type as a non-const reference.

template<class Bottom>
const static_base< Bottom >::exact_type * tool::static_base< Bottom >::exact_ptr (  )  const [inline, inherited]

Safely downcast to the exact type as a const pointer.

Referenced by pcapxx::frame_descriptor< PCAPDescriptor >::frame_descriptor().

template<class Bottom>
static_base< Bottom >::exact_type * tool::static_base< Bottom >::exact_ptr (  )  [inline, inherited]

Safely downcast to the exact type as a non-const pointer.


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

Generated on Wed Jul 30 19:51:35 2008 for wipal by  doxygen 1.5.6