00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 <wipal/wifi/frame/dissector/dissector.hh>
00029 #include <wipal/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 struct IEEE80211Header:
00045 public HeaderBase<IEEE80211Header, protocol::IEEE802_11>
00046 {
00047 enum
00048 {
00049 before_addresses_spacing = 16,
00050 default_spacing = 4,
00051 max_duration_len = 16,
00052 max_desc_len = 32
00053 };
00054
00056 IEEE80211Header(QWidget* parent = 0);
00057
00059 virtual next_header setup(const void* header,
00060 size_t caplen,
00061 const Trace& trace,
00062 const pcapxx::frame_descriptor& desc);
00063
00064 protected:
00066 void setColor(const QColor fore, const QColor back);
00067
00068 private:
00069
00070 struct ieee80211_hooks: public wifi::frame::dissector_default_hooks
00071 {
00072 ieee80211_hooks(IEEE80211Header& h);
00073
00074 void frame_hook(const void*, size_t);
00075 void addr_hook(const void*, size_t, unsigned, const wifi::addr&);
00076 void seq_ctl_hook(const void*, size_t, unsigned, unsigned);
00077 void end_of_frame_headers_hook(const void*, size_t, const void*);
00078 void management_hook(const wifi::frame::mgt::header*, size_t);
00079 void control_hook(const void*, size_t);
00080 void data_hook(const void*, size_t);
00081 void invalid_type_hook(const void*, size_t);
00082 void truncated_frame_hook(const void*, size_t,
00083 wifi::frame::dissector_status::status);
00084
00085 protected:
00086
00088 struct attributes
00089 {
00090 std::string desc;
00091 QColor fore;
00092 QColor back;
00093 protocol::id next;
00094 };
00095
00096 void setDesc(const attributes& attr);
00097 void setControl(const void*);
00098
00099 static const QColor black;
00100 static const QColor lightblue;
00101 static const QColor lightgreen;
00102 static const QColor red;
00103 static const QColor white;
00104 static const QColor yellow;
00105
00106 private:
00107 IEEE80211Header& h_;
00108 };
00109
00110 next_header next;
00111
00112 QLabel desc;
00113 QLabel flags;
00114 QLabel duration;
00115 QLabel seq_ctl;
00116 QLabel addr[4];
00117 QFrame addr_sep[3];
00118 };
00119
00120 }
00121
00122 }
00123
00124 #include "wscout_gui_ieee802_11_header.hxx"
00125
00126 #endif // ! WSCOUT_GUI_IEEE802_11_HEADER_HH_