Option field for an IPv6ExtensionHeader. More...
#include "ipv6-extension-header.h"
Public Member Functions | |
OptionField (uint32_t optionsOffset) | |
Constructor. | |
~OptionField () | |
Destructor. | |
void | AddOption (const Ipv6OptionHeader &option) |
Serialize the option, prepending pad1 or padn option as necessary. | |
uint32_t | Deserialize (Buffer::Iterator start, uint32_t length) |
Deserialize the packet. | |
Buffer | GetOptionBuffer () |
Get the buffer. | |
uint32_t | GetOptionsOffset () const |
Get the offset where the options begin, measured from the start of the extension header. | |
uint32_t | GetSerializedSize () const |
Get the serialized size of the packet. | |
void | Serialize (Buffer::Iterator start) const |
Serialize all added options. | |
Private Member Functions | |
uint32_t | CalculatePad (Ipv6OptionHeader::Alignment alignment) const |
Calculate padding. | |
Private Attributes | |
Buffer | m_optionData |
Data payload. | |
uint32_t | m_optionsOffset |
Offset. | |
Option field for an IPv6ExtensionHeader.
Enables adding options to an IPv6ExtensionHeader.
Implementor's note: Make sure to add the result of OptionField::GetSerializedSize () to your IPv6ExtensionHeader::GetSerializedSize () return value. Call OptionField::Serialize and OptionField::Deserialize at the end of your corresponding IPv6ExtensionHeader methods.
Definition at line 133 of file ipv6-extension-header.h.
ns3::OptionField::OptionField | ( | uint32_t | optionsOffset | ) |
Constructor.
optionsOffset | option offset |
Definition at line 129 of file ipv6-extension-header.cc.
ns3::OptionField::~OptionField | ( | ) |
Destructor.
Definition at line 135 of file ipv6-extension-header.cc.
void ns3::OptionField::AddOption | ( | const Ipv6OptionHeader & | option | ) |
Serialize the option, prepending pad1 or padn option as necessary.
option | the option header to serialize |
Definition at line 177 of file ipv6-extension-header.cc.
References ns3::Buffer::AddAtEnd(), AddOption(), CalculatePad(), ns3::Buffer::End(), ns3::Ipv6OptionHeader::GetAlignment(), ns3::Ipv6OptionHeader::GetSerializedSize(), m_optionData, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Buffer::Iterator::Prev(), and ns3::Ipv6OptionHeader::Serialize().
Referenced by AddOption(), TestFulfilledAlignment::DoRun(), TestOptionWithAlignment::DoRun(), and TestOptionWithoutAlignment::DoRun().
|
private |
Calculate padding.
alignment | alignment |
Definition at line 202 of file ipv6-extension-header.cc.
References ns3::Ipv6OptionHeader::Alignment::factor, ns3::Buffer::GetSize(), m_optionData, m_optionsOffset, and ns3::Ipv6OptionHeader::Alignment::offset.
Referenced by AddOption(), GetSerializedSize(), and Serialize().
uint32_t ns3::OptionField::Deserialize | ( | Buffer::Iterator | start, |
uint32_t | length ) |
Deserialize the packet.
start | Buffer iterator |
length | length |
Definition at line 165 of file ipv6-extension-header.cc.
References ns3::Buffer::AddAtEnd(), ns3::Buffer::Begin(), m_optionData, and ns3::Buffer::Iterator::Write().
Referenced by ns3::Ipv6ExtensionDestinationHeader::Deserialize(), and ns3::Ipv6ExtensionHopByHopHeader::Deserialize().
Buffer ns3::OptionField::GetOptionBuffer | ( | ) |
Get the buffer.
Definition at line 214 of file ipv6-extension-header.cc.
References m_optionData.
uint32_t ns3::OptionField::GetOptionsOffset | ( | ) | const |
Get the offset where the options begin, measured from the start of the extension header.
Definition at line 208 of file ipv6-extension-header.cc.
References m_optionsOffset.
Referenced by ns3::Ipv6ExtensionDestination::Process(), and ns3::Ipv6ExtensionHopByHop::Process().
uint32_t ns3::OptionField::GetSerializedSize | ( | ) | const |
Get the serialized size of the packet.
Definition at line 140 of file ipv6-extension-header.cc.
References CalculatePad(), ns3::Buffer::GetSize(), and m_optionData.
Referenced by ns3::Ipv6ExtensionDestinationHeader::GetSerializedSize(), and ns3::Ipv6ExtensionHopByHopHeader::GetSerializedSize().
void ns3::OptionField::Serialize | ( | Buffer::Iterator | start | ) | const |
Serialize all added options.
start | Buffer iterator |
Definition at line 146 of file ipv6-extension-header.cc.
References ns3::Buffer::Begin(), CalculatePad(), ns3::Buffer::End(), m_optionData, NS_LOG_LOGIC, ns3::Ipv6OptionPad1Header::Serialize(), and ns3::Ipv6OptionPadnHeader::Serialize().
Referenced by ns3::Ipv6ExtensionDestinationHeader::Serialize(), and ns3::Ipv6ExtensionHopByHopHeader::Serialize().
|
private |
Data payload.
Definition at line 197 of file ipv6-extension-header.h.
Referenced by AddOption(), CalculatePad(), Deserialize(), GetOptionBuffer(), GetSerializedSize(), and Serialize().
|
private |
Offset.
Definition at line 202 of file ipv6-extension-header.h.
Referenced by CalculatePad(), and GetOptionsOffset().