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 wifi
00034 {
00035
00051 template <class Bottom = tool::bottom>
00052 struct time_converter: tt_inherit(public tool::static_base,
00053 time_converter<Bottom>)
00054 {
00056
00057 typedef tt_get_exact(Bottom, time_converter<Bottom>) exact_type;
00058 typedef tool::static_base<exact_type> super_type;
00060
00062 typedef struct timeval pcaptime_type;
00063
00065 typedef uint32_t hosttime_type;
00066
00068 typedef uint32_t mactime_type;
00069
00070
00072 time_converter(const pcaptime_type& local_pcaptime,
00073 const hosttime_type& local_hosttime,
00074 const mactime_type& local_mactime,
00075 const tool::microseconds& global_time);
00076
00078 struct time_values
00079 {
00081 time_values();
00082
00084 time_values(const pcaptime_type& pcaptime,
00085 const hosttime_type& hosttime,
00086 const mactime_type& mactime);
00087
00089 pcaptime_type pcaptime;
00090
00092 hosttime_type hosttime;
00093
00095 mactime_type mactime;
00096 };
00097
00099 time_values operator () (const tool::microseconds& global_time) const;
00100
00101 private:
00102 time_values local_reference_;
00103 tool::microseconds global_reference_;
00104 };
00105
00106 }
00107
00108 # include "time_converter.hxx"
00109
00110 #endif // ! WIFI_TIME_CONVERTER_HH_