ns-3
ns3::Ipv6Address Class Reference

Describes an IPv6 address. More...

#include <ipv6-address.h>

List of all members.

Public Member Functions

 Ipv6Address ()
 Default constructor.
 Ipv6Address (char const *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 (Ipv6Address const &addr)
 Copy constructor.
 Ipv6Address (Ipv6Address const *addr)
 Copy constructor.
 ~Ipv6Address ()
 Destructor.
void Set (char const *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.
bool IsEqual (const Ipv6Address &other) const
 Comparison operation between two Ipv6Addresses.
void Serialize (uint8_t buf[16]) const
 Serialize this address to a 16-byte buffer.
Ipv4Address GetIpv4MappedAddress () const
 Return the Ipv4 address.
void Print (std::ostream &os) const
 Print this address to the given output stream.
bool IsLocalhost () const
 If the IPv6 address is localhost (::1).
bool IsMulticast () const
 If the IPv6 address is multicast (ff00::/8).
bool IsLinkLocalMulticast () const
 If the IPv6 address is link-local multicast (ff02::/16).
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 IsAllHostsMulticast () const
 If the IPv6 address is "all hosts multicast" (ff02::3/8).
bool IsLinkLocal () const
 If the IPv6 address is a link-local address (fe80::/64).
bool IsSolicitedMulticast () const
 If the IPv6 address is a Solicited multicast address.
bool IsAny () const
 If the IPv6 address is the "Any" address.
Ipv6Address CombinePrefix (Ipv6Prefix const &prefix)
 Combine this address with a prefix.
bool IsIpv4MappedAddress ()
 If the address is an IPv4-mapped address.
 operator Address () const
 Convert to Address object.
void GetBytes (uint8_t buf[16]) const
 Get the bytes corresponding to the address.

Static Public Member Functions

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

Friends

bool operator== (Ipv6Address const &a, Ipv6Address const &b)
bool operator!= (Ipv6Address const &a, Ipv6Address const &b)
bool operator< (Ipv6Address const &a, Ipv6Address const &b)

Detailed Description

Describes an IPv6 address.

See also:
Ipv6Prefix

Constructor & Destructor Documentation

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

Constructs an Ipv6Address by parsing the input C-string.

Parameters:
addressthe C-string containing the IPv6 address (e.g. 2001:660:4701::1).
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!
ns3::Ipv6Address::Ipv6Address ( Ipv6Address const &  addr)

Copy constructor.

Parameters:
addrIpv6Address object
ns3::Ipv6Address::Ipv6Address ( Ipv6Address const *  addr)

Copy constructor.

Parameters:
addrIpv6Address pointer

Member Function Documentation

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

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.

References Set().

Referenced by ns3::Ipv6L3Protocol::GetInterfaceForPrefix(), IsLinkLocal(), ns3::Ipv6StaticRouting::NotifyAddAddress(), ns3::Ipv6StaticRouting::NotifyInterfaceUp(), and ns3::Ipv6StaticRouting::NotifyRemoveAddress().

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

Convert the Address object into an Ipv6Address ones.

Parameters:
addressaddress to convert
Returns:
an Ipv6Address

References ns3::Address::CheckCompatible(), ns3::Address::CopyTo(), Deserialize(), and NS_ASSERT.

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

Deserialize this address.

Parameters:
bufbuffer to read address from
Returns:
an Ipv6Address

Referenced by ns3::Inet6SocketAddress::ConvertFrom(), ConvertFrom(), and GetIpv4MappedAddress().

Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast ( )
static

Get the "all hosts multicast" address.

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

Referenced by ns3::Ipv6ListRouting::RouteInput().

Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast ( )
static

Get the "all nodes multicast" address.

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

Referenced by ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Ipv6ListRouting::RouteInput(), and ns3::Icmpv6L4Protocol::SendNS().

Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast ( )
static

Get the "all routers multicast" address.

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

Referenced by ns3::Icmpv6L4Protocol::FunctionDadTimeout(), ns3::Ipv6EndPointDemux::Lookup(), and ns3::Ipv6ListRouting::RouteInput().

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

Get the bytes corresponding to the address.

Parameters:
bufbuffer to store the data
Returns:
bytes of the address

Referenced by ns3::Ipv6Prefix::IsMatch(), MakeAutoconfiguredAddress(), ns3::Ipv6AddressHash::operator()(), and ns3::Icmpv6OptionPrefixInformation::Serialize().

Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress ( ) const

Return the Ipv4 address.

Returns:
Ipv4 address

References Deserialize(), and Serialize().

Referenced by ns3::TcpSocketBase::Connect().

Ipv6Address ns3::Ipv6Address::GetLoopback ( void  )
static

Get the loopback address.

Returns:
the "::1/128" Ipv6Address representation.
Ipv6Address ns3::Ipv6Address::GetOnes ( void  )
static

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

Returns:
all-1 Ipv6Address representation
bool ns3::Ipv6Address::IsAllHostsMulticast ( ) const

If the IPv6 address is "all hosts multicast" (ff02::3/8).

Returns:
true if "all hosts multicast", false otherwise

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

bool ns3::Ipv6Address::IsAllNodesMulticast ( ) const

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

Returns:
true if "all nodes multicast", false otherwise

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

bool ns3::Ipv6Address::IsAllRoutersMulticast ( ) const

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

Returns:
true if "all routers multicast", false otherwise

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

bool ns3::Ipv6Address::IsAny ( ) const
bool ns3::Ipv6Address::IsEqual ( const Ipv6Address other) const

Comparison operation between two Ipv6Addresses.

Parameters:
otherthe IPv6 address to which to compare thisaddress
Returns:
true if the addresses are equal, false otherwise

Referenced by ns3::Ipv6RoutingTableEntry::IsDefault(), ns3::Ipv6RoutingTableEntry::IsGateway(), ns3::Ipv6ListRouting::RouteInput(), and ns3::Ipv6StaticRouting::RouteInput().

bool ns3::Ipv6Address::IsIpv4MappedAddress ( )

If the address is an IPv4-mapped address.

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

Referenced by ns3::TcpSocketBase::Connect().

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

References CombinePrefix(), and IsMulticast().

Referenced by ns3::Icmpv6L4Protocol::FunctionDadTimeout(), ns3::Icmpv6L4Protocol::Lookup(), ns3::Ipv6L3Protocol::Send(), and ns3::Ipv6InterfaceAddress::SetAddress().

bool ns3::Ipv6Address::IsLinkLocalMulticast ( ) const

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

Returns:
true if link-local multicast, false otherwise
bool ns3::Ipv6Address::IsLocalhost ( ) const

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

Returns:
true if localhost, false otherwise

Referenced by ns3::Ipv6Interface::AddAddress(), and ns3::Ipv6InterfaceAddress::SetAddress().

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

References ns3::Address::CheckCompatible().

bool ns3::Ipv6Address::IsMulticast ( void  ) const
bool ns3::Ipv6Address::IsSolicitedMulticast ( ) const

If the IPv6 address is a Solicited multicast address.

Returns:
true if it is, false otherwise

References Serialize().

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

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

Make the autoconfigured IPv6 address with Mac48Address.

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

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

Referenced by ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::Ipv6AddressHelper::NewAddress(), and ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress().

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

Make the autoconfigured link-local IPv6 address with Mac48Address.

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

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

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

Make the Ipv4-mapped IPv6 address.

Parameters:
addrthe IPv4 address
Returns:
Ipv4-mapped IPv6 address

References ns3::Ipv4Address::Serialize().

Referenced by ns3::UdpL4Protocol::Receive(), and ns3::TcpL4Protocol::Receive().

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

Make the solicited IPv6 address.

Parameters:
addrthe IPv6 address
Returns:
Solicited IPv6 address

References Serialize(), and Set().

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

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
void ns3::Ipv6Address::Serialize ( uint8_t  buf[16]) const
void ns3::Ipv6Address::Set ( char const *  address)

Sets an Ipv6Address by parsing the input C-string.

Parameters:
addressthe C-string containing the IPv6 address (e.g. 2001:660:4701::1).

Referenced by CombinePrefix(), ns3::Icmpv6NS::Deserialize(), ns3::Icmpv6NA::Deserialize(), ns3::Icmpv6Redirection::Deserialize(), MakeAutoconfiguredAddress(), MakeAutoconfiguredLinkLocalAddress(), and MakeSolicitedAddress().

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!

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