IEEE 802.11 frame parser. More...
#include <wipal/wifi/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 |
IEEE 802.11 frame parser.
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.
wpl::wifi::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. |
void wpl::wifi::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. |
dissector_status::status wpl::wifi::dissector< Hooks >::status | ( | ) | const [inline] |
Get the current parser state.