00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FILTER_UNIQUELY_IDENTIFIABLE_HH_
00023 # define FILTER_UNIQUELY_IDENTIFIABLE_HH_
00024
00025 # include <wipal/tool/endianness.hh>
00026 # include <wipal/tool/microseconds_stamp.hh>
00027 # include <wipal/tool/valued_iterator.hh>
00028 # include <wipal/phy/timetracker.hh>
00029 # include <wipal/tool/iterable.hh>
00030 # include <wipal/wifi/addr_mapping.hh>
00031
00032 # include "uniquely_identifiable_fwd.hh"
00033
00034
00035
00036
00037
00038 namespace wpl
00039 {
00040
00041 namespace tool
00042 {
00043
00050 template <class U, class I, class H, class B1, class B2>
00051 struct types< wpl::filter::internals::
00052 uniquely_identifiable_iterator<U, I, H, B1, B2> >
00053 {
00054 typedef
00055 wpl::filter::uniquely_identifiable<U, I, H, B1> iterable_type;
00056 typedef tool::microseconds_stamp<U> value_type;
00057 };
00058
00064 template <class U, class I, class H, class B>
00065 struct types< wpl::filter::uniquely_identifiable<U, I, H, B> >
00066 {
00067 typedef wpl::filter::internals::
00068 uniquely_identifiable_iterator<U, I, H, B, bottom>
00069 iterator;
00070 };
00071
00072 }
00073
00074 }
00075
00076
00077
00078
00079
00080 namespace wpl
00081 {
00082
00089 namespace filter
00090 {
00091
00093 namespace internals
00094 {
00095
00097 template <class U, class I, class H, class B, class Bottom>
00098 struct uniquely_identifiable_iterator:
00099 WP_INHERIT(public tool::valued_iterator,
00100 uniquely_identifiable_iterator<U, I, H, B, Bottom>)
00101 {
00102
00104
00105 typedef WP_GET_EXACT(Bottom,
00106 uniquely_identifiable_iterator<U, I, H,
00107 B, Bottom>)
00108 exact_type;
00109 typedef tool::valued_iterator<exact_type> super_type;
00110 typedef WP_TYPE(value_type, exact_type) value_type;
00111 typedef WP_TYPE(iterable_type, exact_type) iterable_type;
00113
00115 uniquely_identifiable_iterator(const iterable_type& uif, bool end);
00116
00118
00119 bool equal(const uniquely_identifiable_iterator& rhs) const;
00120 void increment();
00122
00124 unsigned frame_count() const;
00125
00127 unsigned unique_frame_count() const;
00128
00129 private:
00130 const iterable_type* iterable_;
00131 I next_;
00132 phy::timetracker<> mactime_;
00133 unsigned frame_count_;
00134 unsigned uframe_count_;
00135 };
00136
00137 }
00138
00139
00141 template <class UniqueId,
00142 class InputIterator,
00143 class HeaderType,
00144 class Bottom = tool::bottom>
00145 struct uniquely_identifiable:
00146 WP_INHERIT(public tool::iterable,
00147 uniquely_identifiable<UniqueId, InputIterator, HeaderType,
00148 Bottom>)
00149 {
00154 uniquely_identifiable(const InputIterator& begin,
00155 const InputIterator& end,
00156 wifi::addr_mapping& map,
00157 tool::end::endianness phy_end,
00158 bool pcap_tstamps);
00159
00160 private:
00161 InputIterator begin_;
00162 InputIterator end_;
00163 wifi::addr_mapping* mapping_;
00164 tool::end::endianness phy_end_;
00165 bool pcap_tstamps_;
00166
00167 friend
00168 class internals::uniquely_identifiable_iterator<UniqueId,
00169 InputIterator,
00170 HeaderType,
00171 Bottom,
00172 tool::bottom>;
00173 };
00174
00184 template <class UniqueId, class HeaderType, class I, class F>
00185 void
00186 for_each_uniquely_identifiable(const I& first,
00187 const I& last,
00188 opt::list& options,
00189 F& func);
00190
00192 template <class UniqueId, class HeaderType, class I, class F>
00193 void
00194 for_each_uniquely_identifiable(const I& first,
00195 const I& last,
00196 opt::list& options,
00197 const F& func);
00198
00199 }
00200
00201 }
00202
00203 # include "uniquely_identifiable.hxx"
00204
00205 #endif // ! FILTER_UNIQUELY_IDENTIFIABLE_HH_