include/wipal/wifi/frame/dissector/dissector.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_DISSECTOR_DISSECTOR_HH_
00023 # define WIFI_FRAME_DISSECTOR_DISSECTOR_HH_
00024 
00025 # include <cstdlib>
00026 
00027 # include <wipal/wifi/frame/mgt.hh>
00028 # include <wipal/wifi/frame/dissector/status.hh>
00029 
00030 namespace wifi
00031 {
00032 
00033   namespace frame
00034   {
00035 
00036     struct dissector_default_hooks;
00037 
00074     template <class Hooks = dissector_default_hooks>
00075     struct dissector: public Hooks
00076     {
00078       dissector(const Hooks& = Hooks ());
00079 
00091       dissector(const void* frm, size_t caplen, const Hooks& hooks = Hooks ());
00092 
00094       dissector_status::status  status() const;
00095 
00106       void                      operator () (const void* frm, size_t caplen);
00107 
00109 
00110       Hooks&                    hooks();
00111       const Hooks&              hooks() const;
00113 
00114     private:
00115 
00117       enum length
00118       {
00119         control         = 2,
00120         duration        = 4,
00121         addr1           = 10,
00122         addr2           = 16,
00123         addr3           = 22,
00124         seqctl          = 24,
00125         addr4           = 30
00126       };
00127 
00128       void                      management_frame(const void*, size_t);
00129       void                      management_frame_dispatch(const mgt::header*,
00130                                                           size_t);
00131 
00132       void                      control_frame(const void*, size_t);
00133 
00134       void                      data_frame(const void*, size_t);
00135       void                      data_frame_dispatch(const void*, size_t);
00136 
00137       dissector_status::status  status_;
00138     };
00139 
00140   } // End of namespace frame.
00141 
00142 } // End of namespace wifi.
00143 
00144 # include "dissector.hxx"
00145 
00146 #endif // ! WIFI_FRAME_DISSECTOR_DISSECTOR_HH_

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