A Discrete-Event Network Simulator
API

Option field for an IPv6ExtensionHeader. More...

#include "ipv6-extension-header.h"

+ Inheritance diagram for ns3::OptionField:
+ Collaboration diagram for ns3::OptionField:

Public Member Functions

 OptionField (uint32_t optionsOffset)
 Constructor. More...
 
 ~OptionField ()
 Destructor. More...
 
void AddOption (const Ipv6OptionHeader &option)
 Serialize the option, prepending pad1 or padn option as necessary. More...
 
uint32_t Deserialize (Buffer::Iterator start, uint32_t length)
 Deserialize the packet. More...
 
Buffer GetOptionBuffer ()
 Get the buffer. More...
 
uint32_t GetOptionsOffset () const
 Get the offset where the options begin, measured from the start of the extension header. More...
 
uint32_t GetSerializedSize () const
 Get the serialized size of the packet. More...
 
void Serialize (Buffer::Iterator start) const
 Serialize all added options. More...
 

Private Member Functions

uint32_t CalculatePad (Ipv6OptionHeader::Alignment alignment) const
 Calculate padding. More...
 

Private Attributes

Buffer m_optionData
 Data payload. More...
 
uint32_t m_optionsOffset
 Offset. More...
 

Detailed Description

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 144 of file ipv6-extension-header.h.

Constructor & Destructor Documentation

◆ OptionField()

ns3::OptionField::OptionField ( uint32_t  optionsOffset)

Constructor.

Parameters
optionsOffsetoption offset

Definition at line 140 of file ipv6-extension-header.cc.

◆ ~OptionField()

ns3::OptionField::~OptionField ( )

Destructor.

Definition at line 146 of file ipv6-extension-header.cc.

Member Function Documentation

◆ AddOption()

void ns3::OptionField::AddOption ( const Ipv6OptionHeader option)

Serialize the option, prepending pad1 or padn option as necessary.

Parameters
optionthe option header to serialize

Definition at line 188 of file ipv6-extension-header.cc.

References ns3::Buffer::AddAtEnd(), 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 TestOptionWithoutAlignment::DoRun(), TestOptionWithAlignment::DoRun(), and TestFulfilledAlignment::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculatePad()

uint32_t ns3::OptionField::CalculatePad ( Ipv6OptionHeader::Alignment  alignment) const
private

Calculate padding.

Parameters
alignmentalignment
Returns
the number of pad bytes

Definition at line 213 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Deserialize()

uint32_t ns3::OptionField::Deserialize ( Buffer::Iterator  start,
uint32_t  length 
)

Deserialize the packet.

Parameters
startBuffer iterator
lengthlength
Returns
size of the packet

Definition at line 176 of file ipv6-extension-header.cc.

References ns3::Buffer::AddAtEnd(), ns3::Buffer::Begin(), m_optionData, two-ray-to-three-gpp-ch-calibration::start, and ns3::Buffer::Iterator::Write().

Referenced by ns3::Ipv6ExtensionHopByHopHeader::Deserialize(), and ns3::Ipv6ExtensionDestinationHeader::Deserialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOptionBuffer()

Buffer ns3::OptionField::GetOptionBuffer ( )

Get the buffer.

Returns
buffer

Definition at line 225 of file ipv6-extension-header.cc.

References m_optionData.

◆ GetOptionsOffset()

uint32_t ns3::OptionField::GetOptionsOffset ( ) const

Get the offset where the options begin, measured from the start of the extension header.

Returns
the offset from the start of the extension header

Definition at line 219 of file ipv6-extension-header.cc.

References m_optionsOffset.

Referenced by ns3::Ipv6ExtensionHopByHop::Process(), and ns3::Ipv6ExtensionDestination::Process().

+ Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::OptionField::GetSerializedSize ( ) const

Get the serialized size of the packet.

Returns
size

Definition at line 151 of file ipv6-extension-header.cc.

References CalculatePad(), ns3::Buffer::GetSize(), and m_optionData.

Referenced by ns3::Ipv6ExtensionHopByHopHeader::GetSerializedSize(), and ns3::Ipv6ExtensionDestinationHeader::GetSerializedSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Serialize()

void ns3::OptionField::Serialize ( Buffer::Iterator  start) const

Serialize all added options.

Parameters
startBuffer iterator

Definition at line 157 of file ipv6-extension-header.cc.

References ns3::Buffer::Begin(), CalculatePad(), ns3::Buffer::End(), m_optionData, NS_LOG_LOGIC, ns3::Ipv6OptionPad1Header::Serialize(), ns3::Ipv6OptionPadnHeader::Serialize(), and two-ray-to-three-gpp-ch-calibration::start.

Referenced by ns3::Ipv6ExtensionHopByHopHeader::Serialize(), and ns3::Ipv6ExtensionDestinationHeader::Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_optionData

Buffer ns3::OptionField::m_optionData
private

Data payload.

Definition at line 208 of file ipv6-extension-header.h.

Referenced by AddOption(), CalculatePad(), Deserialize(), GetOptionBuffer(), GetSerializedSize(), and Serialize().

◆ m_optionsOffset

uint32_t ns3::OptionField::m_optionsOffset
private

Offset.

Definition at line 213 of file ipv6-extension-header.h.

Referenced by CalculatePad(), and GetOptionsOffset().


The documentation for this class was generated from the following files: