#include <wipal/wifi/mactime_tracker.hh>
Public Types | |
typedef HIDDEN | exact_type |
Public Member Functions | |
mactime_tracker () | |
template<class UIntType> | |
void | tick_uint (UIntType ts) |
void | tick_tv (const struct timeval &tv) |
template<class HeaderType, class D> | |
void | tick (const pcapxx::frame_descriptor< D > &frame, tool::endian::endianness phy_end) |
tool::microseconds | microseconds () const |
Downcast methods | |
const exact_type & | exact () const |
exact_type & | exact () |
const exact_type * | exact_ptr () const |
exact_type * | exact_ptr () |
PHY headers have various fields that holds frames' arrival time on the medium. Some of them are only 32 bits long, thus wrapping every one hour and a half (roughly). This class tracks the evolution of such fields and maintains a microsecond count that does not wrap.
Just call the tick() method for every frames you get in your trace.
typedef HIDDEN tool::static_base< Bottom >::exact_type [inherited] |
Exact type for this template instanciation.
Reimplemented in pcapxx::descriptor< Bottom >, pcapxx::internals::frame_iterator< Descriptor, Bottom >, avs::header, phy::empty_time< Bottom >, phy::empty_header< Bottom >, phy::time< Bottom >, phy::uint64_time< Bottom >, phy::header< Bottom >, prism::time, prism::header, rtap::header, tool::iterable< Bottom >, tool::iterator< Bottom >, tool::valued_iterator< Bottom >, tool::window< InputIterator, WSize, Step, Bottom >, wifi::frame::filter::internals::non_noisy_prism_iterator< I, B, Bottom >, wifi::frame::filter::internals::uniquely_identifiable_iterator< U, I, H, B, Bottom >, wifi::time_converter< PhyHeaderType, Bottom >, phy::time< prism::time >, phy::header< rtap::header >, phy::header< prism::header >, phy::header< avs::header >, tool::iterable< internals::SI_unit< 8 > >, tool::iterable< HIDDEN >, tool::iterator< HIDDEN >, tool::valued_iterator< HIDDEN >, and wifi::time_converter< HeaderType >.
wifi::mactime_tracker< Bottom >::mactime_tracker | ( | ) | [inline] |
Default constructor - initialize the microsecond count to zero.
void wifi::mactime_tracker< Bottom >::tick_uint | ( | UIntType | ts | ) | [inline] |
Update the tracker with the given unsigned integer timestamp.
This method tracks wraparounds and maintains a consistent microsecond count.
void wifi::mactime_tracker< Bottom >::tick_tv | ( | const struct timeval & | tv | ) | [inline] |
Update the tracker with the given timeval
structure.
This method assumes timeval
structures never wrap around. A negative structure (tv_sec
< 0) will yield valid but negative microsecond counts).
void wifi::mactime_tracker< Bottom >::tick | ( | const pcapxx::frame_descriptor< D > & | frame, | |
tool::endian::endianness | phy_end | |||
) | [inline] |
Update the tracker according to the given frame.
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().
tool::microseconds wifi::mactime_tracker< Bottom >::microseconds | ( | ) | const [inline] |
Retrieve the current microsecond count without wraps.
const static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact | ( | ) | const [inline, inherited] |
Safely downcast to the exact type as a const reference.
Referenced by tool::iterable< Bottom >::begin(), phy::header< Bottom >::decapsulate(), tool::iterable< Bottom >::end(), phy::time< Bottom >::get(), phy::header< Bottom >::len(), phy::time< Bottom >::operator+(), phy::header< Bottom >::time_get(), and phy::header< Bottom >::time_set().
static_base< Bottom >::exact_type & tool::static_base< Bottom >::exact | ( | ) | [inline, inherited] |
Safely downcast to the exact type as a non-const reference.
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().
static_base< Bottom >::exact_type * tool::static_base< Bottom >::exact_ptr | ( | ) | [inline, inherited] |
Safely downcast to the exact type as a non-const pointer.