libtins
4.0
|
Allows parsing RadioTap options. More...
#include <radiotap_parser.h>
Classes | |
struct | FieldMetadata |
Public Types | |
enum | NamespaceType { RADIOTAP_NS, VENDOR_NS, UNKNOWN_NS } |
Public Member Functions | |
RadioTapParser (const std::vector< uint8_t > &buffer) | |
Constructs a RadioTap parser around a payload. More... | |
NamespaceType | current_namespace () const |
uint32_t | current_namespace_index () const |
Gets a 0 index based namespace index. More... | |
RadioTap::PresentFlags | current_field () const |
RadioTap::option | current_option () |
const uint8_t * | current_option_ptr () const |
bool | advance_field () |
Advances to the next option. More... | |
bool | advance_namespace () |
Advances to the next namespace. More... | |
RadioTap::PresentFlags | namespace_flags () const |
bool | skip_to_field (RadioTap::PresentFlags flag) |
Skips all fields until the provided one is found. More... | |
bool | has_fields () const |
bool | has_field (RadioTap::PresentFlags flag) const |
Indicates whether the provided field is set. More... | |
Static Public Attributes | |
static const FieldMetadata | RADIOTAP_METADATA [] |
static const uint32_t | MAX_RADIOTAP_FIELD |
Allows parsing RadioTap options.
RadioTap is a somehow tricky protocol to be parsed, as it has ordered flags, alignment between options, etc. This class allows parsing options in a RadioTap header without much trouble.
Represents the RadioTap namespace currently being parsed
Tins::Utils::RadioTapParser::RadioTapParser | ( | const std::vector< uint8_t > & | buffer | ) |
Constructs a RadioTap parser around a payload.
Note that the payload is not copied, hence it must be kept in scope while the parser is still being used.
The buffer should contain an entire RadioTap header, with optionally extra data at the end, which will be ignored.
buffer | The buffer to be parsed |
bool Tins::Utils::RadioTapParser::advance_field | ( | ) |
Advances to the next option.
If there's a namespace change, this will handle that as well.
bool Tins::Utils::RadioTapParser::advance_namespace | ( | ) |
Advances to the next namespace.
RadioTap::PresentFlags Tins::Utils::RadioTapParser::current_field | ( | ) | const |
Gets the current field being parsed
RadioTapParser::NamespaceType Tins::Utils::RadioTapParser::current_namespace | ( | ) | const |
Gets the current namespace being parsed
uint32_t Tins::Utils::RadioTapParser::current_namespace_index | ( | ) | const |
Gets a 0 index based namespace index.
This index will be incremented every time a new namespace is found
RadioTap::option Tins::Utils::RadioTapParser::current_option | ( | ) |
Gets the option the parsed is currently pointing at
const uint8_t * Tins::Utils::RadioTapParser::current_option_ptr | ( | ) | const |
Gets the pointer at which the current option is located
bool Tins::Utils::RadioTapParser::has_field | ( | RadioTap::PresentFlags | flag | ) | const |
Indicates whether the provided field is set.
This will look the field up in all flag sets and not just the current one
bool Tins::Utils::RadioTapParser::has_fields | ( | ) | const |
Indicates whether this RadioTap options buffer contains any fields set
RadioTap::PresentFlags Tins::Utils::RadioTapParser::namespace_flags | ( | ) | const |
Gets the current namespace's flags
bool Tins::Utils::RadioTapParser::skip_to_field | ( | RadioTap::PresentFlags | flag | ) |
Skips all fields until the provided one is found.
This will effectively move the current option pointer until the field is found or the end of the options list is reached
|
static |
Represents the maximum bit we have information for
|
static |
Contains metadata for each data field in RadioTap