A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::OptionField Class Reference

Option field for an IPv6ExtensionHeader Enables adding options to an IPv6ExtensionHeader. More...

#include <ipv6-extension-header.h>

+ Inheritance diagram for ns3::OptionField:

Public Member Functions

 OptionField (uint32_t optionsOffset)
 Constructor. More...
 
 ~OptionField ()
 Destructor.
 
void AddOption (Ipv6OptionHeader const &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 ()
 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.
 
uint32_t m_optionsOffset
 Offset.
 

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

Constructor & Destructor Documentation

OptionField::OptionField ( uint32_t  optionsOffset)

Constructor.

Parameters
optionsOffsetoption offset

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

Member Function Documentation

uint32_t OptionField::CalculatePad ( Ipv6OptionHeader::Alignment  alignment) const
private
uint32_t OptionField::Deserialize ( Buffer::Iterator  start,
uint32_t  length 
)

Deserialize the packet.

Parameters
startBuffer iterator
lengthlength
Returns
size of the packet

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

References ns3::Buffer::AddAtEnd(), ns3::Buffer::Begin(), m_optionData, ns3::Buffer::Iterator::Read(), and ns3::Buffer::Iterator::Write().

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

Buffer OptionField::GetOptionBuffer ( )

Get the buffer.

Returns
buffer

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

References m_optionData.

uint32_t OptionField::GetOptionsOffset ( )

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 191 of file ipv6-extension-header.cc.

References m_optionsOffset.

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

uint32_t OptionField::GetSerializedSize ( void  ) const

Get the serialized size of the packet.

Returns
size

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

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

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


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