00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_DISSECTOR_DISSECTOR_HH_
00023 # define WIFI_DISSECTOR_DISSECTOR_HH_
00024
00025 # include <cstdlib>
00026
00027 # include <wipal/pcap/pkt.hh>
00028 # include <wipal/wifi/mgt.hh>
00029 # include <wipal/wifi/dissector/status.hh>
00030
00031 namespace wpl
00032 {
00033
00034 namespace wifi
00035 {
00036
00037 struct dissector_default_hooks;
00038
00075 template <class Hooks = dissector_default_hooks>
00076 struct dissector: public Hooks
00077 {
00079 dissector(const Hooks& = Hooks ());
00080
00092 dissector(const void* frm, size_t caplen, const Hooks& hooks = Hooks ());
00093
00095 dissector_status::status status() const;
00096
00107 void operator () (const void* frm, size_t caplen);
00108
00110
00111 Hooks& hooks();
00112 const Hooks& hooks() const;
00114
00115 private:
00116
00118 enum length
00119 {
00120 control = 2,
00121 duration = 4,
00122 addr1 = 10,
00123 addr2 = 16,
00124 addr3 = 22,
00125 seqctl = 24,
00126 addr4 = 30
00127 };
00128
00129 void management_frame(const void*, size_t);
00130 void management_frame_dispatch(const mgt::header*,
00131 size_t);
00132
00133 void control_frame(const void*, size_t);
00134
00135 void data_frame(const void*, size_t);
00136 void data_frame_dispatch(const void*, size_t);
00137
00138 dissector_status::status status_;
00139 };
00140
00156 template <class PhyH, class Hooks, class Src>
00157 dissector<Hooks>
00158 dissect(const pkt::packet<Src>& frm,
00159 const Hooks& hooks = Hooks ());
00160
00161
00162 }
00163
00164 }
00165
00166 # include "dissector.hxx"
00167
00168 #endif // ! WIFI_DISSECTOR_DISSECTOR_HH_