A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::SixLowPanGhcIcmpv6 Class Reference

GHC ICMPv6 NHC Header - see RFC 7400 Section 5. More...

#include "sixlowpan-ghc.h"

Inheritance diagram for ns3::SixLowPanGhcIcmpv6:
Collaboration diagram for ns3::SixLowPanGhcIcmpv6:

Public Member Functions

 SixLowPanGhcIcmpv6 ()
uint32_t CopyBlob (uint8_t *blob, uint32_t size) const
 Copy the GHC-compressed bytecode blob.
uint32_t Deserialize (Buffer::Iterator start) override
uint32_t Deserialize (Buffer::Iterator start, Buffer::Iterator end) override
 Deserialize the header from the given buffer region.
uint32_t GetBlobLength () const
 Get the blob length.
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
SixLowPanDispatch::NhcDispatch_e GetNhcDispatchType () const
 Get the NhcDispatch type.
uint32_t GetSerializedSize () const override
void Print (std::ostream &os) const override
void Serialize (Buffer::Iterator start) const override
void SetBlob (const uint8_t *blob, uint32_t size)
 Set the GHC-compressed bytecode blob for the ICMPv6 body.
Public Member Functions inherited from ns3::Header
 ~Header () override
Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::Header
static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::Chunk
static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.

Static Public Attributes

static constexpr uint32_t MAX_BLOB_SIZE = 255
 Maximum blob size: the blob length field is 8 bits.

Private Attributes

uint8_t m_blob [MAX_BLOB_SIZE+1]
 GHC compressed bytecodes.
uint8_t m_blobLength
 Length of GHC compressed ICMPv6 body.

Static Private Attributes

static constexpr uint8_t GHC_ICMPV6_NHC = 0xDF
 Fixed: 11011111.

Additional Inherited Members

Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.

Detailed Description

GHC ICMPv6 NHC Header - see RFC 7400 Section 5.

Fixed NHC byte value 0xDF (11011111). This is the key GHC addition that fills the gap left by RFC 6282 which defines no ICMPv6 NHC. The entire ICMPv6 message body is compressed using GHC bytecodes.

*     0   1   2   3   4   5   6   7
*   +---+---+---+---+---+---+---+---+
*   | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
*   +---+---+---+---+---+---+---+---+
* 

This header enables compression of:

  • RPL control messages (DIO, DAO, DIS, DAO-ACK)
  • Neighbor Discovery messages (NS, NA, RS, RA)
  • Echo Request/Reply
  • Any ICMPv6 message

Definition at line 530 of file sixlowpan-ghc.h.

Constructor & Destructor Documentation

◆ SixLowPanGhcIcmpv6()

ns3::SixLowPanGhcIcmpv6::SixLowPanGhcIcmpv6 ( )

Definition at line 996 of file sixlowpan-ghc.cc.

References m_blob, and m_blobLength.

Referenced by GetTypeId().

Here is the caller graph for this function:

Member Function Documentation

◆ CopyBlob()

uint32_t ns3::SixLowPanGhcIcmpv6::CopyBlob ( uint8_t * blob,
uint32_t size ) const

Copy the GHC-compressed bytecode blob.

Parameters
[out]blobBuffer to copy blob into.
[in]sizeBuffer size.
Returns
Bytes copied.

Definition at line 1076 of file sixlowpan-ghc.cc.

References m_blob, and m_blobLength.

Referenced by SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ Deserialize() [1/2]

uint32_t ns3::SixLowPanGhcIcmpv6::Deserialize ( Buffer::Iterator start)
overridevirtual
Parameters
startan iterator which points to where the header should read from.
Returns
the number of bytes read.

This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.

Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.

Implements ns3::Header.

Definition at line 1038 of file sixlowpan-ghc.cc.

References NS_FATAL_ERROR.

Referenced by SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ Deserialize() [2/2]

uint32_t ns3::SixLowPanGhcIcmpv6::Deserialize ( Buffer::Iterator start,
Buffer::Iterator end )
overridevirtual

Deserialize the header from the given buffer region.

The GHC ICMPv6 wire format has no length field: the bytecode blob extends to the end of the packet (RFC 7400 Section 3). This variable-size variant must be used, through Packet::RemoveHeader(header, size).

Parameters
[in]startStart of the header.
[in]endEnd of the blob (end of the packet).
Returns
Bytes consumed.

Reimplemented from ns3::Header.

Definition at line 1045 of file sixlowpan-ghc.cc.

References GetSerializedSize(), GHC_ICMPV6_NHC, m_blob, m_blobLength, MAX_BLOB_SIZE, and NS_ASSERT.

Here is the call graph for this function:

◆ GetBlobLength()

uint32_t ns3::SixLowPanGhcIcmpv6::GetBlobLength ( ) const

Get the blob length.

Returns
Compressed bytecode length.

Definition at line 1084 of file sixlowpan-ghc.cc.

References m_blobLength.

Referenced by SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ GetInstanceTypeId()

TypeId ns3::SixLowPanGhcIcmpv6::GetInstanceTypeId ( ) const
overridevirtual

Get the most derived TypeId for this Object.

This method is provided by ns3::Object::GetInstanceTypeId but classes which derive from ns3::ObjectBase directly have to implement it themselves. Typically, this method should simply return the output of GetTypeId().

Returns
The TypeId associated to the most-derived type of this instance.

Implements ns3::ObjectBase.

Definition at line 1013 of file sixlowpan-ghc.cc.

References GetTypeId().

Here is the call graph for this function:

◆ GetNhcDispatchType()

SixLowPanDispatch::NhcDispatch_e ns3::SixLowPanGhcIcmpv6::GetNhcDispatchType ( ) const

Get the NhcDispatch type.

Returns
The NhcDispatch type (LOWPAN_GHC_ICMPV6).

Definition at line 1062 of file sixlowpan-ghc.cc.

References ns3::SixLowPanDispatch::LOWPAN_GHC_ICMPV6.

Referenced by SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::SixLowPanGhcIcmpv6::GetSerializedSize ( ) const
overridevirtual
Returns
the expected size of the header.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.

Implements ns3::Header.

Definition at line 1025 of file sixlowpan-ghc.cc.

References m_blobLength.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanGhcIcmpv6(), Deserialize(), and SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::SixLowPanGhcIcmpv6::GetTypeId ( )
static

Get the type ID.

Returns
The object TypeId.

Definition at line 1003 of file sixlowpan-ghc.cc.

References SixLowPanGhcIcmpv6(), and ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

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

◆ Print()

void ns3::SixLowPanGhcIcmpv6::Print ( std::ostream & os) const
overridevirtual
Parameters
osoutput stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5

Implements ns3::Header.

Definition at line 1019 of file sixlowpan-ghc.cc.

References m_blobLength.

Referenced by ns3::operator<<().

Here is the caller graph for this function:

◆ Serialize()

void ns3::SixLowPanGhcIcmpv6::Serialize ( Buffer::Iterator start) const
overridevirtual
Parameters
startan iterator which points to where the header should be written.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.

Implements ns3::Header.

Definition at line 1031 of file sixlowpan-ghc.cc.

References GHC_ICMPV6_NHC, m_blob, and m_blobLength.

Referenced by SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

◆ SetBlob()

void ns3::SixLowPanGhcIcmpv6::SetBlob ( const uint8_t * blob,
uint32_t size )

Set the GHC-compressed bytecode blob for the ICMPv6 body.

Parameters
[in]blobBuffer holding compressed bytecodes.
[in]sizeBlob length.

Definition at line 1068 of file sixlowpan-ghc.cc.

References m_blob, m_blobLength, MAX_BLOB_SIZE, and NS_ASSERT.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanGhcIcmpv6(), and SixlowpanGhcHeaderTest::DoRun().

Here is the caller graph for this function:

Member Data Documentation

◆ GHC_ICMPV6_NHC

uint8_t ns3::SixLowPanGhcIcmpv6::GHC_ICMPV6_NHC = 0xDF
staticconstexprprivate

Fixed: 11011111.

Definition at line 594 of file sixlowpan-ghc.h.

Referenced by Deserialize(), and Serialize().

◆ m_blob

uint8_t ns3::SixLowPanGhcIcmpv6::m_blob[MAX_BLOB_SIZE+1]
private

GHC compressed bytecodes.

Definition at line 596 of file sixlowpan-ghc.h.

Referenced by SixLowPanGhcIcmpv6(), CopyBlob(), Deserialize(), Serialize(), and SetBlob().

◆ m_blobLength

uint8_t ns3::SixLowPanGhcIcmpv6::m_blobLength
private

Length of GHC compressed ICMPv6 body.

Definition at line 595 of file sixlowpan-ghc.h.

Referenced by SixLowPanGhcIcmpv6(), CopyBlob(), Deserialize(), GetBlobLength(), GetSerializedSize(), Print(), Serialize(), and SetBlob().

◆ MAX_BLOB_SIZE

uint32_t ns3::SixLowPanGhcIcmpv6::MAX_BLOB_SIZE = 255
staticconstexpr

Maximum blob size: the blob length field is 8 bits.

Definition at line 570 of file sixlowpan-ghc.h.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanGhcIcmpv6(), Deserialize(), and SetBlob().


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