include/wipal/wifi/frame/filter/uniquely_identifiable.hh

00001 /*
00002  * WiPal - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 #ifndef WIFI_FRAME_FILTER_UNIQUELY_IDENTIFIABLE_HH_
00023 # define WIFI_FRAME_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/wifi/mactime_tracker.hh>
00029 # include <wipal/tool/iterable.hh>
00030 # include <wipal/wifi/addr_mapping.hh>
00031 
00032 # include "uniquely_identifiable_fwd.hh"
00033 
00034 /*--------------.
00035 | Virtual types |
00036 `--------------*/
00037 
00038 namespace tool
00039 {
00040 
00047   template <class U, class I, class H, class B1, class B2>
00048   struct types< wifi::frame::filter::internals::
00049                 uniquely_identifiable_iterator<U, I, H, B1, B2> >
00050   {
00051     typedef
00052       wifi::frame::filter::uniquely_identifiable<U, I, H, B1>   iterable_type;
00053     typedef tool::microseconds_stamp<U>                         value_type;
00054   };
00055 
00061   template <class U, class I, class H, class B>
00062   struct types< wifi::frame::filter::uniquely_identifiable<U, I, H, B> >
00063   {
00064     typedef wifi::frame::filter::internals::
00065       uniquely_identifiable_iterator<U, I, H, B, bottom>
00066       iterator;
00067   };
00068 
00069 } // End of namespace tool.
00070 
00071 /*-------------.
00072 | Declarations |
00073 `-------------*/
00074 
00075 namespace wifi
00076 {
00077   namespace frame
00078   {
00079 
00086     namespace filter
00087     {
00088 
00090       namespace internals
00091       {
00092 
00094         template <class U, class I, class H, class B, class Bottom>
00095         struct uniquely_identifiable_iterator:
00096           tt_inherit(public tool::valued_iterator,
00097                      uniquely_identifiable_iterator<U, I, H, B, Bottom>)
00098         {
00099 
00101 
00102           typedef tt_get_exact(Bottom,
00103                                uniquely_identifiable_iterator<U, I, H,
00104                                                               B, Bottom>)
00105                                                                 exact_type;
00106           typedef tool::valued_iterator<exact_type>             super_type;
00107           typedef tt_type(value_type, exact_type)               value_type;
00108           typedef tt_type(iterable_type, exact_type)            iterable_type;
00110 
00112           uniquely_identifiable_iterator(const iterable_type& uif, bool end);
00113 
00115 
00116           bool          equal(const uniquely_identifiable_iterator& rhs) const;
00117           void          increment();
00119 
00120         private:
00121           const iterable_type*  iterable_;
00122           I                     next_;
00123           mactime_tracker<>     mactime_;
00124         };
00125 
00126       } // End of namespace wifi::frame::filter::internals.
00127 
00128 
00130       template <class UniqueId,
00131                 class InputIterator,
00132                 class HeaderType,
00133                 class Bottom = tool::bottom>
00134       struct uniquely_identifiable:
00135         tt_inherit(public tool::iterable,
00136                    uniquely_identifiable<UniqueId, InputIterator, HeaderType,
00137                                          Bottom>)
00138       {
00143         uniquely_identifiable(const InputIterator&      begin,
00144                               const InputIterator&      end,
00145                               addr_mapping&             map,
00146                               tool::endian::endianness  phy_end);
00147 
00148       private:
00149         InputIterator                   begin_;
00150         InputIterator                   end_;
00151         addr_mapping*                   mapping_;
00152         tool::endian::endianness        phy_end_;
00153 
00154         friend
00155           class internals::uniquely_identifiable_iterator<UniqueId,
00156                                                           InputIterator,
00157                                                           HeaderType,
00158                                                           Bottom,
00159                                                           tool::bottom>;
00160       };
00161 
00172       template <class UniqueId, class HeaderType, class I, class F>
00173       void
00174       for_each_uniquely_identifiable(const I&                   first,
00175                                      const I&                   last,
00176                                      addr_mapping&              mapping,
00177                                      F&                         func,
00178                                      bool                       filter_prism,
00179                                      tool::endian::endianness   phy_end);
00180 
00182       template <class UniqueId, class HeaderType, class I, class F>
00183       void
00184       for_each_uniquely_identifiable(const I&                   first,
00185                                      const I&                   last,
00186                                      addr_mapping&              mapping,
00187                                      const F&                   func,
00188                                      bool                       filter_prism,
00189                                      tool::endian::endianness   phy_end);
00190 
00191     } // End of namespace wifi::frame::filter.
00192 
00193   } // End of namespace wifi::frame.
00194 
00195 } // End of namespace wifi.
00196 
00197 # include "uniquely_identifiable.hxx"
00198 
00199 #endif // ! WIFI_FRAME_FILTER_UNIQUELY_IDENTIFIABLE_HH_

Generated on Tue Jan 15 19:32:31 2008 for wipal by  doxygen 1.5.4