#include <wipal/wifi/frame/dissector/dissector.hh>
Public Member Functions | |
dissector (const Hooks &=Hooks()) | |
dissector (const void *frm, size_t caplen, const Hooks &hooks=Hooks()) | |
dissector_status::status | status () const |
void | operator() (const void *frm, size_t caplen) |
Hooks accessors | |
Hooks & | hooks () |
const Hooks & | hooks () const |
This class template provides mechanisms to parse IEEE 802.11 frames. Its template parameter should be a class that defines several hooks to be called at different parsing stages.
There is basically two modes of operation : triggering the parsing implicitly at object creation, or explicitly by calling operator()().
const void* frame = // ... const unsigned caplen = // ... my_hooks hooks1 = // ... my_hooks hooks2 = // ... dissector<my_hooks> d1 (hooks1); // No parsing done yet. dissector<my_hooks> d2 (frame, caplen, hooks2); // Implicitely parse // frame. d1(frame, caplen); // Do parse frame explicitely.
There is many different hooks. Look dissector_default_hooks's documentation for a list. Although subclassing dissector_default_hooks is a good idea in order to implement your set of hooks, this is not mandatory.
The status() method allows you to get the parser's status after the parsing. When this is relevant, this state is provided to hook functions as argument.
wifi::frame::dissector< Hooks >::dissector | ( | const Hooks & | hooks = Hooks () |
) | [inline] |
Construct a dissector but do not trigger parsing yet.
wifi::frame::dissector< Hooks >::dissector | ( | const void * | frm, | |
size_t | caplen, | |||
const Hooks & | hooks = Hooks () | |||
) | [inline] |
Construct a dissector and parse a frame.
[in] | frm | Pointer to the frame. |
[in] | caplen | Available bytes in the frame. The frame may be truncated. In such case, the parsing ends with the parsing in an intermediary state. |
[in] | hooks | The hooks to use. |
dissector_status::status wifi::frame::dissector< Hooks >::status | ( | ) | const [inline] |
void wifi::frame::dissector< Hooks >::operator() | ( | const void * | frm, | |
size_t | caplen | |||
) | [inline] |
Do parse a frame.
[in] | frm | Pointer to the frame. |
[in] | caplen | Available bytes in the frame. The frame may be truncated. In such case, the parsing ends with the parsing in an intermediary state. |
References wifi::frame::type::control, wifi::frame::type::data, wifi::frame::dissector_status::invalid, wifi::frame::type::management, wifi::frame::type_of(), and wifi::frame::dissector_status::valid_control.