00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_TIME_CONVERTER_HH_
00023 # define WIFI_TIME_CONVERTER_HH_
00024
00025 extern "C"
00026 {
00027 # include <inttypes.h>
00028 }
00029
00030 # include <wipal/tool/static_base.hh>
00031 # include <wipal/tool/microseconds.hh>
00032
00033 namespace wpl
00034 {
00035
00036 namespace wifi
00037 {
00038
00054 template <class PhyHeaderType, class Bottom = tool::bottom>
00055 struct time_converter: WP_INHERIT(public tool::static_base,
00056 time_converter<PhyHeaderType, Bottom>)
00057 {
00059
00060 typedef WP_GET_EXACT(Bottom, time_converter<PhyHeaderType, Bottom>)
00061 exact_type;
00062 typedef tool::static_base<exact_type> super_type;
00064
00066 typedef struct timeval pcap_time_type;
00067
00069 typedef typename PhyHeaderType::time_type phy_time_type;
00070
00072 time_converter(const pcap_time_type& local_pcap_time,
00073 const phy_time_type& local_phy_time,
00074 const tool::microseconds& global_time);
00075
00077 struct time_values
00078 {
00080 time_values();
00081
00083 time_values(const pcap_time_type& pcap_time,
00084 const phy_time_type& phy_time);
00085
00087 pcap_time_type pcap_time;
00088
00090 phy_time_type phy_time;
00091 };
00092
00094 time_values operator () (const tool::microseconds& global_time) const;
00095
00096 private:
00097 time_values local_reference_;
00098 tool::microseconds global_reference_;
00099 };
00100
00101 }
00102
00103 }
00104
00105 # include "time_converter.hxx"
00106
00107 #endif // ! WIFI_TIME_CONVERTER_HH_