00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PHY_TIMETRACKER_HH_
00023 # define PHY_TIMETRACKER_HH_
00024
00025 # include <wipal/pcap/pkt.hh>
00026
00027 extern "C"
00028 {
00029 # include <time.h>
00030 # include <inttypes.h>
00031 }
00032
00033 # include <wipal/tool/static_base.hh>
00034 # include <wipal/tool/endianness.hh>
00035 # include <wipal/tool/microseconds.hh>
00036
00037 namespace wpl
00038 {
00039
00040 namespace phy
00041 {
00042
00055 template <class Bottom = tool::bottom>
00056 struct timetracker:
00057 WP_INHERIT(public tool::static_base, timetracker<Bottom>)
00058 {
00065 timetracker(bool force_pcap);
00066
00073 template <class UIntType>
00074 void
00075 tick_uint(UIntType ts);
00076
00084 void tick_tv(const struct timeval& tv);
00085
00087 template <class HeaderType, class S>
00088 void
00089 tick(const pkt::packet<S>& frame,
00090 tool::end::endianness phy_end);
00091
00093 tool::microseconds microseconds() const;
00094
00095 private:
00096 uint64_t last_stamp_;
00097 tool::microseconds ms_count_;
00098 bool force_pcap_;
00099 };
00100
00101 }
00102
00103 }
00104
00105 # include "timetracker.hxx"
00106
00107 #endif // ! PHY_TIMETRACKER_HH_