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

Private Member Functions

Address ConvertTo (void) const
 convert the IPv6Address object to an Address object.

Static Private Member Functions

static uint8_t GetType (void)
 Return the Type of address.

Private Attributes

uint8_t m_address [16]
 The address representation on 128 bits (16 bytes).

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

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


Constructor & Destructor Documentation

ns3::Ipv6Address::Ipv6Address (  ) 

Default constructor.

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

References m_address.

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

Constructs an Ipv6Address by parsing the input C-string.

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

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

References ns3::AsciiToIpv6Host(), and m_address.

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

Constructs an Ipv6Address by using the input 16 bytes.

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

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

References m_address.

ns3::Ipv6Address::Ipv6Address ( Ipv6Address const &  addr  ) 

Copy constructor.

Parameters:
addr Ipv6Address object

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

References m_address.

ns3::Ipv6Address::Ipv6Address ( Ipv6Address const *  addr  ) 

Copy constructor.

Parameters:
addr Ipv6Address pointer

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

References m_address.

ns3::Ipv6Address::~Ipv6Address (  ) 

Destructor.

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


Member Function Documentation

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

Combine this address with a prefix.

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

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

References m_address, and Set().

Referenced by IsLinkLocal().

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

Convert the Address object into an Ipv6Address one.

Returns:
an Ipv6Address

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

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

Address ns3::Ipv6Address::ConvertTo ( void   )  const [private]

convert the IPv6Address object to an Address object.

Returns:
the Address object corresponding to this object.

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

References GetType(), and Serialize().

Referenced by operator Address().

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

Deserialize this address.

Parameters:
buf buffer to read address from
Returns:
an Ipv6Address

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

Referenced by ConvertFrom().

Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast (  )  [static]

Get the "all hosts multicast" address.

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

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

Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast (  )  [static]

Get the "all nodes multicast" address.

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

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

Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast (  )  [static]

Get the "all routers multicast" address.

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

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

Ipv6Address ns3::Ipv6Address::GetAny ( void   )  [static]

Get the "any" (::) Ipv6Address.

Returns:
the "any" (::) Ipv6Address

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

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

Get the bytes corresponding to the address.

Parameters:
buf buffer to store the data
Returns:
bytes of the address

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

References m_address.

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

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

Get the loopback address.

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

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

uint8_t ns3::Ipv6Address::GetType ( void   )  [static, private]

Return the Type of address.

Returns:
type of address

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

References ns3::Address::Register().

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

Ipv6Address ns3::Ipv6Address::GetZero ( void   )  [static]

Get the 0 (::) Ipv6Address.

Returns:
the :: Ipv6Address representation

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

bool ns3::Ipv6Address::IsAllHostsMulticast (  )  const

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

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

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

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 394 of file ipv6-address.cc.

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 400 of file ipv6-address.cc.

bool ns3::Ipv6Address::IsAny (  )  const

If the IPv6 address is the "Any" address.

Returns:
true if it is, false otherwise

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

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

Comparison operation between two Ipv6Addresses.

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

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

References m_address.

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 490 of file ipv6-address.cc.

References CombinePrefix(), and IsMulticast().

bool ns3::Ipv6Address::IsLocalhost (  )  const

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

Returns:
true if localhost, false otherwise

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

bool ns3::Ipv6Address::IsMatchingType ( const Address address  )  [static]

If the Address matches the type.

Parameters:
address other address
Returns:
true if the type matches, false otherwise

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

References ns3::Address::CheckCompatible(), and GetType().

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

If the IPv6 address is multicast (ff00::/8).

Returns:
true if multicast, false otherwise

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

References m_address.

Referenced by IsLinkLocal().

bool ns3::Ipv6Address::IsSolicitedMulticast (  )  const

If the IPv6 address is a Solicited multicast address.

Returns:
true if it is, false otherwise

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

References Serialize().

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

Make the autoconfigured IPv6 address with Mac48Address.

Parameters:
addr the MAC address (48 bits).
prefix the IPv6 prefix
Returns:
autoconfigured IPv6 address

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

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

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

Make the autoconfigured link-local IPv6 address with Mac48Address.

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

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

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

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

Make the solicited IPv6 address.

Parameters:
addr the IPv6 address
Returns:
Solicited IPv6 address

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

References Serialize(), and Set().

ns3::Ipv6Address::operator Address ( void   )  const

Convert to Address object.

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

References ConvertTo().

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:
os the output stream to which this Ipv6Address is printed

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

References m_address.

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

Serialize this address to a 16-byte buffer.

Parameters:
buf the output buffer to which this address gets overwritter with this Ipv6Address

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

References m_address.

Referenced by ConvertTo(), ns3::Mac48Address::GetMulticast(), IsSolicitedMulticast(), and MakeSolicitedAddress().

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

Set an Ipv6Address by using the input 16 bytes.

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

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

References m_address.

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

Sets an Ipv6Address by parsing the input C-string.

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

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

References ns3::AsciiToIpv6Host(), and m_address.

Referenced by CombinePrefix(), MakeAutoconfiguredAddress(), MakeAutoconfiguredLinkLocalAddress(), and MakeSolicitedAddress().


Friends And Related Function Documentation

bool operator!= ( Ipv6Address const &  a,
Ipv6Address const &  b 
) [friend]

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

bool operator< ( Ipv6Address const &  a,
Ipv6Address const &  b 
) [friend]

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

bool operator== ( Ipv6Address const &  a,
Ipv6Address const &  b 
) [friend]

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


Member Data Documentation

uint8_t ns3::Ipv6Address::m_address[16] [private]

The address representation on 128 bits (16 bytes).

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

Referenced by CombinePrefix(), GetBytes(), Ipv6Address(), IsEqual(), IsMulticast(), ns3::operator!=(), ns3::operator<(), ns3::operator==(), Print(), Serialize(), and Set().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:12:03 2009 for NS-3 by  doxygen 1.6.3