ICMPv6 header. More...
#include "icmpv6-header.h"
Public Member Functions | |
Icmpv6Header () | |
Constructor. | |
~Icmpv6Header () override | |
Destructor. | |
void | CalculatePseudoHeaderChecksum (Ipv6Address src, Ipv6Address dst, uint16_t length, uint8_t protocol) |
Calculate pseudo header checksum for IPv6. | |
uint32_t | Deserialize (Buffer::Iterator start) override |
Deserialize the packet. | |
uint16_t | GetChecksum () const |
Get the checksum. | |
uint8_t | GetCode () const |
Get the code field. | |
TypeId | GetInstanceTypeId () const override |
Get the instance type ID. | |
uint32_t | GetSerializedSize () const override |
Get the serialized size. | |
uint8_t | GetType () const |
Get the type field. | |
void | Print (std::ostream &os) const override |
Print information. | |
void | Serialize (Buffer::Iterator start) const override |
Serialize the packet. | |
void | SetChecksum (uint16_t checksum) |
Set the checksum. | |
void | SetCode (uint8_t code) |
Set the code field. | |
void | SetType (uint8_t type) |
Set the type. | |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. | |
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 UID of this class. | |
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. | |
Protected Attributes | |
bool | m_calcChecksum |
Checksum enable or not. | |
uint16_t | m_checksum |
The checksum. | |
Private Attributes | |
uint8_t | m_code |
The code. | |
uint8_t | m_type |
The type. | |
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. | |
ICMPv6 header.
Definition at line 26 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 77 of file icmpv6-header.h.
ICMPv6 error code : Parameter Error.
Enumerator | |
---|---|
ICMPV6_MALFORMED_HEADER | |
ICMPV6_UNKNOWN_NEXT_HEADER | |
ICMPV6_UNKNOWN_OPTION |
Definition at line 98 of file icmpv6-header.h.
ICMPv6 error code : Time Exceeded.
Enumerator | |
---|---|
ICMPV6_HOPLIMIT | |
ICMPV6_FRAGTIME |
Definition at line 89 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 65 of file icmpv6-header.h.
ICMPv6 type code.
Definition at line 32 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 151 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::ForgeRS(), ns3::Radvd::Send(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::Icmpv6L4Protocol::SendRS(), and ns3::Ipv6RawSocketImpl::SendTo().
|
overridevirtual |
Deserialize the packet.
start | start offset |
Implements ns3::Header.
Reimplemented in ns3::Icmpv6NA, ns3::Icmpv6NS, ns3::Icmpv6ParameterError, ns3::Icmpv6RA, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6TimeExceeded, and ns3::Icmpv6TooBig.
Definition at line 113 of file icmpv6-header.cc.
References GetSerializedSize(), m_checksum, m_code, m_type, NS_LOG_FUNCTION, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU32(), and ns3::Buffer::Iterator::ReadU8().
uint16_t ns3::Icmpv6Header::GetChecksum | ( | ) | const |
Get the checksum.
Definition at line 84 of file icmpv6-header.cc.
References m_checksum, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6Echo::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6NS::Print(), ns3::Icmpv6ParameterError::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6TooBig::Print(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6TooBig::Serialize().
uint8_t ns3::Icmpv6Header::GetCode | ( | ) | const |
Get the code field.
Definition at line 70 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::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6NS::Print(), ns3::Icmpv6ParameterError::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6TooBig::Print(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6TooBig::Serialize().
|
overridevirtual |
Get the instance type ID.
Implements ns3::ObjectBase.
Reimplemented in ns3::Icmpv6NA, ns3::Icmpv6NS, ns3::Icmpv6ParameterError, ns3::Icmpv6RA, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6TimeExceeded, and ns3::Icmpv6TooBig.
Definition at line 35 of file icmpv6-header.cc.
References GetTypeId(), and NS_LOG_FUNCTION.
|
overridevirtual |
Get the serialized size.
Implements ns3::Header.
Reimplemented in ns3::Icmpv6NA, ns3::Icmpv6NS, ns3::Icmpv6ParameterError, ns3::Icmpv6RA, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6TimeExceeded, and ns3::Icmpv6TooBig.
Definition at line 106 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 56 of file icmpv6-header.cc.
References m_type, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6L4Protocol::Forward(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Icmpv6DestinationUnreachable::Print(), ns3::Icmpv6Echo::Print(), ns3::Icmpv6NA::Print(), ns3::Icmpv6NS::Print(), ns3::Icmpv6ParameterError::Print(), ns3::Icmpv6RA::Print(), ns3::Icmpv6Redirection::Print(), ns3::Icmpv6RS::Print(), ns3::Icmpv6TimeExceeded::Print(), ns3::Icmpv6TooBig::Print(), IcmpV6EchoReplyTestCase::ReceivePkt(), IcmpV6TimeExceedTestCase::ReceivePkt(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6Echo::Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6RA::Serialize(), ns3::Icmpv6Redirection::Serialize(), ns3::Icmpv6RS::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), and ns3::Icmpv6TooBig::Serialize().
|
static |
Get the UID of this class.
Definition at line 25 of file icmpv6-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
overridevirtual |
Print information.
os | output stream |
Implements ns3::Header.
Reimplemented in ns3::Icmpv6NA, ns3::Icmpv6NS, ns3::Icmpv6ParameterError, ns3::Icmpv6RA, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6TimeExceeded, and ns3::Icmpv6TooBig.
Definition at line 98 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::Icmpv6NA, ns3::Icmpv6NS, ns3::Icmpv6ParameterError, ns3::Icmpv6RA, ns3::Icmpv6Redirection, ns3::Icmpv6RS, ns3::Icmpv6TimeExceeded, and ns3::Icmpv6TooBig.
Definition at line 128 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, 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 91 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 77 of file icmpv6-header.cc.
References m_code, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6RA::Icmpv6RA(), ns3::Icmpv6Redirection::Icmpv6Redirection(), ns3::Icmpv6RS::Icmpv6RS(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6Echo::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6TooBig::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 63 of file icmpv6-header.cc.
References m_type, and NS_LOG_FUNCTION.
Referenced by ns3::Icmpv6DestinationUnreachable::Icmpv6DestinationUnreachable(), ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6ParameterError::Icmpv6ParameterError(), ns3::Icmpv6RA::Icmpv6RA(), ns3::Icmpv6Redirection::Icmpv6Redirection(), ns3::Icmpv6RS::Icmpv6RS(), ns3::Icmpv6TimeExceeded::Icmpv6TimeExceeded(), ns3::Icmpv6TooBig::Icmpv6TooBig(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6Echo::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6TooBig::Deserialize(), IcmpV6EchoReplyTestCase::SendData(), and IcmpV6TimeExceedTestCase::SendData().
|
protected |
Checksum enable or not.
Definition at line 205 of file icmpv6-header.h.
Referenced by ns3::Icmpv6Echo::Serialize(), Serialize(), ns3::Icmpv6NA::Serialize(), ns3::Icmpv6NS::Serialize(), ns3::Icmpv6Redirection::Serialize(), and ns3::Icmpv6RS::Serialize().
|
protected |
The checksum.
Definition at line 210 of file icmpv6-header.h.
Referenced by ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6Echo::Icmpv6Echo(), ns3::Icmpv6NA::Icmpv6NA(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6NS::Icmpv6NS(), ns3::Icmpv6Redirection::Icmpv6Redirection(), CalculatePseudoHeaderChecksum(), ns3::Icmpv6DestinationUnreachable::Deserialize(), ns3::Icmpv6Echo::Deserialize(), Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6ParameterError::Deserialize(), ns3::Icmpv6RA::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), ns3::Icmpv6RS::Deserialize(), ns3::Icmpv6TimeExceeded::Deserialize(), ns3::Icmpv6TooBig::Deserialize(), GetChecksum(), Print(), Serialize(), ns3::Icmpv6NS::Serialize(), and SetChecksum().
|
private |
The code.
Definition at line 221 of file icmpv6-header.h.
Referenced by Deserialize(), GetCode(), Print(), Serialize(), and SetCode().
|
private |
The type.
Definition at line 216 of file icmpv6-header.h.
Referenced by Deserialize(), GetType(), Print(), Serialize(), and SetType().