1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 04:54:28 +01:00

Use RadioTapParser/Writer in RadioTap

This commit is contained in:
Matias Fontanini
2017-05-25 07:56:23 -07:00
parent 8c7bf7d779
commit e1571e19a8
7 changed files with 224 additions and 472 deletions

View File

@@ -58,8 +58,6 @@ public:
UNKNOWN_NS
};
typedef PDUOption<RadioTap::PresentFlags, RadioTap> option;
/**
* Represents the size and alignment of each RadioTap field
*/
@@ -111,7 +109,7 @@ public:
/**
* Gets the option the parsed is currently pointing at
*/
option current_option();
RadioTap::option current_option();
/**
* Gets the pointer at which the current option is located
@@ -123,11 +121,24 @@ public:
*
* If there's a namespace change, this will handle that as well.
*
* \returns true iff advancing was successfull (e.g. false if we reached
* \return true iff advancing was successfull (e.g. false if we reached
* the end of the header)
*/
bool advance_field();
/**
* \brief Advances to the next namespace
*
* \return true iff advancing was successfull (e.g. false if we're currently
* in the last namespace)
*/
bool advance_namespace();
/**
* Gets the current namespace's flags
*/
RadioTap::PresentFlags namespace_flags() const;
/**
* \brief Skips all fields until the provided one is found
*

View File

@@ -32,11 +32,13 @@
#include <vector>
#include <stdint.h>
#include "radiotap_parser.h"
#include "radiotap.h"
namespace Tins {
namespace Utils {
class RadioTapParser;
/**
* \brief Writes RadioTap options into a buffer
*
@@ -65,7 +67,7 @@ public:
*
* \param option The option to be written
*/
bool write_option(const RadioTapParser::option& option);
void write_option(const RadioTap::option& option);
private:
std::vector<uint8_t> build_padding_vector(const uint8_t* last_ptr, RadioTapParser& parser);
void update_paddings(const std::vector<uint8_t>& paddings, uint32_t offset);