1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Allow constructing RadioTapParser from an empty buffer

This commit is contained in:
Matias Fontanini
2017-05-21 13:09:53 -07:00
parent a641589b09
commit 4e95797710
3 changed files with 29 additions and 21 deletions

View File

@@ -60,22 +60,6 @@ public:
typedef PDUOption<uint8_t, RadioTap> option;
/**
* The RadioTap header
*/
TINS_BEGIN_PACK
struct RadiotapHeader {
#if TINS_IS_LITTLE_ENDIAN
uint8_t version;
uint8_t padding;
#else
uint8_t padding;
uint8_t version;
#endif // TINS_IS_LITTLE_ENDIAN
uint16_t length;
uint32_t flags;
} TINS_END_PACK;
/**
* \brief Constructs a RadioTap parser around a payload
*
@@ -118,6 +102,11 @@ public:
* the end of the header)
*/
bool advance_field();
/**
* Indicates whether this RadioTap options buffer contains any fields set
*/
bool has_fields() const;
private:
const uint8_t* find_options_start() const;
bool advance_to_next_field(bool start_from_zero);