ns-3
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:

List of all members.

Public Member Functions

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

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.


Constructor & Destructor Documentation

OptionField::OptionField ( uint32_t  optionsOffset)

Constructor.

Parameters:
optionsOffsetoption offset

Member Function Documentation

void OptionField::AddOption ( Ipv6OptionHeader const &  option)

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

Parameters:
optionthe option header to serialize

References ns3::Buffer::AddAtEnd(), ns3::Buffer::End(), ns3::Ipv6OptionHeader::GetAlignment(), ns3::Ipv6OptionHeader::GetSerializedSize(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ns3::Buffer::Iterator::Prev(), and ns3::Ipv6OptionHeader::Serialize().

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

Deserialize the packet.

Parameters:
startBuffer iterator
lengthlength
Returns:
size of the packet

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

Buffer OptionField::GetOptionBuffer ( )

Get the buffer.

Returns:
buffer
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

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

uint32_t OptionField::GetSerializedSize ( void  ) const

Get the serialized size of the packet.

Returns:
size

Reimplemented in ns3::Ipv6ExtensionDestinationHeader, and ns3::Ipv6ExtensionHopByHopHeader.

References ns3::Buffer::GetSize().


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