libtins
4.0
|
Represents a PDU option field. More...
#include <pdu_option.h>
Public Types | |
typedef uint8_t | data_type |
typedef OptionType | option_type |
Public Member Functions | |
PDUOption (option_type opt=option_type(), size_t length=0, const data_type *data=0) | |
Constructs a PDUOption. More... | |
PDUOption (const PDUOption &rhs) | |
Copy constructor. More... | |
PDUOption (PDUOption &&rhs) TINS_NOEXCEPT | |
Move constructor. More... | |
PDUOption & | operator= (PDUOption &&rhs) TINS_NOEXCEPT |
Move assignment operator. More... | |
PDUOption & | operator= (const PDUOption &rhs) |
Copy assignment operator. More... | |
~PDUOption () | |
Destructor. | |
template<typename ForwardIterator > | |
PDUOption (option_type opt, ForwardIterator start, ForwardIterator end) | |
Constructs a PDUOption from iterators, which indicate the data to be stored in it. More... | |
template<typename ForwardIterator > | |
PDUOption (option_type opt, uint16_t length, ForwardIterator start, ForwardIterator end) | |
Constructs a PDUOption from iterators, which indicate the data to be stored in it. More... | |
option_type | option () const |
void | option (option_type opt) |
const data_type * | data_ptr () const |
size_t | data_size () const |
Retrieves the length of this option's data. More... | |
size_t | length_field () const |
Retrieves the data length field. More... | |
template<typename T > | |
T | to () const |
Constructs a T from this PDUOption. More... | |
Represents a PDU option field.
Several PDUs, such as TCP, IP, Dot11 or DHCP contain options. All of them behave exactly the same way. This class represents those options.
The OptionType template parameter indicates the type that will be used to store this option's identifier.
|
inline |
Constructs a PDUOption.
opt | The option type. |
length | The option's data length. |
data | The option's data(if any). |
|
inline |
Copy constructor.
rhs | The PDUOption to be copied. |
|
inline |
Move constructor.
rhs | The PDUOption to be moved. |
|
inline |
Constructs a PDUOption from iterators, which indicate the data to be stored in it.
opt | The option type. |
start | The beginning of the option data. |
end | The end of the option data. |
|
inline |
Constructs a PDUOption from iterators, which indicate the data to be stored in it.
The length parameter indicates the contents of the length field when this option is serialized. Note that this can be different to std::distance(start, end).
opt | The option type. |
length | The length of this option. |
start | The beginning of the option data. |
end | The end of the option data. |
|
inline |
Retrieves this option's data.
If this method is called when data_size() == 0, dereferencing the returned pointer will result in undefined behaviour.
|
inline |
Retrieves the length of this option's data.
This is the actual size of the data.
|
inline |
Retrieves the data length field.
This is what the size field will contain when this option is serialized. It can differ from the actual data size.
This will be equal to data_size unless the constructor that takes both a data length and two iterators is used.
|
inline |
Move assignment operator.
rhs | The PDUOption to be moved. |
|
inline |
Copy assignment operator.
rhs | The PDUOption to be copied. |
|
inline |
Retrieves this option's type.
|
inline |
Sets this option's type
opt | The option type to be set. |
|
inline |