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

Packet header for IPv6. More...

#include "ipv6-header.h"

+ Inheritance diagram for ns3::Ipv6Header:
+ Collaboration diagram for ns3::Ipv6Header:

Public Types

enum  DscpType {
  DscpDefault = 0x00 , DSCP_CS1 = 0x08 , DSCP_AF11 = 0x0A , DSCP_AF12 = 0x0C ,
  DSCP_AF13 = 0x0E , DSCP_CS2 = 0x10 , DSCP_AF21 = 0x12 , DSCP_AF22 = 0x14 ,
  DSCP_AF23 = 0x16 , DSCP_CS3 = 0x18 , DSCP_AF31 = 0x1A , DSCP_AF32 = 0x1C ,
  DSCP_AF33 = 0x1E , DSCP_CS4 = 0x20 , DSCP_AF41 = 0x22 , DSCP_AF42 = 0x24 ,
  DSCP_AF43 = 0x26 , DSCP_CS5 = 0x28 , DSCP_EF = 0x2E , DSCP_CS6 = 0x30 ,
  DSCP_CS7 = 0x38
}
 DiffServ Code Points Code Points defined in Assured Forwarding (AF) RFC 2597 Expedited Forwarding (EF) RFC 2598 Default and Class Selector (CS) RFC 2474 More...
 
enum  EcnType { ECN_NotECT = 0x00 , ECN_ECT1 = 0x01 , ECN_ECT0 = 0x02 , ECN_CE = 0x03 }
 ECN field bits. More...
 
enum  NextHeader_e {
  IPV6_EXT_HOP_BY_HOP = 0 , IPV6_IPV4 = 4 , IPV6_TCP = 6 , IPV6_UDP = 17 ,
  IPV6_IPV6 = 41 , IPV6_EXT_ROUTING = 43 , IPV6_EXT_FRAGMENTATION = 44 , IPV6_EXT_CONFIDENTIALITY = 50 ,
  IPV6_EXT_AUTHENTICATION = 51 , IPV6_ICMPV6 = 58 , IPV6_EXT_END = 59 , IPV6_EXT_DESTINATION = 60 ,
  IPV6_SCTP = 135 , IPV6_EXT_MOBILITY = 135 , IPV6_UDP_LITE = 136
}
 IPv6 next-header value. More...
 

Public Member Functions

 Ipv6Header ()
 Constructor.
 
uint32_t Deserialize (Buffer::Iterator start) override
 Deserialize the packet.
 
std::string DscpTypeToString (DscpType dscp) const
 
std::string EcnTypeToString (EcnType ecn) const
 
Ipv6Address GetDestination () const
 Get the "Destination address" field.
 
DscpType GetDscp () const
 
EcnType GetEcn () const
 
uint32_t GetFlowLabel () const
 Get the "Flow label" field.
 
uint8_t GetHopLimit () const
 Get the "Hop limit" field (TTL).
 
TypeId GetInstanceTypeId () const override
 Return the instance type identifier.
 
uint8_t GetNextHeader () const
 Get the next header.
 
uint16_t GetPayloadLength () const
 Get the "Payload length" field.
 
uint32_t GetSerializedSize () const override
 Get the serialized size of the packet.
 
Ipv6Address GetSource () const
 Get the "Source address" field.
 
uint8_t GetTrafficClass () const
 Get the "Traffic class" field.
 
void Print (std::ostream &os) const override
 Print some information about the packet.
 
void Serialize (Buffer::Iterator start) const override
 Serialize the packet.
 
void SetDestination (Ipv6Address dst)
 Set the "Destination address" field.
 
void SetDscp (DscpType dscp)
 Set DSCP Field.
 
void SetEcn (EcnType ecn)
 Set ECN field bits.
 
void SetFlowLabel (uint32_t flow)
 Set the "Flow label" field.
 
void SetHopLimit (uint8_t limit)
 Set the "Hop limit" field (TTL).
 
void SetNextHeader (uint8_t next)
 Set the "Next header" field.
 
void SetPayloadLength (uint16_t len)
 Set the "Payload length" field.
 
void SetSource (Ipv6Address src)
 Set the "Source address" field.
 
void SetTrafficClass (uint8_t traffic)
 Set the "Traffic class" field.
 
- 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 type identifier.
 
- 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.
 

Private Attributes

Ipv6Address m_destinationAddress
 The destination address.
 
uint32_t m_flowLabel: 20
 The flow label.
 
uint8_t m_hopLimit
 The Hop limit value.
 
uint8_t m_nextHeader
 The Next header number.
 
uint16_t m_payloadLength
 The payload length.
 
Ipv6Address m_sourceAddress
 The source address.
 
uint32_t m_trafficClass: 8
 The traffic class.
 

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

Packet header for IPv6.

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 56 bytes (on a 64-bit architecture).

Definition at line 23 of file ipv6-header.h.

Member Enumeration Documentation

◆ DscpType

DiffServ Code Points Code Points defined in Assured Forwarding (AF) RFC 2597 Expedited Forwarding (EF) RFC 2598 Default and Class Selector (CS) RFC 2474

Enumerator
DscpDefault 
DSCP_CS1 
DSCP_AF11 
DSCP_AF12 
DSCP_AF13 
DSCP_CS2 
DSCP_AF21 
DSCP_AF22 
DSCP_AF23 
DSCP_CS3 
DSCP_AF31 
DSCP_AF32 
DSCP_AF33 
DSCP_CS4 
DSCP_AF41 
DSCP_AF42 
DSCP_AF43 
DSCP_CS5 
DSCP_EF 
DSCP_CS6 
DSCP_CS7 

Definition at line 34 of file ipv6-header.h.

◆ EcnType

ECN field bits.

Enumerator
ECN_NotECT 
ECN_ECT1 
ECN_ECT0 
ECN_CE 

Definition at line 139 of file ipv6-header.h.

◆ NextHeader_e

IPv6 next-header value.

Enumerator
IPV6_EXT_HOP_BY_HOP 
IPV6_IPV4 
IPV6_TCP 
IPV6_UDP 
IPV6_IPV6 
IPV6_EXT_ROUTING 
IPV6_EXT_FRAGMENTATION 
IPV6_EXT_CONFIDENTIALITY 
IPV6_EXT_AUTHENTICATION 
IPV6_ICMPV6 
IPV6_EXT_END 
IPV6_EXT_DESTINATION 
IPV6_SCTP 
IPV6_EXT_MOBILITY 
IPV6_UDP_LITE 

Definition at line 70 of file ipv6-header.h.

Constructor & Destructor Documentation

◆ Ipv6Header()

ns3::Ipv6Header::Ipv6Header ( )

Constructor.

Definition at line 23 of file ipv6-header.cc.

References SetDestination(), and SetSource().

+ Here is the call graph for this function:

Member Function Documentation

◆ Deserialize()

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

Deserialize the packet.

Parameters
startBuffer iterator
Returns
size of the packet

Implements ns3::Header.

Definition at line 171 of file ipv6-header.cc.

References GetSerializedSize(), m_destinationAddress, m_flowLabel, m_hopLimit, m_nextHeader, m_payloadLength, m_sourceAddress, m_trafficClass, NS_LOG_WARN, ns3::ReadFrom(), ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadNtohU32(), and ns3::Buffer::Iterator::ReadU8().

Referenced by ns3::Ipv6ExtensionLooseRouting::Process().

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

◆ DscpTypeToString()

std::string ns3::Ipv6Header::DscpTypeToString ( DscpType dscp) const
Parameters
dscpthe dscp
Returns
std::string of DSCPType

Definition at line 220 of file ipv6-header.cc.

References DSCP_AF11, DSCP_AF12, DSCP_AF13, DSCP_AF21, DSCP_AF22, DSCP_AF23, DSCP_AF31, DSCP_AF32, DSCP_AF33, DSCP_AF41, DSCP_AF42, DSCP_AF43, DSCP_CS1, DSCP_CS2, DSCP_CS3, DSCP_CS4, DSCP_CS5, DSCP_CS6, DSCP_CS7, DSCP_EF, DscpDefault, and NS_LOG_FUNCTION.

Referenced by Print().

+ Here is the caller graph for this function:

◆ EcnTypeToString()

std::string ns3::Ipv6Header::EcnTypeToString ( EcnType ecn) const
Parameters
ecnthe ECNType
Returns
std::string of ECNType

Definition at line 281 of file ipv6-header.cc.

References ECN_CE, ECN_ECT0, ECN_ECT1, ECN_NotECT, and NS_LOG_FUNCTION.

◆ GetDestination()

Ipv6Address ns3::Ipv6Header::GetDestination ( ) const

Get the "Destination address" field.

Returns
the destination address

Definition at line 113 of file ipv6-header.cc.

References m_destinationAddress.

Referenced by LteIpv6RoutingTestCase::Checker(), ns3::EpcTftClassifier::Classify(), ns3::Ipv6FlowClassifier::Classify(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), SixlowpanIphcStatefulImplTest::DoRun(), ns3::UdpSocketImpl::DoSendTo(), ns3::Ipv6FlowProbe::DropLogger(), ns3::Icmpv6L4Protocol::Forward(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::TcpSocketBase::ForwardUp6(), ns3::UdpSocketImpl::ForwardUp6(), ns3::Icmpv6L4Protocol::HandlePacketTooBig(), ns3::Ipv6QueueDiscItem::Hash(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::Receive(), ns3::Icmpv4L4Protocol::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::TcpL4Protocol::Receive(), ns3::UdpL4Protocol::Receive(), ns3::EpcPgwApplication::RecvFromTunDevice(), ns3::Ipv6ListRouting::RouteInput(), ns3::Ipv6StaticRouting::RouteInput(), ns3::RipNg::RouteInput(), ns3::Ipv6L3Protocol::RouteInputError(), ns3::Ipv6ListRouting::RouteOutput(), ns3::Ipv6StaticRouting::RouteOutput(), ns3::RipNg::RouteOutput(), and ns3::Ipv6L3Protocol::SendRealOut().

+ Here is the caller graph for this function:

◆ GetDscp()

Ipv6Header::DscpType ns3::Ipv6Header::GetDscp ( ) const
Returns
the DSCP field of this packet.

Definition at line 212 of file ipv6-header.cc.

References m_trafficClass, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6FlowClassifier::Classify(), and Print().

+ Here is the caller graph for this function:

◆ GetEcn()

Ipv6Header::EcnType ns3::Ipv6Header::GetEcn ( ) const
Returns
the ECN field bits of this packet.

Definition at line 273 of file ipv6-header.cc.

References m_trafficClass, and NS_LOG_FUNCTION.

Referenced by ns3::TcpSocketBase::ForwardUp6(), and ns3::Ipv6QueueDiscItem::Mark().

+ Here is the caller graph for this function:

◆ GetFlowLabel()

uint32_t ns3::Ipv6Header::GetFlowLabel ( ) const

Get the "Flow label" field.

Returns
the flow label value

Definition at line 53 of file ipv6-header.cc.

References m_flowLabel.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanHc1(), and ns3::SixLowPanNetDevice::CompressLowPanIphc().

+ Here is the caller graph for this function:

◆ GetHopLimit()

uint8_t ns3::Ipv6Header::GetHopLimit ( ) const

Get the "Hop limit" field (TTL).

Returns
the hop limit value

Definition at line 89 of file ipv6-header.cc.

References m_hopLimit.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::Icmpv6L4Protocol::Forward(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::UdpSocketImpl::ForwardUp6(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv6ExtensionLooseRouting::Process(), and ns3::Ping::Receive().

+ Here is the caller graph for this function:

◆ GetInstanceTypeId()

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

Return the instance type identifier.

Returns
instance type ID

Implements ns3::ObjectBase.

Definition at line 129 of file ipv6-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetNextHeader()

◆ GetPayloadLength()

uint16_t ns3::Ipv6Header::GetPayloadLength ( ) const

Get the "Payload length" field.

Returns
the payload length

Definition at line 65 of file ipv6-header.cc.

References m_payloadLength.

Referenced by ns3::Ipv6L3Protocol::Receive().

+ Here is the caller graph for this function:

◆ GetSerializedSize()

◆ GetSource()

Ipv6Address ns3::Ipv6Header::GetSource ( ) const

Get the "Source address" field.

Returns
the source address

Definition at line 101 of file ipv6-header.cc.

References m_sourceAddress.

Referenced by LteIpv6RoutingTestCase::Checker(), ns3::EpcTftClassifier::Classify(), ns3::Ipv6FlowClassifier::Classify(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), SixlowpanIphcStatefulImplTest::DoRun(), ns3::UdpSocketImpl::DoSendTo(), ns3::Icmpv6L4Protocol::Forward(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::TcpSocketBase::ForwardUp6(), ns3::UdpSocketImpl::ForwardUp6(), ns3::Ipv6ExtensionFragment::HandleFragmentsTimeout(), ns3::Radvd::HandleRead(), ns3::Ipv6QueueDiscItem::Hash(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::Ipv6ExtensionFragment::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::Receive(), ns3::Icmpv4L4Protocol::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::TcpL4Protocol::Receive(), ns3::UdpL4Protocol::Receive(), ns3::Ipv6StaticRouting::RouteInput(), ns3::RipNg::RouteInput(), ns3::Ipv6L3Protocol::RouteInputError(), ns3::Ipv6ListRouting::RouteOutput(), and ns3::Ipv6L3Protocol::SendRealOut().

+ Here is the caller graph for this function:

◆ GetTrafficClass()

uint8_t ns3::Ipv6Header::GetTrafficClass ( ) const

Get the "Traffic class" field.

Returns
the traffic value

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

References m_trafficClass.

Referenced by ns3::EpcTftClassifier::Classify(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::UdpSocketImpl::ForwardUp6(), and ns3::Ipv6QueueDiscItem::GetUint8Value().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::Ipv6Header::GetTypeId ( )
static

Get the type identifier.

Returns
type identifier

Definition at line 119 of file ipv6-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::Ipv6Header::Print ( std::ostream & os) const
overridevirtual

Print some information about the packet.

Parameters
osoutput stream

Implements ns3::Header.

Definition at line 135 of file ipv6-header.cc.

References DscpTypeToString(), GetDscp(), m_destinationAddress, m_flowLabel, m_hopLimit, m_nextHeader, m_payloadLength, m_sourceAddress, and m_trafficClass.

+ Here is the call graph for this function:

◆ Serialize()

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

Serialize the packet.

Parameters
startBuffer iterator

Implements ns3::Header.

Definition at line 154 of file ipv6-header.cc.

References m_destinationAddress, m_flowLabel, m_hopLimit, m_nextHeader, m_payloadLength, m_sourceAddress, m_trafficClass, ns3::Buffer::Iterator::WriteHtonU16(), ns3::Buffer::Iterator::WriteHtonU32(), ns3::WriteTo(), and ns3::Buffer::Iterator::WriteU8().

Referenced by ns3::Ipv6ExtensionLooseRouting::Process().

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

◆ SetDestination()

◆ SetDscp()

void ns3::Ipv6Header::SetDscp ( DscpType dscp)

Set DSCP Field.

Parameters
dscpDSCP value

Definition at line 196 of file ipv6-header.cc.

References m_trafficClass, and NS_LOG_FUNCTION.

◆ SetEcn()

void ns3::Ipv6Header::SetEcn ( EcnType ecn)

Set ECN field bits.

Parameters
ecnECN field bits

Definition at line 204 of file ipv6-header.cc.

References m_trafficClass, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6QueueDiscItem::Mark().

+ Here is the caller graph for this function:

◆ SetFlowLabel()

void ns3::Ipv6Header::SetFlowLabel ( uint32_t flow)

Set the "Flow label" field.

Parameters
flowthe 20-bit value

Definition at line 47 of file ipv6-header.cc.

References m_flowLabel.

Referenced by ns3::SixLowPanNetDevice::DecompressLowPanHc1(), and ns3::SixLowPanNetDevice::DecompressLowPanIphc().

+ Here is the caller graph for this function:

◆ SetHopLimit()

void ns3::Ipv6Header::SetHopLimit ( uint8_t limit)

◆ SetNextHeader()

◆ SetPayloadLength()

void ns3::Ipv6Header::SetPayloadLength ( uint16_t len)

◆ SetSource()

◆ SetTrafficClass()

void ns3::Ipv6Header::SetTrafficClass ( uint8_t traffic)

Set the "Traffic class" field.

Parameters
trafficthe 8-bit value

Definition at line 35 of file ipv6-header.cc.

References m_trafficClass.

Referenced by EpcTftClassifierTestCase::EpcTftClassifierTestCase(), ns3::Ipv6L3Protocol::BuildHeader(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), and ns3::SixLowPanNetDevice::DecompressLowPanIphc().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_destinationAddress

Ipv6Address ns3::Ipv6Header::m_destinationAddress
private

The destination address.

Definition at line 297 of file ipv6-header.h.

Referenced by Deserialize(), GetDestination(), Print(), Serialize(), and SetDestination().

◆ m_flowLabel

uint32_t ns3::Ipv6Header::m_flowLabel
private

The flow label.

Note
This is 20-bit value.

Definition at line 272 of file ipv6-header.h.

Referenced by Deserialize(), GetFlowLabel(), Print(), Serialize(), and SetFlowLabel().

◆ m_hopLimit

uint8_t ns3::Ipv6Header::m_hopLimit
private

The Hop limit value.

Definition at line 287 of file ipv6-header.h.

Referenced by Deserialize(), GetHopLimit(), Print(), Serialize(), and SetHopLimit().

◆ m_nextHeader

uint8_t ns3::Ipv6Header::m_nextHeader
private

The Next header number.

Definition at line 282 of file ipv6-header.h.

Referenced by Deserialize(), GetNextHeader(), Print(), Serialize(), and SetNextHeader().

◆ m_payloadLength

uint16_t ns3::Ipv6Header::m_payloadLength
private

The payload length.

Definition at line 277 of file ipv6-header.h.

Referenced by Deserialize(), GetPayloadLength(), Print(), Serialize(), and SetPayloadLength().

◆ m_sourceAddress

Ipv6Address ns3::Ipv6Header::m_sourceAddress
private

The source address.

Definition at line 292 of file ipv6-header.h.

Referenced by Deserialize(), GetSource(), Print(), Serialize(), and SetSource().

◆ m_trafficClass

uint32_t ns3::Ipv6Header::m_trafficClass
private

The traffic class.

Definition at line 266 of file ipv6-header.h.

Referenced by Deserialize(), GetDscp(), GetEcn(), GetTrafficClass(), Print(), Serialize(), SetDscp(), SetEcn(), and SetTrafficClass().


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