00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_FRAME_FILTER_MERGE_HXX_
00023 # define WIFI_FRAME_FILTER_MERGE_HXX_
00024
00025 extern "C"
00026 {
00027 # include <sys/time.h>
00028 }
00029
00030 # include "merge.hh"
00031
00032 # include <wipal/wifi/frame/filter/time_adjuster.hh>
00033
00034 namespace wifi
00035 {
00036 namespace frame
00037 {
00038 namespace filter
00039 {
00040
00041 namespace internals
00042 {
00043
00044 template <class HeaderType, class FD1>
00045 equal<HeaderType, FD1>::
00046 equal(const pcapxx::frame_descriptor<FD1>& lhs,
00047 const tool::endian::endianness& phy_end):
00048 lhs_ (lhs),
00049 phy_end_ (phy_end)
00050 {
00051 }
00052
00053 template <class HeaderType, class FD1>
00054 template <class FD2>
00055 bool
00056 equal<HeaderType, FD1>::
00057 operator == (const pcapxx::frame_descriptor<FD2>& rhs) const
00058 {
00059 return HeaderType::eq_time_and_80211(lhs_, rhs, phy_end_);
00060 }
00061
00062 template <class HT, class FD1>
00063 equal<HT, FD1>
00064 make_equal(const pcapxx::frame_descriptor<FD1>& lhs,
00065 const tool::endian::endianness& phy_end)
00066 {
00067 return equal<HT, FD1> (lhs, phy_end);
00068 }
00069
00070 template <class HT, class FD1, class FD2>
00071 bool
00072 operator == (const pcapxx::frame_descriptor<FD2>& lhs,
00073 const equal<HT, FD1>& rhs)
00074 {
00075 return rhs == lhs;
00076 }
00077
00078 template <class HT, template <class, class, class, class> class Merger,
00079 class I, class F>
00080 struct provide_merge
00081 {
00082 provide_merge(const I& first2,
00083 const I& last2,
00084 F& func,
00085 bool filter_prism,
00086 tool::endian::endianness phy_end):
00087 first2_ (first2),
00088 last2_ (last2),
00089 func_ (func),
00090 filter_prism_ (filter_prism),
00091 phy_end_ (phy_end)
00092 {
00093 }
00094
00095 template <class TimeAdjuster>
00096 void
00097 operator () (const TimeAdjuster& a)
00098 {
00099 if (filter_prism_)
00100 {
00101 typedef non_noisy_prism<I> nnp;
00102 typedef typename nnp::const_iterator n_iterator;
00103 typedef microseconds_stamper<n_iterator, HT> us_stamper;
00104 typedef typename us_stamper::const_iterator u_iterator;
00105 typedef typename TimeAdjuster::const_iterator a_iterator;
00106 typedef
00107 Merger<HT, a_iterator, u_iterator, tool::bottom> merger;
00108
00109 nnp n (first2_, last2_);
00110 us_stamper s (n.begin(), n.end(), phy_end_);
00111 merger m (a.begin(), a.end(),
00112 s.begin(), s.end(), phy_end_);
00113
00114 func_(m);
00115 }
00116 else
00117 {
00118 typedef microseconds_stamper<I, HT> us_stamper;
00119 typedef typename us_stamper::const_iterator u_iterator;
00120 typedef typename TimeAdjuster::const_iterator a_iterator;
00121 typedef
00122 Merger<HT, a_iterator, u_iterator, tool::bottom> merger;
00123
00124 us_stamper s (first2_, last2_, phy_end_);
00125 merger m (a.begin(), a.end(),
00126 s.begin(), s.end(), phy_end_);
00127
00128 func_(m);
00129 }
00130 }
00131
00132 private:
00133 const I& first2_;
00134 const I& last2_;
00135 F& func_;
00136 bool filter_prism_;
00137 tool::endian::endianness phy_end_;
00138 };
00139
00140 }
00141
00142 template <class U, class HT,
00143 template <class, class, class> class Int,
00144 template <class, class, class, class> class Merger,
00145 class I1, class I2, class F, class BL>
00146 void
00147 provide_merge(const I1& first1, const I1& last1,
00148 const I2& first2, const I2& last2,
00149 addr_mapping& mapping,
00150 F& func,
00151 bool filter_prism,
00152 tool::endian::endianness phy_end,
00153 const BL& blist)
00154 {
00155 internals::provide_merge<HT, Merger, I2, F> func2 (first2, last2,
00156 func,
00157 filter_prism,
00158 phy_end);
00159
00160 provide_time_adjuster<U, HT, Int>(first1, last1,
00161 first2, last2,
00162 mapping, func2,
00163 filter_prism, phy_end, blist);
00164 }
00165
00166 }
00167
00168 }
00169
00170 }
00171
00172 #endif // ! WIFI_FRAME_FILTER_MERGE_HXX_