src/wscout_gui_ieee802_11_header.hh

00001 /*
00002  * WScout - Lightweight PCAP visualizer.
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 
00023 #ifndef WSCOUT_GUI_IEEE802_11_HEADER_HH_
00024 # define WSCOUT_GUI_IEEE802_11_HEADER_HH_
00025 
00026 # include <QtGui/QLabel>
00027 
00028 #include <trace-tools/wifi/frame/dissector/dissector.hh>
00029 #include <trace-tools/wifi/frame/dissector/default_hooks.hh>
00030 
00031 # include "wscout_gui_header_base.hh"
00032 
00033 namespace wscout
00034 {
00035 
00036   namespace gui
00037   {
00038 
00044     class IEEE80211Header:
00045       public HeaderBase<IEEE80211Header, protocol::IEEE802_11>
00046     {
00047       Q_OBJECT
00048 
00049       enum
00050       {
00051         before_addresses_spacing        = 16,
00052         default_spacing                 = 4,
00053         max_duration_len                = 16,
00054         max_desc_len                    = 32
00055       };
00056 
00057     public:
00059       IEEE80211Header(QWidget* parent = 0);
00060 
00062       virtual next_header       setup(const void*                       header,
00063                                       size_t                            caplen,
00064                                       const Trace&                      trace,
00065                                       const pcapxx::frame_descriptor&   desc);
00066 
00067     protected:
00069       void                      setColor(const QColor fore, const QColor back);
00070 
00071     private:
00072 
00073       struct ieee80211_hooks: public wifi::frame::dissector_default_hooks
00074       {
00075         ieee80211_hooks(IEEE80211Header& h);
00076 
00077         void    frame_hook(const void*, size_t);
00078         void    addr_hook(const void*, size_t, unsigned, const wifi::addr&);
00079         void    seq_ctl_hook(const void*, size_t, unsigned, unsigned);
00080         void    management_hook(const wifi::frame::mgt::header*, size_t);
00081         void    control_hook(const void*, size_t);
00082         void    data_hook(const void*, size_t);
00083         void    invalid_type_hook(const void*, size_t);
00084         void    truncated_frame_hook(const void*, size_t,
00085                                      wifi::frame::dissector_status::status);
00086 
00087       protected:
00088 
00090         struct attributes
00091         {
00092           std::string   desc;   
00093           QColor        fore;   
00094           QColor        back;   
00095         };
00096 
00097         void    setDesc(const attributes& attr);
00098         void    setControl(const void*);
00099 
00100         static const QColor     black;
00101         static const QColor     lightblue;
00102         static const QColor     lightgreen;
00103         static const QColor     red;
00104         static const QColor     white;
00105         static const QColor     yellow;
00106 
00107       private:
00108         IEEE80211Header&        h_;
00109       };
00110 
00111       QLabel    desc;
00112       QLabel    flags;
00113       QLabel    duration;
00114       QLabel    seq_ctl;
00115       QLabel    addr[4];
00116       QFrame    addr_sep[3];
00117     };
00118 
00119   } // End of namespace gui.
00120 
00121 } // End of namespace wscout.
00122 
00123 #endif // ! WSCOUT_GUI_IEEE802_11_HEADER_HH_

Generated on Tue Nov 13 13:48:05 2007 for WScout by  doxygen 1.5.3-20071008