ICMPv6 header. More...
#include "icmpv6-header.h"
Public Member Functions | |
Icmpv6Header () | |
Constructor. More... | |
~Icmpv6Header () override | |
Destructor. More... | |
void | CalculatePseudoHeaderChecksum (Ipv6Address src, Ipv6Address dst, uint16_t length, uint8_t protocol) |
Calculate pseudo header checksum for IPv6. More... | |
uint32_t | Deserialize (Buffer::Iterator start) override |
Deserialize the packet. More... | |
uint16_t | GetChecksum () const |
Get the checksum. More... | |
uint8_t | GetCode () const |
Get the code field. More... | |
TypeId | GetInstanceTypeId () const override |
Get the instance type ID. More... | |
uint32_t | GetSerializedSize () const override |
Get the serialized size. More... | |
uint8_t | GetType () const |
Get the type field. More... | |
void | Print (std::ostream &os) const override |
Print information. More... | |
void | Serialize (Buffer::Iterator start) const override |
Serialize the packet. More... | |
void | SetChecksum (uint16_t checksum) |
Set the checksum. More... | |
void | SetCode (uint8_t code) |
Set the code field. More... | |
void | SetType (uint8_t type) |
Set the type. More... | |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start)=0 |
Deserialize the object from a buffer iterator. More... | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::Chunk | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the UID of this class. More... | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Attributes | |
bool | m_calcChecksum |
Checksum enable or not. More... | |
uint16_t | m_checksum |
The checksum. More... | |
Private Attributes | |
uint8_t | m_code |
The code. More... | |
uint8_t | m_type |
The type. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
ICMPv6 header.
Definition at line 37 of file icmpv6-header.h.
ICMPv6 error code : Destination Unreachable.
Enumerator | |
---|---|
ICMPV6_NO_ROUTE | |
ICMPV6_ADM_PROHIBITED | |
ICMPV6_NOT_NEIGHBOUR | |
ICMPV6_ADDR_UNREACHABLE | |
ICMPV6_PORT_UNREACHABLE |
Definition at line 88 of file icmpv6-header.h.
ICMPv6 error code : Parameter Error.
Enumerator | |
---|---|
ICMPV6_MALFORMED_HEADER | |
ICMPV6_UNKNOWN_NEXT_HEADER | |
ICMPV6_UNKNOWN_OPTION |
Definition at line 109 of file icmpv6-header.h.
ICMPv6 error code : Time Exceeded.
Enumerator | |
---|---|
ICMPV6_HOPLIMIT | |
ICMPV6_FRAGTIME |
Definition at line 100 of file icmpv6-header.h.
ICMPv6 Option type code.
Enumerator | |
---|---|
ICMPV6_OPT_LINK_LAYER_SOURCE | |
ICMPV6_OPT_LINK_LAYER_TARGET | |
ICMPV6_OPT_PREFIX | |
ICMPV6_OPT_REDIRECTED | |
ICMPV6_OPT_MTU |
Definition at line 76 of file icmpv6-header.h.
ICMPv6 type code.
Definition at line 43 of file icmpv6-header.h.
ns3::Icmpv6Header::Icmpv6Header | ( | ) |
|
override |
void ns3::Icmpv6Header::CalculatePseudoHeaderChecksum | ( | Ipv6Address | src, |
Ipv6Address | dst, | ||
uint16_t | length, | ||
uint8_t | protocol | ||
) |
Calculate pseudo header checksum for IPv6.
src | source address |
dst | destination address |
length | length |
protocol | the protocol number to use in the underlying IPv6 packet. |
Definition at line 162 of file icmpv6-header.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ns3::Buffer::Iterator::CalculateIpChecksum(), m_checksum, NS_LOG_FUNCTION, ns3::Ipv6Address::Serialize(), ns3::Buffer::Iterator::Write(), ns3::Buffer::Iterator::WriteU16(), and ns3::Buffer::Iterator::WriteU8().
Referenced by ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::Radvd::Send(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::Icmpv6L4Protocol::SendRS(), and ns3::Ipv6RawSocketImpl::SendTo().
|
overridevirtual |
Deserialize the packet.
start | start offset |
Implements ns3::Header.
Reimplemented in ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::Icmpv6TooBig, ns3::Icmpv6DestinationUnreachable, ns3::Icmpv6Echo, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6RA, ns3::Icmpv6NA, and ns3::Icmpv6NS.
Definition at line 124 of file icmpv6-header.cc.
References GetSerializedSize(), m_checksum, m_code, m_type, NS_LOG_FUNCTION, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU32(), ns3::Buffer::Iterator::ReadU8(), and two-ray-to-three-gpp-ch-calibration::start.
uint16_t ns3::Icmpv6Header::GetChecksum | ( | ) | const |
Get the checksum.
Definition at line 95 of file icmpv6-header.cc.
References m_checksum, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6NS::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6Echo::Print(), ns3::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6TooBig::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6ParameterError::Print(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6ParameterError::Serialize().
uint8_t ns3::Icmpv6Header::GetCode | ( | ) | const |
Get the code field.
Definition at line 81 of file icmpv6-header.cc.
References m_code, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6L4Protocol::Forward(), ns3::Icmpv6L4Protocol::HandleDestinationUnreachable(), ns3::Icmpv6L4Protocol::HandleParameterError(), ns3::Radvd::HandleRead(), ns3::Icmpv6L4Protocol::HandleTimeExceeded(), ns3::Icmpv6NS::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6TooBig::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6ParameterError::Print(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6ParameterError::Serialize().
|
overridevirtual |
Get the instance type ID.
Implements ns3::ObjectBase.
Reimplemented in ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::Icmpv6TooBig, ns3::Icmpv6DestinationUnreachable, ns3::Icmpv6Echo, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6RA, ns3::Icmpv6NA, and ns3::Icmpv6NS.
Definition at line 46 of file icmpv6-header.cc.
References GetTypeId(), and NS_LOG_FUNCTION.
|
overridevirtual |
Get the serialized size.
Implements ns3::Header.
Reimplemented in ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::Icmpv6TooBig, ns3::Icmpv6DestinationUnreachable, ns3::Icmpv6Echo, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6RA, ns3::Icmpv6NA, and ns3::Icmpv6NS.
Definition at line 117 of file icmpv6-header.cc.
References NS_LOG_FUNCTION.
Referenced by Deserialize(), and ns3::Icmpv6L4Protocol::SendMessage().
uint8_t ns3::Icmpv6Header::GetType | ( | ) | const |
Get the type field.
Definition at line 67 of file icmpv6-header.cc.
References m_type, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6L4Protocol::Forward(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Icmpv6NS::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6Echo::Print(), ns3::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6TooBig::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6ParameterError::Print(), IcmpV6EchoReplyTestCase::ReceivePkt(), IcmpV6TimeExceedTestCase::ReceivePkt(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6ParameterError::Serialize().
|
static |
Get the UID of this class.
Definition at line 36 of file icmpv6-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
overridevirtual |
Print information.
os | output stream |
Implements ns3::Header.
Reimplemented in ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::Icmpv6TooBig, ns3::Icmpv6DestinationUnreachable, ns3::Icmpv6Echo, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6RA, ns3::Icmpv6NA, and ns3::Icmpv6NS.
Definition at line 109 of file icmpv6-header.cc.
References m_checksum, m_code, m_type, and NS_LOG_FUNCTION.
|
overridevirtual |
Serialize the packet.
start | start offset |
Implements ns3::Header.
Reimplemented in ns3::Icmpv6ParameterError, ns3::Icmpv6TimeExceeded, ns3::Icmpv6TooBig, ns3::Icmpv6DestinationUnreachable, ns3::Icmpv6Echo, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6RA, ns3::Icmpv6NA, and ns3::Icmpv6NS.
Definition at line 139 of file icmpv6-header.cc.
References ns3::Buffer::Iterator::CalculateIpChecksum(), ns3::Buffer::Iterator::GetSize(), m_calcChecksum, m_checksum, m_code, m_type, ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, two-ray-to-three-gpp-ch-calibration::start, ns3::Buffer::Iterator::WriteU16(), ns3::Buffer::Iterator::WriteU32(), and ns3::Buffer::Iterator::WriteU8().
void ns3::Icmpv6Header::SetChecksum | ( | uint16_t | checksum | ) |
Set the checksum.
checksum | to set |
Definition at line 102 of file icmpv6-header.cc.
References m_checksum, and NS_LOG_FUNCTION.
void ns3::Icmpv6Header::SetCode | ( | uint8_t | code | ) |
Set the code field.
code | code to set |
Definition at line 88 of file icmpv6-header.cc.
References m_code, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6RA::Icmpv6RA(), ns3::Icmpv6Redirection::Icmpv6Redirection(), ns3::Icmpv6RS::Icmpv6RS(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6Echo::Deserialize(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6TooBig::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), IcmpV6EchoReplyTestCase::SendData(), IcmpV6TimeExceedTestCase::SendData(), ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable(), ns3::Icmpv6L4Protocol::SendErrorParameterError(), ns3::Icmpv6L4Protocol::SendErrorTimeExceeded(), and ns3::Icmpv6L4Protocol::SendErrorTooBig().
void ns3::Icmpv6Header::SetType | ( | uint8_t | type | ) |
Set the type.
type | type to set |
Definition at line 74 of file icmpv6-header.cc.
References m_type, NS_LOG_FUNCTION, and check-style-clang-format::type.
Referenced by ns3::Icmpv6DestinationUnreachable::Icmpv6DestinationUnreachable(), ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6ParameterError::Icmpv6ParameterError(), ns3::Icmpv6RA::Icmpv6RA(), ns3::Icmpv6Redirection::Icmpv6Redirection(), ns3::Icmpv6RS::Icmpv6RS(), ns3::Icmpv6TimeExceeded::Icmpv6TimeExceeded(), ns3::Icmpv6TooBig::Icmpv6TooBig(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6Echo::Deserialize(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6TooBig::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), IcmpV6EchoReplyTestCase::SendData(), and IcmpV6TimeExceedTestCase::SendData().
|
protected |
Checksum enable or not.
Definition at line 216 of file icmpv6-header.h.
Referenced by Serialize(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6Redirection::Serialize(), and ns3::Icmpv6Echo::Serialize().
|
protected |
The checksum.
Definition at line 221 of file icmpv6-header.h.
Referenced by ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6Redirection::Icmpv6Redirection(), CalculatePseudoHeaderChecksum(), Deserialize(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6Echo::Deserialize(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6TooBig::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), GetChecksum(), Print(), Serialize(), ns3::Icmpv6NS::Serialize(), and SetChecksum().
|
private |
The code.
Definition at line 232 of file icmpv6-header.h.
Referenced by Deserialize(), GetCode(), Print(), Serialize(), and SetCode().
|
private |
The type.
Definition at line 227 of file icmpv6-header.h.
Referenced by Deserialize(), GetType(), Print(), Serialize(), and SetType().