A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches

ICMPv6 header. More...

#include "icmpv6-header.h"

+ Inheritance diagram for ns3::Icmpv6Header:
+ Collaboration diagram for ns3::Icmpv6Header:

Public Types

enum  ErrorDestinationUnreachable_e {
  ICMPV6_NO_ROUTE = 0 , ICMPV6_ADM_PROHIBITED , ICMPV6_NOT_NEIGHBOUR , ICMPV6_ADDR_UNREACHABLE ,
  ICMPV6_PORT_UNREACHABLE
}
 ICMPv6 error code : Destination Unreachable. More...
 
enum  ErrorParameterError_e { ICMPV6_MALFORMED_HEADER = 0 , ICMPV6_UNKNOWN_NEXT_HEADER , ICMPV6_UNKNOWN_OPTION }
 ICMPv6 error code : Parameter Error. More...
 
enum  ErrorTimeExceeded_e { ICMPV6_HOPLIMIT = 0 , ICMPV6_FRAGTIME }
 ICMPv6 error code : Time Exceeded. More...
 
enum  OptionType_e {
  ICMPV6_OPT_LINK_LAYER_SOURCE = 1 , ICMPV6_OPT_LINK_LAYER_TARGET , ICMPV6_OPT_PREFIX , ICMPV6_OPT_REDIRECTED ,
  ICMPV6_OPT_MTU
}
 ICMPv6 Option type code. More...
 
enum  Type_e {
  ICMPV6_ERROR_DESTINATION_UNREACHABLE = 1 , ICMPV6_ERROR_PACKET_TOO_BIG , ICMPV6_ERROR_TIME_EXCEEDED , ICMPV6_ERROR_PARAMETER_ERROR ,
  ICMPV6_ECHO_REQUEST = 128 , ICMPV6_ECHO_REPLY , ICMPV6_SUBSCRIBE_REQUEST , ICMPV6_SUBSCRIBE_REPORT ,
  ICMPV6_SUBSCRIVE_END , ICMPV6_ND_ROUTER_SOLICITATION , ICMPV6_ND_ROUTER_ADVERTISEMENT , ICMPV6_ND_NEIGHBOR_SOLICITATION ,
  ICMPV6_ND_NEIGHBOR_ADVERTISEMENT , ICMPV6_ND_REDIRECTION , ICMPV6_ROUTER_RENUMBER , ICMPV6_INFORMATION_REQUEST ,
  ICMPV6_INFORMATION_RESPONSE , ICMPV6_INVERSE_ND_SOLICITATION , ICMPV6_INVERSE_ND_ADVERSTISEMENT , ICMPV6_MLDV2_SUBSCRIBE_REPORT ,
  ICMPV6_MOBILITY_HA_DISCOVER_REQUEST , ICMPV6_MOBILITY_HA_DISCOVER_RESPONSE , ICMPV6_MOBILITY_MOBILE_PREFIX_SOLICITATION , ICMPV6_SECURE_ND_CERTIFICATE_PATH_SOLICITATION ,
  ICMPV6_SECURE_ND_CERTIFICATE_PATH_ADVERTISEMENT , ICMPV6_EXPERIMENTAL_MOBILITY
}
 ICMPv6 type code. More...
 

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.
 

Detailed Description

ICMPv6 header.

Introspection did not find any typical Config paths.


No Attributes are defined for this type.
No TraceSources are defined for this type.
Group: Internet

Size of this type is 16 bytes (on a 64-bit architecture).

Definition at line 26 of file icmpv6-header.h.

Member Enumeration Documentation

◆ ErrorDestinationUnreachable_e

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.

◆ ErrorParameterError_e

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.

◆ ErrorTimeExceeded_e

ICMPv6 error code : Time Exceeded.

Enumerator
ICMPV6_HOPLIMIT 
ICMPV6_FRAGTIME 

Definition at line 89 of file icmpv6-header.h.

◆ OptionType_e

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.

◆ Type_e

ICMPv6 type code.

Enumerator
ICMPV6_ERROR_DESTINATION_UNREACHABLE 
ICMPV6_ERROR_PACKET_TOO_BIG 
ICMPV6_ERROR_TIME_EXCEEDED 
ICMPV6_ERROR_PARAMETER_ERROR 
ICMPV6_ECHO_REQUEST 
ICMPV6_ECHO_REPLY 
ICMPV6_SUBSCRIBE_REQUEST 
ICMPV6_SUBSCRIBE_REPORT 
ICMPV6_SUBSCRIVE_END 
ICMPV6_ND_ROUTER_SOLICITATION 
ICMPV6_ND_ROUTER_ADVERTISEMENT 
ICMPV6_ND_NEIGHBOR_SOLICITATION 
ICMPV6_ND_NEIGHBOR_ADVERTISEMENT 
ICMPV6_ND_REDIRECTION 
ICMPV6_ROUTER_RENUMBER 
ICMPV6_INFORMATION_REQUEST 
ICMPV6_INFORMATION_RESPONSE 
ICMPV6_INVERSE_ND_SOLICITATION 
ICMPV6_INVERSE_ND_ADVERSTISEMENT 
ICMPV6_MLDV2_SUBSCRIBE_REPORT 
ICMPV6_MOBILITY_HA_DISCOVER_REQUEST 
ICMPV6_MOBILITY_HA_DISCOVER_RESPONSE 
ICMPV6_MOBILITY_MOBILE_PREFIX_SOLICITATION 
ICMPV6_SECURE_ND_CERTIFICATE_PATH_SOLICITATION 
ICMPV6_SECURE_ND_CERTIFICATE_PATH_ADVERTISEMENT 
ICMPV6_EXPERIMENTAL_MOBILITY 

Definition at line 32 of file icmpv6-header.h.

Constructor & Destructor Documentation

◆ Icmpv6Header()

ns3::Icmpv6Header::Icmpv6Header ( )

Constructor.

Definition at line 41 of file icmpv6-header.cc.

References NS_LOG_FUNCTION.

◆ ~Icmpv6Header()

ns3::Icmpv6Header::~Icmpv6Header ( )
override

Destructor.

Definition at line 50 of file icmpv6-header.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ CalculatePseudoHeaderChecksum()

void ns3::Icmpv6Header::CalculatePseudoHeaderChecksum ( Ipv6Address src,
Ipv6Address dst,
uint16_t length,
uint8_t protocol )

Calculate pseudo header checksum for IPv6.

Parameters
srcsource address
dstdestination address
lengthlength
protocolthe 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().

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

◆ Deserialize()

uint32_t ns3::Icmpv6Header::Deserialize ( Buffer::Iterator start)
overridevirtual

Deserialize the packet.

Parameters
startstart offset
Returns
length of packet

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().

+ Here is the call graph for this function:

◆ GetChecksum()

◆ GetCode()

◆ GetInstanceTypeId()

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

Get the instance type ID.

Returns
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.

+ Here is the call graph for this function:

◆ GetSerializedSize()

uint32_t ns3::Icmpv6Header::GetSerializedSize ( ) const
overridevirtual

Get the serialized size.

Returns
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().

+ Here is the caller graph for this function:

◆ GetType()

◆ GetTypeId()

TypeId ns3::Icmpv6Header::GetTypeId ( )
static

Get the UID of this class.

Returns
UID

Definition at line 25 of file icmpv6-header.cc.

References 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::Icmpv6Header::Print ( std::ostream & os) const
overridevirtual

Print information.

Parameters
osoutput 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.

◆ Serialize()

void ns3::Icmpv6Header::Serialize ( Buffer::Iterator start) const
overridevirtual

Serialize the packet.

Parameters
startstart 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().

+ Here is the call graph for this function:

◆ SetChecksum()

void ns3::Icmpv6Header::SetChecksum ( uint16_t checksum)

Set the checksum.

Parameters
checksumto set

Definition at line 91 of file icmpv6-header.cc.

References m_checksum, and NS_LOG_FUNCTION.

◆ SetCode()

◆ SetType()

Member Data Documentation

◆ m_calcChecksum

bool ns3::Icmpv6Header::m_calcChecksum
protected

◆ m_checksum

◆ m_code

uint8_t ns3::Icmpv6Header::m_code
private

The code.

Definition at line 221 of file icmpv6-header.h.

Referenced by Deserialize(), GetCode(), Print(), Serialize(), and SetCode().

◆ m_type

uint8_t ns3::Icmpv6Header::m_type
private

The type.

Definition at line 216 of file icmpv6-header.h.

Referenced by Deserialize(), GetType(), Print(), Serialize(), and SetType().


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