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_NON_NOISY_PRISM_HH_
00023 # define WIFI_FRAME_FILTER_NON_NOISY_PRISM_HH_
00024
00025 # include <wipal/tool/iterator.hh>
00026 # include <wipal/tool/iterable.hh>
00027
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>
00042 struct non_noisy_prism_iterator;
00043 }
00044
00045 template <class, class>
00046 struct non_noisy_prism;
00047 }
00048 }
00049 }
00050
00051
00052
00053
00054
00055
00056 namespace tool
00057 {
00058
00065 template <class I, class B1, class B2>
00066 struct types< wifi::frame::filter::internals::
00067 non_noisy_prism_iterator<I, B1, B2> >
00068 {
00069 typedef wifi::frame::filter::non_noisy_prism<I, B1> iterable_type;
00070 typedef typename I::value_type value_type;
00071 };
00072
00078 template <class I, class B>
00079 struct types< wifi::frame::filter::non_noisy_prism<I, B> >
00080 {
00081 typedef
00082 wifi::frame::filter::internals::non_noisy_prism_iterator<I, B, bottom>
00083 iterator;
00084 };
00085
00086 }
00087
00088
00089
00090
00091
00092
00093 namespace wifi
00094 {
00095 namespace frame
00096 {
00097 namespace filter
00098 {
00099
00100 namespace internals
00101 {
00102
00104 template <class I, class B, class Bottom>
00105 struct non_noisy_prism_iterator:
00106 tt_inherit(public tool::iterator,
00107 non_noisy_prism_iterator<I, B, Bottom>)
00108 {
00109
00111
00112 typedef tt_get_exact(Bottom, non_noisy_prism_iterator<I, B, Bottom>)
00113 exact_type;
00114 typedef tool::iterator<exact_type> super_type;
00115 typedef tt_type(value_type, exact_type) value_type;
00116 typedef tt_type(iterable_type, exact_type) iterable_type;
00118
00120 non_noisy_prism_iterator(const iterable_type& i, bool end);
00121
00123
00124 bool equal(const non_noisy_prism_iterator& rhs) const;
00125 void increment();
00126
00127 const value_type& get() const;
00128 value_type& get();
00129
00130 const value_type* get_ptr() const;
00131 value_type* get_ptr();
00133
00134 private:
00136 static bool noisy(const void* frame, size_t caplen);
00137
00139 void skip_noisy();
00140
00141 const iterable_type* iterable_;
00142 I current_;
00143 };
00144
00145 }
00146
00147
00149 template <class InputIterator, class Bottom = tool::bottom>
00150 struct non_noisy_prism: tt_inherit(public tool::iterable,
00151 non_noisy_prism<InputIterator, Bottom>)
00152 {
00154 non_noisy_prism(const InputIterator& begin, const InputIterator& end);
00155
00157 template <class Iterable>
00158 non_noisy_prism(const Iterable& i);
00159
00160 private:
00161 InputIterator begin_;
00162 InputIterator end_;
00163
00164 friend class internals::non_noisy_prism_iterator<InputIterator,
00165 Bottom, tool::bottom>;
00166 };
00167
00168 }
00169
00170 }
00171
00172 }
00173
00174 # include "non_noisy_prism.hxx"
00175
00176 #endif