GHC ICMPv6 NHC Header - see RFC 7400 Section 5. More...
#include "sixlowpan-ghc.h"
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. | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
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:
Definition at line 530 of file sixlowpan-ghc.h.
| ns3::SixLowPanGhcIcmpv6::SixLowPanGhcIcmpv6 | ( | ) |
Definition at line 996 of file sixlowpan-ghc.cc.
References m_blob, and m_blobLength.
Referenced by GetTypeId().
Copy the GHC-compressed bytecode blob.
Definition at line 1076 of file sixlowpan-ghc.cc.
References m_blob, and m_blobLength.
Referenced by SixlowpanGhcHeaderTest::DoRun().
|
overridevirtual |
| start | an iterator which points to where the header should read from. |
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().
|
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).
| [in] | start | Start of the header. |
| [in] | end | End of the blob (end of the packet). |
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.
| uint32_t ns3::SixLowPanGhcIcmpv6::GetBlobLength | ( | ) | const |
Get the blob length.
Definition at line 1084 of file sixlowpan-ghc.cc.
References m_blobLength.
Referenced by SixlowpanGhcHeaderTest::DoRun().
|
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().
Implements ns3::ObjectBase.
Definition at line 1013 of file sixlowpan-ghc.cc.
References GetTypeId().
| SixLowPanDispatch::NhcDispatch_e ns3::SixLowPanGhcIcmpv6::GetNhcDispatchType | ( | ) | const |
Get the NhcDispatch type.
Definition at line 1062 of file sixlowpan-ghc.cc.
References ns3::SixLowPanDispatch::LOWPAN_GHC_ICMPV6.
Referenced by SixlowpanGhcHeaderTest::DoRun().
|
overridevirtual |
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().
|
static |
Get the type ID.
Definition at line 1003 of file sixlowpan-ghc.cc.
References SixLowPanGhcIcmpv6(), and ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
overridevirtual |
| os | output 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<<().
|
overridevirtual |
| start | an 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().
| void ns3::SixLowPanGhcIcmpv6::SetBlob | ( | const uint8_t * | blob, |
| uint32_t | size ) |
Set the GHC-compressed bytecode blob for the ICMPv6 body.
| [in] | blob | Buffer holding compressed bytecodes. |
| [in] | size | Blob 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().
|
staticconstexprprivate |
Fixed: 11011111.
Definition at line 594 of file sixlowpan-ghc.h.
Referenced by Deserialize(), and Serialize().
|
private |
GHC compressed bytecodes.
Definition at line 596 of file sixlowpan-ghc.h.
Referenced by SixLowPanGhcIcmpv6(), CopyBlob(), Deserialize(), Serialize(), and SetBlob().
|
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().
|
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().