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_SIMPLE_MERGE_HH_
00023 # define WIFI_FRAME_FILTER_SIMPLE_MERGE_HH_
00024
00025 # include <trace-tools/tool/iterator.hh>
00026 # include <trace-tools/tool/iterable.hh>
00027 # include <trace-tools/wifi/addr_mapping.hh>
00028
00029
00030
00031
00032 namespace wifi
00033 {
00034 namespace frame
00035 {
00036 namespace filter
00037 {
00038
00039 namespace internals
00040 {
00041 template <class, class, class, class, class>
00042 struct simple_merge_iterator;
00043 }
00044
00045 template <class, class, class, class>
00046 struct simple_merge;
00047
00048 }
00049 }
00050 }
00051
00052
00053
00054
00055
00056
00057 namespace tool
00058 {
00059
00060 template <class HT, class I1, class I2, class B1, class B2>
00061 struct types< wifi::frame::filter::internals::
00062 simple_merge_iterator<HT, I1, I2, B1, B2> >
00063 {
00064 typedef typename I1::value_type value_type;
00065 typedef wifi::frame::filter::simple_merge<HT, I1, I2, B1> iterable_type;
00066 };
00067
00068 template <class HT, class I1, class I2, class B>
00069 struct types< wifi::frame::filter::simple_merge<HT, I1, I2, B> >
00070 {
00071 typedef wifi::frame::filter::internals::
00072 simple_merge_iterator<HT, I1, I2, B, bottom>
00073 iterator;
00074 };
00075
00076 }
00077
00078
00079
00080
00081
00082
00083 namespace wifi
00084 {
00085 namespace frame
00086 {
00087 namespace filter
00088 {
00089
00090 namespace internals
00091 {
00092 template <class HT,
00093 class I1, class I2,
00094 class B, class Bottom = tool::bottom>
00095 struct simple_merge_iterator:
00096 tt_inherit(public tool::iterator,
00097 simple_merge_iterator<HT, I1, I2, B, Bottom>)
00098 {
00099
00101
00102 typedef tt_get_exact(Bottom, simple_merge_iterator<HT, I1, I2,
00103 B, Bottom>)
00104 exact_type;
00105 typedef tool::iterator<exact_type> super_type;
00106 typedef tt_type(value_type, exact_type) value_type;
00107 typedef tt_type(iterable_type, exact_type) iterable_type;
00109
00111 simple_merge_iterator(const iterable_type& i, bool end);
00112
00114
00115 bool equal(const simple_merge_iterator& rhs) const;
00116 void increment();
00117
00118 const value_type& get() const;
00119 value_type& get();
00120
00121 const value_type* get_ptr() const;
00122 value_type* get_ptr();
00124
00125 private:
00127 int first_packet() const;
00128
00129 const iterable_type* iterable_;
00130
00131 I1 next1_;
00132 I2 next2_;
00133 int current_;
00134 };
00135
00136 template <class HT>
00137 bool
00138 equal(const pcapxx::frame_descriptor& lhs,
00139 const pcapxx::frame_descriptor& rhs,
00140 tool::endian::endianness phy_end);
00141
00142 }
00143
00144
00145 template <class HeaderType,
00146 class InputIterator1,
00147 class InputIterator2,
00148 class Bottom = tool::bottom>
00149 struct simple_merge:
00150 tt_inherit(public tool::iterable, simple_merge<HeaderType,
00151 InputIterator1,
00152 InputIterator2,
00153 Bottom>)
00154 {
00155 simple_merge(const InputIterator1& first1, const InputIterator1& last1,
00156 const InputIterator2& first2, const InputIterator2& last2,
00157 tool::endian::endianness phy_end);
00158
00159 private:
00160 tool::endian::endianness phy_end_;
00161
00162 InputIterator1 first1_;
00163 InputIterator1 last1_;
00164 InputIterator2 first2_;
00165 InputIterator2 last2_;
00166
00167 friend
00168 class internals::simple_merge_iterator<HeaderType,
00169 InputIterator1,
00170 InputIterator2,
00171 Bottom,
00172 tool::bottom>;
00173 };
00174
00185 template <class UniqueId,
00186 class HeaderType,
00187 template <class, class, class> class Intersector,
00188 class I1, class I2, class F>
00189 void
00190 provide_simple_merge(const I1& first1, const I1& last1,
00191 const I2& first2, const I2& last2,
00192 addr_mapping& mapping,
00193 F& func,
00194 bool filter_prism,
00195 tool::endian::endianness phy_end);
00196
00197 }
00198
00199 }
00200
00201 }
00202
00203 # include "simple_merge.hxx"
00204
00205 #endif