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

Describes an IPv6 address. More...

#include "ipv6-address.h"

Collaboration diagram for ns3::Ipv6Address:

Public Member Functions

 Ipv6Address ()=default
 Default constructor.
 Ipv6Address (const char *address)
 Constructs an Ipv6Address by parsing the input C-string.
 Ipv6Address (uint8_t address[16])
 Constructs an Ipv6Address by using the input 16 bytes.
Ipv6Address CombinePrefix (const Ipv6Prefix &prefix) const
 Combine this address with a prefix.
Address ConvertTo () const
 convert the IPv6Address object to an Address object.
void GetBytes (uint8_t buf[16]) const
 Get the bytes corresponding to the address.
uint32_t GetHash () const
 Get the address hash.
Ipv4Address GetIpv4MappedAddress () const
 Return the Ipv4 address.
bool HasPrefix (const Ipv6Prefix &prefix) const
 Compares an address and a prefix.
bool IsAllNodesMulticast () const
 If the IPv6 address is "all nodes multicast" (ff02::1/8).
bool IsAllRoutersMulticast () const
 If the IPv6 address is "all routers multicast" (ff02::2/8).
bool IsAny () const
 If the IPv6 address is the "Any" address.
bool IsDocumentation () const
 If the IPv6 address is a documentation address (2001:DB8::/32).
bool IsInitialized () const
bool IsIpv4MappedAddress () const
 If the address is an IPv4-mapped address.
bool IsLinkLocal () const
 If the IPv6 address is a link-local address (fe80::/64).
bool IsLinkLocalMulticast () const
 If the IPv6 address is link-local multicast (ff02::/16).
bool IsLocalhost () const
 If the IPv6 address is localhost (::1).
bool IsMulticast () const
 If the IPv6 address is multicast (ff00::/8).
bool IsSolicitedMulticast () const
 If the IPv6 address is a Solicited multicast address.
 operator Address () const
 Convert to Address object.
std::strong_ordering operator<=> (const Ipv6Address &other) const
 Three-way comparison operator.
bool operator== (const Ipv6Address &other) const
 Equal to operator.
void Print (std::ostream &os) const
 Print this address to the given output stream.
void Serialize (uint8_t buf[16]) const
 Serialize this address to a 16-byte buffer.
void Set (const char *address)
 Sets an Ipv6Address by parsing the input C-string.
void Set (uint8_t address[16])
 Set an Ipv6Address by using the input 16 bytes.

Static Public Member Functions

static bool CheckCompatible (const std::string &addressStr)
 Checks if the string contains an Ipv6Address.
static Ipv6Address ConvertFrom (const Address &address)
 Convert the Address object into an Ipv6Address ones.
static Ipv6Address Deserialize (const uint8_t buf[16])
 Deserialize this address.
static Ipv6Address GetAllHostsMulticast ()
 Get the "all hosts multicast" address.
static Ipv6Address GetAllNodesMulticast ()
 Get the "all nodes multicast" address.
static Ipv6Address GetAllRoutersMulticast ()
 Get the "all routers multicast" address.
static Ipv6Address GetAny ()
 Get the "any" (::) Ipv6Address.
static Ipv6Address GetLoopback ()
 Get the loopback address.
static Ipv6Address GetOnes ()
 Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
static Ipv6Address GetZero ()
 Get the 0 (::) Ipv6Address.
static bool IsMatchingType (const Address &address)
 If the Address matches the type.
static Ipv6Address MakeAutoconfiguredAddress (Address addr, Ipv6Address prefix)
 Make the autoconfigured IPv6 address from a Mac address.
static Ipv6Address MakeAutoconfiguredAddress (Address addr, Ipv6Prefix prefix)
 Make the autoconfigured IPv6 address from a Mac address.
static Ipv6Address MakeAutoconfiguredAddress (Mac16Address addr, Ipv6Address prefix)
 Make the autoconfigured IPv6 address with Mac16Address.
static Ipv6Address MakeAutoconfiguredAddress (Mac48Address addr, Ipv6Address prefix)
 Make the autoconfigured IPv6 address with Mac48Address.
static Ipv6Address MakeAutoconfiguredAddress (Mac64Address addr, Ipv6Address prefix)
 Make the autoconfigured IPv6 address with Mac64Address.
static Ipv6Address MakeAutoconfiguredAddress (Mac8Address addr, Ipv6Address prefix)
 Make the autoconfigured IPv6 address with Mac8Address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Address mac)
 Make the autoconfigured link-local IPv6 address from a Mac address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac16Address mac)
 Make the autoconfigured link-local IPv6 address with Mac16Address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac48Address mac)
 Make the autoconfigured link-local IPv6 address with Mac48Address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac64Address mac)
 Make the autoconfigured link-local IPv6 address with Mac64Address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac8Address mac)
 Make the autoconfigured link-local IPv6 address with Mac8Address.
static Ipv6Address MakeIpv4MappedAddress (Ipv4Address addr)
 Make the Ipv4-mapped IPv6 address.
static Ipv6Address MakeSolicitedAddress (Ipv6Address addr)
 Make the solicited IPv6 address.

Private Member Functions

uint32_t GenerateHash () const
 Generate and return a hash key.

Static Private Member Functions

static uint8_t GetType ()
 Return the Type of address.
static void MixHashKey (uint32_t &a, uint32_t &b, uint32_t &c)
 Mix hash keys in-place for lookuphash.

Private Attributes

std::array< uint8_t, 16 > m_address {}
 The address representation on 128 bits (16 bytes).
std::optional< uint32_tm_hash
 address hash.

Detailed Description

Describes an IPv6 address.

See also
Ipv6Prefix
Ipv6Address Attribute

Definition at line 41 of file ipv6-address.h.

Constructor & Destructor Documentation

◆ Ipv6Address() [1/3]

◆ Ipv6Address() [2/3]

ns3::Ipv6Address::Ipv6Address ( const char * address)

Constructs an Ipv6Address by parsing the input C-string.

Parameters
addressthe C-string containing the IPv6 address (e.g. 2001:db8:f00d:cafe::1).

Definition at line 34 of file ipv6-address.cc.

References m_address, m_hash, NS_ABORT_MSG, and NS_LOG_FUNCTION.

◆ Ipv6Address() [3/3]

ns3::Ipv6Address::Ipv6Address ( uint8_t address[16])

Constructs an Ipv6Address by using the input 16 bytes.

Parameters
addressthe 128-bit address
Warning
the parameter must point on a 16 bytes integer array!

Definition at line 62 of file ipv6-address.cc.

References m_address, m_hash, and NS_LOG_FUNCTION.

Member Function Documentation

◆ CheckCompatible()

bool ns3::Ipv6Address::CheckCompatible ( const std::string & addressStr)
static

Checks if the string contains an Ipv6Address.

Input address is in format: 2001:db8:f00d:cafe::1

Note: the function uses inet_pton internally.

See also
Address::CheckCompatible hich has a similar name but which instead checks the underlying type and Length embedded in the Address.
Parameters
addressStrstring containing the address as described above
Returns
true if the string can be parsed as an IPv6 address

Definition at line 48 of file ipv6-address.cc.

References NS_LOG_FUNCTION, and NS_LOG_WARN.

◆ CombinePrefix()

Ipv6Address ns3::Ipv6Address::CombinePrefix ( const Ipv6Prefix & prefix) const

Combine this address with a prefix.

Parameters
prefixa IPv6 prefix
Returns
an IPv6 address that is this address combined (bitwise AND) with a prefix, yielding an IPv6 network address.

Definition at line 427 of file ipv6-address.cc.

References Ipv6Address(), GetBytes(), m_address, NS_LOG_FUNCTION, and Set().

Referenced by ns3::Ipv6AddressHelper::Ipv6AddressHelper(), ns3::RipNg::HandleRequests(), ns3::RipNg::HandleResponses(), HasPrefix(), IsDocumentation(), ns3::Ipv6InterfaceAddress::IsInSameSubnet(), IsLinkLocal(), IsSolicitedMulticast(), MakeAutoconfiguredAddress(), ns3::Ipv6StaticRouting::NotifyInterfaceUp(), and ns3::Ipv6AddressHelper::SetBase().

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

◆ ConvertFrom()

Ipv6Address ns3::Ipv6Address::ConvertFrom ( const Address & address)
static

Convert the Address object into an Ipv6Address ones.

Parameters
addressaddress to convert
Returns
an Ipv6Address

Definition at line 527 of file ipv6-address.cc.

References Deserialize(), GetType(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::addressUtils::ConvertToSocketAddress(), PingTestCase::DoRun(), ns3::UdpSocketImpl::DoSend(), ns3::UdpSocketImpl::GetPeerName(), ns3::addressUtils::IsMulticast(), ns3::PbbAddressBlockIpv6::PrintAddress(), ns3::PbbMessageIpv6::PrintOriginatorAddress(), ns3::Ping::PrintReport(), ns3::Ping::Send(), ns3::TcpL4Protocol::SendPacket(), UanExperiment::SendSinglePacket(), ns3::PbbAddressBlockIpv6::SerializeAddress(), ns3::PbbMessageIpv6::SerializeOriginatorAddress(), and ns3::Ping::StartApplication().

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

◆ ConvertTo()

Address ns3::Ipv6Address::ConvertTo ( ) const

convert the IPv6Address object to an Address object.

Returns
the Address object corresponding to this object.

Definition at line 518 of file ipv6-address.cc.

References GetType(), NS_LOG_FUNCTION, and Serialize().

Referenced by operator Address().

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

◆ Deserialize()

Ipv6Address ns3::Ipv6Address::Deserialize ( const uint8_t buf[16])
static

Deserialize this address.

Parameters
bufbuffer to read address from
Returns
an Ipv6Address

Definition at line 98 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION.

Referenced by ns3::SixLowPanNetDevice::CleanPrefix(), ns3::Inet6SocketAddress::ConvertFrom(), ConvertFrom(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::Ipv6PacketInfoTag::Deserialize(), ns3::PbbAddressBlockIpv6::DeserializeAddress(), and ns3::PbbMessageIpv6::DeserializeOriginatorAddress().

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

◆ GenerateHash()

uint32_t ns3::Ipv6Address::GenerateHash ( ) const
private

Generate and return a hash key.

Returns
hash
Note
Adapted from Jens Jakobsen implementation (chillispot).

Definition at line 643 of file ipv6-address.cc.

References m_address, m_hash, MixHashKey(), and NS_LOG_FUNCTION.

Referenced by GetHash().

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

◆ GetAllHostsMulticast()

Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast ( )
static

Get the "all hosts multicast" address.

Returns
the "ff02::3/8" Ipv6Address representation

Definition at line 561 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address().

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

◆ GetAllNodesMulticast()

Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast ( )
static

Get the "all nodes multicast" address.

Returns
the "ff02::2/8" Ipv6Address representation

Definition at line 545 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address(), PingTestSuite::PingTestSuite(), ns3::Dhcp6Client::Boot(), ns3::Dhcp6Client::InterfaceConfig::DeclineOffer(), LrWpanAckTestCase::DoRun(), ns3::Radvd::HandleRead(), ns3::Radvd::Send(), ns3::Icmpv6L4Protocol::SendNS(), ns3::Dhcp6Client::SendRebind(), ns3::Dhcp6Client::SendRelease(), ns3::Dhcp6Client::SendRenew(), ns3::Dhcp6Client::SendRequest(), ns3::Dhcp6Server::StartApplication(), and ns3::Radvd::StartApplication().

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

◆ GetAllRoutersMulticast()

Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast ( )
static

Get the "all routers multicast" address.

Returns
the "ff02::2/8" Ipv6Address representation

Definition at line 553 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address(), ns3::Icmpv6L4Protocol::FunctionDadTimeout(), ns3::Ipv6EndPointDemux::Lookup(), and ns3::Radvd::StartApplication().

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

◆ GetAny()

Ipv6Address ns3::Ipv6Address::GetAny ( )
static

Get the "any" (::) Ipv6Address.

Returns
the "any" (::) Ipv6Address

Definition at line 585 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address(), ns3::Ipv6RawSocketImpl::Ipv6RawSocketImpl(), ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::Ipv6EndPointDemux::Allocate(), ns3::Ipv6EndPointDemux::Allocate(), ns3::Ipv6RawSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::UdpSocketImpl::Bind(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), DualStackTestCase::DoRun(), IcmpV6EchoReplyTestCase::DoRun(), IcmpV6TimeExceedTestCase::DoRun(), Ipv6PacketInfoTagTest::DoRun(), Ipv6RawFragmentationTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), SixlowpanIphcStatefulImplTest::DoRun(), TcpEndPointBug2211Test::DoRun(), Udp6SocketLoopbackTest::DoRun(), ns3::RipNg::DoSendRouteUpdate(), ns3::UdpSocketImpl::DoSendTo(), ns3::PacketSink::DoStartApplication(), ns3::UdpEchoServer::DoStartApplication(), ns3::UdpServer::DoStartApplication(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6InterfaceContainer::GetLinkLocalAddress(), ns3::Ipv6InterfaceContainer::GetLinkLocalAddress(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::RipNg::HandleRequests(), ns3::RipNg::HandleResponses(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Socket::Ipv6LeaveGroup(), ns3::Ipv6EndPointDemux::Lookup(), MakeAutoconfiguredAddress(), MakeAutoconfiguredLinkLocalAddress(), ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress(), NeighborCacheExample::Run(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), ns3::Ipv6L3Protocol::SendRealOut(), ns3::RipNg::SendRouteRequest(), ns3::Ipv6InterfaceContainer::SetDefaultRoute(), ns3::Ipv6InterfaceContainer::SetDefaultRouteInAllNodes(), UanExperiment::SetupApplications(), TcpTestCase::SetupDefaultSim6(), ns3::Ipv6EndPointDemux::SimpleLookup(), Ipv6FragmentationTest::StartClient(), and SixlowpanFragmentationTest::StartClient().

Here is the call graph for this function:

◆ GetBytes()

void ns3::Ipv6Address::GetBytes ( uint8_t buf[16]) const

◆ GetHash()

uint32_t ns3::Ipv6Address::GetHash ( ) const

Get the address hash.

Returns
the address hash

Definition at line 674 of file ipv6-address.cc.

References GenerateHash(), and m_hash.

Referenced by Ipv6Address(), Ipv6AddressTestCase::DoRun(), and std::hash< ns3::Ipv6Address >::operator()().

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

◆ GetIpv4MappedAddress()

Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress ( ) const

Return the Ipv4 address.

Returns
Ipv4 address

Definition at line 119 of file ipv6-address.cc.

References ns3::Ipv4Address::Deserialize(), NS_LOG_FUNCTION, and Serialize().

Referenced by ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSendTo(), and ns3::TcpL4Protocol::SendPacketV6().

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

◆ GetLoopback()

Ipv6Address ns3::Ipv6Address::GetLoopback ( )
static

Get the loopback address.

Returns
the "::1/128" Ipv6Address representation.

Definition at line 569 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address(), Ipv6L3ProtocolTestCase::DoRun(), TcpEndPointBug2211Test::DoRun(), ns3::Ipv6Interface::RemoveAddress(), ns3::Ipv6L3Protocol::RemoveAddress(), ns3::Ipv6L3Protocol::SetupLoopback(), and ns3::Ipv6L3Protocol::SourceAddressSelection().

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

◆ GetOnes()

Ipv6Address ns3::Ipv6Address::GetOnes ( )
static

Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).

Returns
all-1 Ipv6Address representation

Definition at line 593 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION_NOARGS.

Referenced by Ipv6Address(), ns3::SixLowPanNetDevice::AddContext(), ns3::SixLowPanNetDevice::FindMulticastCompressionContext(), ns3::SixLowPanNetDevice::FindUnicastCompressionContext(), HasPrefix(), and MakeAutoconfiguredAddress().

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

◆ GetType()

uint8_t ns3::Ipv6Address::GetType ( )
staticprivate

Return the Type of address.

Returns
type of address

Definition at line 537 of file ipv6-address.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().

Referenced by ConvertFrom(), ConvertTo(), and IsMatchingType().

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

◆ GetZero()

◆ HasPrefix()

bool ns3::Ipv6Address::HasPrefix ( const Ipv6Prefix & prefix) const

Compares an address and a prefix.

Parameters
prefixthe prefix to compare with
Returns
true if the address has the given prefix

Definition at line 494 of file ipv6-address.cc.

References Ipv6Address(), CombinePrefix(), GetOnes(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ IsAllNodesMulticast()

bool ns3::Ipv6Address::IsAllNodesMulticast ( ) const

If the IPv6 address is "all nodes multicast" (ff02::1/8).

Returns
true if "all nodes multicast", false otherwise

Definition at line 456 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION.

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

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

◆ IsAllRoutersMulticast()

bool ns3::Ipv6Address::IsAllRoutersMulticast ( ) const

If the IPv6 address is "all routers multicast" (ff02::2/8).

Returns
true if "all routers multicast", false otherwise

Definition at line 466 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION.

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

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

◆ IsAny()

bool ns3::Ipv6Address::IsAny ( ) const

If the IPv6 address is the "Any" address.

Returns
true if it is, false otherwise

Definition at line 478 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6Interface::AddAddress(), ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::NdiscCache::Entry::FunctionDelayTimeout(), ns3::NdiscCache::Entry::FunctionProbeTimeout(), ns3::NdiscCache::Entry::FunctionRetransmitTimeout(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::Ipv6L3Protocol::IpForward(), ns3::RipNg::Lookup(), ns3::Ipv6StaticRouting::LookupStatic(), MakeAutoconfiguredAddress(), MakeAutoconfiguredLinkLocalAddress(), ns3::Icmpv6L4Protocol::SendRS(), and ns3::Ipv6L3Protocol::SourceAddressSelection().

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

◆ IsDocumentation()

bool ns3::Ipv6Address::IsDocumentation ( ) const

If the IPv6 address is a documentation address (2001:DB8::/32).

Returns
true if the address is documentation, false otherwise

Definition at line 486 of file ipv6-address.cc.

References Ipv6Address(), CombinePrefix(), and NS_LOG_FUNCTION.

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

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

◆ IsInitialized()

bool ns3::Ipv6Address::IsInitialized ( ) const
Returns
true if address is initialized (i.e., set to something), false otherwise
Deprecated
"Deprecated in ns-3.47: " "Use IsAny or std::optional"

Definition at line 616 of file ipv6-address.cc.

References NS_LOG_FUNCTION.

Referenced by Ipv6Address().

Here is the caller graph for this function:

◆ IsIpv4MappedAddress()

bool ns3::Ipv6Address::IsIpv4MappedAddress ( ) const

If the address is an IPv4-mapped address.

Returns
true if address is an IPv4-mapped address, otherwise false.

Definition at line 418 of file ipv6-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSendTo(), ns3::UdpL4Protocol::Receive(), and ns3::TcpL4Protocol::SendPacketV6().

Here is the caller graph for this function:

◆ IsLinkLocal()

bool ns3::Ipv6Address::IsLinkLocal ( ) const

If the IPv6 address is a link-local address (fe80::/64).

Returns
true if the address is link-local, false otherwise

Definition at line 608 of file ipv6-address.cc.

References Ipv6Address(), CombinePrefix(), and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6StaticRouting::AddHostRouteTo(), ns3::Ipv6StaticRouting::AddNetworkRouteTo(), ns3::RipNg::AddNetworkRouteTo(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), Ipv6L3ProtocolTestCase::DoRun(), PingTestCase::DoRun(), ns3::Icmpv6L4Protocol::FunctionDadTimeout(), ns3::AnimationInterface::GetIpv6Address(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::RipNg::HandleRequests(), ns3::RipNg::HandleResponses(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv6InterfaceAddress::IsInSameSubnet(), ns3::Icmpv6L4Protocol::Lookup(), ns3::RipNg::RouteInput(), ns3::Ipv6L3Protocol::Send(), and ns3::Ipv6L3Protocol::SourceAddressSelection().

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

◆ IsLinkLocalMulticast()

bool ns3::Ipv6Address::IsLinkLocalMulticast ( ) const

If the IPv6 address is link-local multicast (ff02::/16).

Returns
true if link-local multicast, false otherwise

Definition at line 411 of file ipv6-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by PingTestCase::DoRun(), ns3::Ipv6InterfaceAddress::IsInSameSubnet(), ns3::RipNg::Lookup(), ns3::Ipv6StaticRouting::LookupStatic(), ns3::Ipv6L3Protocol::Send(), and ns3::Ipv6L3Protocol::SourceAddressSelection().

Here is the caller graph for this function:

◆ IsLocalhost()

bool ns3::Ipv6Address::IsLocalhost ( ) const

If the IPv6 address is localhost (::1).

Returns
true if localhost, false otherwise

Definition at line 396 of file ipv6-address.cc.

References Ipv6Address(), and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6Interface::AddAddress(), and ns3::Ipv6L3Protocol::SourceAddressSelection().

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

◆ IsMatchingType()

bool ns3::Ipv6Address::IsMatchingType ( const Address & address)
static

If the Address matches the type.

Parameters
addressother address
Returns
true if the type matches, false otherwise

Definition at line 505 of file ipv6-address.cc.

References GetType(), and NS_LOG_FUNCTION.

Referenced by ns3::UdpHeader::CalculateHeaderChecksum(), ns3::addressUtils::ConvertToSocketAddress(), ns3::UdpSocketImpl::DoSend(), ns3::UdpServer::DoStartApplication(), ns3::UdpSocketImpl::GetPeerName(), ns3::addressUtils::IsMulticast(), ns3::Ping::PrintReport(), ns3::TcpL4Protocol::SendPacket(), ns3::ThreeGppHttpClient::SetPort(), ns3::ThreeGppHttpServer::SetPort(), ns3::UdpClient::SetPort(), ns3::UdpEchoClient::SetPort(), ns3::UdpTraceClient::SetPort(), and ns3::Ping::StartApplication().

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

◆ IsMulticast()

◆ IsSolicitedMulticast()

bool ns3::Ipv6Address::IsSolicitedMulticast ( ) const

If the IPv6 address is a Solicited multicast address.

Returns
true if it is, false otherwise

Definition at line 447 of file ipv6-address.cc.

References Ipv6Address(), CombinePrefix(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ MakeAutoconfiguredAddress() [1/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Address addr,
Ipv6Address prefix )
static

Make the autoconfigured IPv6 address from a Mac address.

Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.

Parameters
addrthe MAC address.
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 131 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac16Address::ConvertFrom(), ns3::Mac48Address::ConvertFrom(), ns3::Mac64Address::ConvertFrom(), ns3::Mac8Address::ConvertFrom(), GetAny(), IsAny(), ns3::Mac16Address::IsMatchingType(), ns3::Mac48Address::IsMatchingType(), ns3::Mac64Address::IsMatchingType(), ns3::Mac8Address::IsMatchingType(), MakeAutoconfiguredAddress(), and NS_ABORT_MSG.

Referenced by ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), SixlowpanIphcStatefulImplTest::DoRun(), MakeAutoconfiguredAddress(), MakeAutoconfiguredAddress(), ns3::Ipv6AddressHelper::NewAddress(), and ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress().

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

◆ MakeAutoconfiguredAddress() [2/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Address addr,
Ipv6Prefix prefix )
static

Make the autoconfigured IPv6 address from a Mac address.

Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.

Parameters
addrthe MAC address.
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 160 of file ipv6-address.cc.

References Ipv6Address(), CombinePrefix(), GetOnes(), and MakeAutoconfiguredAddress().

Here is the call graph for this function:

◆ MakeAutoconfiguredAddress() [3/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Mac16Address addr,
Ipv6Address prefix )
static

Make the autoconfigured IPv6 address with Mac16Address.

The EUI-64 scheme used is based on the RFC 4944.

Parameters
addrthe MAC address (16 bits).
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 167 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac16Address::CopyTo(), GetBytes(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredAddress() [4/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Mac48Address addr,
Ipv6Address prefix )
static

Make the autoconfigured IPv6 address with Mac48Address.

The EUI-64 scheme used is based on RFC 2464.

Parameters
addrthe MAC address (48 bits).
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 187 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac48Address::CopyTo(), GetBytes(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredAddress() [5/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Mac64Address addr,
Ipv6Address prefix )
static

Make the autoconfigured IPv6 address with Mac64Address.

Parameters
addrthe MAC address (64 bits).
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 208 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac64Address::CopyTo(), GetBytes(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredAddress() [6/6]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress ( Mac8Address addr,
Ipv6Address prefix )
static

Make the autoconfigured IPv6 address with Mac8Address.

The EUI-64 scheme used is loosely based on the RFC 2464.

Parameters
addrthe Mac8Address address (8 bits).
prefixthe IPv6 prefix
Returns
autoconfigured IPv6 address

Definition at line 225 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac8Address::CopyTo(), GetBytes(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredLinkLocalAddress() [1/5]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress ( Address mac)
static

Make the autoconfigured link-local IPv6 address from a Mac address.

Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.

Parameters
macthe MAC address.
Returns
autoconfigured link-local IPv6 address

Definition at line 246 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac16Address::ConvertFrom(), ns3::Mac48Address::ConvertFrom(), ns3::Mac64Address::ConvertFrom(), ns3::Mac8Address::ConvertFrom(), GetAny(), IsAny(), ns3::Mac16Address::IsMatchingType(), ns3::Mac48Address::IsMatchingType(), ns3::Mac64Address::IsMatchingType(), ns3::Mac8Address::IsMatchingType(), MakeAutoconfiguredLinkLocalAddress(), and NS_ABORT_MSG.

Referenced by ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::Ipv6Interface::DoSetup(), and MakeAutoconfiguredLinkLocalAddress().

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

◆ MakeAutoconfiguredLinkLocalAddress() [2/5]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress ( Mac16Address mac)
static

Make the autoconfigured link-local IPv6 address with Mac16Address.

The EUI-64 scheme used is based on the RFC 4944.

Parameters
macthe MAC address (16 bits).
Returns
autoconfigured link-local IPv6 address

Definition at line 275 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac16Address::CopyTo(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredLinkLocalAddress() [3/5]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress ( Mac48Address mac)
static

Make the autoconfigured link-local IPv6 address with Mac48Address.

The EUI-64 scheme used is based on RFC 2464.

Parameters
macthe MAC address (48 bits).
Returns
autoconfigured link-local IPv6 address

Definition at line 296 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac48Address::CopyTo(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredLinkLocalAddress() [4/5]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress ( Mac64Address mac)
static

Make the autoconfigured link-local IPv6 address with Mac64Address.

Parameters
macthe MAC address (64 bits).
Returns
autoconfigured link-local IPv6 address

Definition at line 319 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac64Address::CopyTo(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeAutoconfiguredLinkLocalAddress() [5/5]

Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress ( Mac8Address mac)
static

Make the autoconfigured link-local IPv6 address with Mac8Address.

The EUI-64 scheme used is loosely based on the RFC 2464.

Parameters
macthe MAC address (8 bits).
Returns
autoconfigured link-local IPv6 address

Definition at line 338 of file ipv6-address.cc.

References Ipv6Address(), ns3::Mac8Address::CopyTo(), NS_LOG_FUNCTION, and Set().

Here is the call graph for this function:

◆ MakeIpv4MappedAddress()

Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress ( Ipv4Address addr)
static

Make the Ipv4-mapped IPv6 address.

Parameters
addrthe IPv4 address
Returns
Ipv4-mapped IPv6 address

Definition at line 106 of file ipv6-address.cc.

References Ipv6Address(), NS_LOG_FUNCTION, and ns3::Ipv4Address::Serialize().

Referenced by EpcTftClassifierTestCase::EpcTftClassifierTestCase(), EpcTftClassifierTestCase::BuildNameString(), ns3::MockNetDevice::GetMulticast(), ns3::TcpL4Protocol::Receive(), and ns3::UdpL4Protocol::Receive().

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

◆ MakeSolicitedAddress()

Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress ( Ipv6Address addr)
static

Make the solicited IPv6 address.

Parameters
addrthe IPv6 address
Returns
Solicited IPv6 address

Definition at line 360 of file ipv6-address.cc.

References Ipv6Address(), NS_LOG_FUNCTION, Serialize(), and Set().

Referenced by ns3::Ipv6Interface::AddAddress(), ns3::Icmpv6L4Protocol::DoDAD(), ns3::NdiscCache::Entry::FunctionRetransmitTimeout(), and ns3::Icmpv6L4Protocol::Lookup().

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

◆ MixHashKey()

void ns3::Ipv6Address::MixHashKey ( uint32_t & a,
uint32_t & b,
uint32_t & c )
staticprivate

Mix hash keys in-place for lookuphash.

Parameters
afirst word of the hash key
bsecond word of the hash key
cthird word of the hash key

Definition at line 623 of file ipv6-address.cc.

References x.

Referenced by GenerateHash().

Here is the caller graph for this function:

◆ operator Address()

ns3::Ipv6Address::operator Address ( ) const

Convert to Address object.

Definition at line 511 of file ipv6-address.cc.

References ConvertTo().

Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering ns3::Ipv6Address::operator<=> ( const Ipv6Address & other) const
inline

Three-way comparison operator.

Parameters
otherthe other address to compare with
Returns
comparison result

Definition at line 411 of file ipv6-address.h.

References Ipv6Address(), and m_address.

Here is the call graph for this function:

◆ operator==()

bool ns3::Ipv6Address::operator== ( const Ipv6Address & other) const
inline

Equal to operator.

Parameters
otherthe other address to compare with
Returns
true if the operands are equal.

Definition at line 422 of file ipv6-address.h.

References Ipv6Address(), and m_address.

Here is the call graph for this function:

◆ Print()

void ns3::Ipv6Address::Print ( std::ostream & os) const

Print this address to the given output stream.

The print format is in the typical "2001:660:4701::1".

Parameters
osthe output stream to which this Ipv6Address is printed

Definition at line 383 of file ipv6-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::PbbAddressBlockIpv6::PrintAddress(), and ns3::PbbMessageIpv6::PrintOriginatorAddress().

Here is the caller graph for this function:

◆ Serialize()

void ns3::Ipv6Address::Serialize ( uint8_t buf[16]) const

Serialize this address to a 16-byte buffer.

Parameters
bufthe output buffer to which this address gets overwritten with this Ipv6Address

Definition at line 91 of file ipv6-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6Header::CalculatePseudoHeaderChecksum(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ConvertTo(), GetIpv4MappedAddress(), ns3::Mac48Address::GetMulticast(), ns3::Ipv6QueueDiscItem::Hash(), MakeSolicitedAddress(), ns3::PbbAddressBlockIpv6::SerializeAddress(), and ns3::PbbMessageIpv6::SerializeOriginatorAddress().

Here is the caller graph for this function:

◆ Set() [1/2]

void ns3::Ipv6Address::Set ( const char * address)

Sets an Ipv6Address by parsing the input C-string.

Parameters
addressthe C-string containing the IPv6 address (e.g. 2001:db8:f00d:cafe::1).

Definition at line 70 of file ipv6-address.cc.

References m_address, m_hash, NS_ABORT_MSG, and NS_LOG_FUNCTION.

Referenced by EpcTftClassifierTestSuite::EpcTftClassifierTestSuite(), CombinePrefix(), MakeAutoconfiguredAddress(), MakeAutoconfiguredAddress(), MakeAutoconfiguredAddress(), MakeAutoconfiguredAddress(), MakeAutoconfiguredLinkLocalAddress(), MakeAutoconfiguredLinkLocalAddress(), MakeAutoconfiguredLinkLocalAddress(), MakeAutoconfiguredLinkLocalAddress(), MakeSolicitedAddress(), and ns3::ReadFrom().

Here is the caller graph for this function:

◆ Set() [2/2]

void ns3::Ipv6Address::Set ( uint8_t address[16])

Set an Ipv6Address by using the input 16 bytes.

Parameters
addressthe 128-bit address
Warning
the parameter must point on a 16 bytes integer array!

Definition at line 83 of file ipv6-address.cc.

References m_address, m_hash, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_address

std::array<uint8_t, 16> ns3::Ipv6Address::m_address {}
private

The address representation on 128 bits (16 bytes).

Definition at line 453 of file ipv6-address.h.

Referenced by Ipv6Address(), Ipv6Address(), CombinePrefix(), GenerateHash(), GetBytes(), IsIpv4MappedAddress(), IsLinkLocalMulticast(), IsMulticast(), operator<=>(), operator==(), Print(), Serialize(), Set(), and Set().

◆ m_hash

std::optional<uint32_t> ns3::Ipv6Address::m_hash
mutableprivate

address hash.

Definition at line 458 of file ipv6-address.h.

Referenced by Ipv6Address(), Ipv6Address(), GenerateHash(), GetHash(), Set(), and Set().


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