A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::Ipv6Prefix Class Reference

Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask. More...

#include <ipv6-address.h>

Public Member Functions

 Ipv6Prefix ()
 Default constructor.
 Ipv6Prefix (uint8_t prefix[16])
 Constructs an Ipv6Prefix by using the input 16 bytes.
 Ipv6Prefix (char const *prefix)
 Constructs an Ipv6Prefix by using the input string.
 Ipv6Prefix (uint8_t prefix)
 Constructs an Ipv6Prefix by using the input number of bits.
 Ipv6Prefix (Ipv6Prefix const &prefix)
 Copy constructor.
 Ipv6Prefix (Ipv6Prefix const *prefix)
 Copy constructor.
 ~Ipv6Prefix ()
 Destructor.
void GetBytes (uint8_t buf[16]) const
 Get the bytes corresponding to the prefix.
uint8_t GetPrefixLength () const
 Get prefix length.
bool IsEqual (const Ipv6Prefix &other) const
 Comparison operation between two Ipv6Prefix.
bool IsMatch (Ipv6Address a, Ipv6Address b) const
 If the Address match the type.
void Print (std::ostream &os) const
 Print this address to the given output stream.

Static Public Member Functions

static Ipv6Prefix GetLoopback ()
 Get the loopback prefix ( /128).
static Ipv6Prefix GetOnes ()
 Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
static Ipv6Prefix GetZero ()
 Get the zero prefix ( /0).

Private Attributes

uint8_t m_prefix [16]
 The prefix representation.

Detailed Description

Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.

See Also
Ipv6Address

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

Constructor & Destructor Documentation

ns3::Ipv6Prefix::Ipv6Prefix ( )

Default constructor.

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

References m_prefix, and NS_LOG_FUNCTION.

ns3::Ipv6Prefix::Ipv6Prefix ( uint8_t  prefix[16])

Constructs an Ipv6Prefix by using the input 16 bytes.

Parameters
prefixthe 128-bit prefix

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

References m_prefix, and NS_LOG_FUNCTION.

ns3::Ipv6Prefix::Ipv6Prefix ( char const *  prefix)

Constructs an Ipv6Prefix by using the input string.

Parameters
prefixthe 128-bit prefix

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

References ns3::AsciiToIpv6Host(), m_prefix, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

ns3::Ipv6Prefix::Ipv6Prefix ( uint8_t  prefix)

Constructs an Ipv6Prefix by using the input number of bits.

Parameters
prefixnumber of bits of the prefix (0 - 128)
Note
A valid number of bits is between 0 and 128).

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

References m_prefix, NS_ASSERT, and NS_LOG_FUNCTION.

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

Copy constructor.

Parameters
prefixIpv6Prefix object

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

References m_prefix.

ns3::Ipv6Prefix::Ipv6Prefix ( Ipv6Prefix const *  prefix)

Copy constructor.

Parameters
prefixIpv6Prefix pointer

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

References m_prefix.

ns3::Ipv6Prefix::~Ipv6Prefix ( )

Destructor.

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

References NS_LOG_FUNCTION.

Member Function Documentation

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

Get the bytes corresponding to the prefix.

Parameters
bufbuffer to store the data

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

References m_prefix, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6AddressGeneratorImpl::Init(), and ns3::Ipv6AddressGeneratorImpl::PrefixToIndex().

+ Here is the caller graph for this function:

Ipv6Prefix ns3::Ipv6Prefix::GetLoopback ( void  )
static

Get the loopback prefix ( /128).

Returns
a Ipv6Prefix corresponding to loopback prefix

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

References NS_LOG_FUNCTION_NOARGS.

Ipv6Prefix ns3::Ipv6Prefix::GetOnes ( void  )
static

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

Returns
/128 Ipv6Prefix representation

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

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv6StaticRouting::AddHostRouteTo(), ns3::Ipv6RoutingTableEntry::CreateHostRouteTo(), and ns3::Ipv6RoutingTableEntry::IsHost().

+ Here is the caller graph for this function:

uint8_t ns3::Ipv6Prefix::GetPrefixLength ( void  ) const

Get prefix length.

Returns
prefix length

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

References m_prefix, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6StaticRouting::GetDefaultRoute(), and ns3::Ipv6StaticRouting::LookupStatic().

+ Here is the caller graph for this function:

Ipv6Prefix ns3::Ipv6Prefix::GetZero ( void  )
static

Get the zero prefix ( /0).

Returns
an Ipv6Prefix

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

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv6StaticRouting::SetDefaultRoute().

+ Here is the caller graph for this function:

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

Comparison operation between two Ipv6Prefix.

Parameters
otherthe IPv6 prefix to which to compare this prefix
Returns
true if the prefixes are equal, false otherwise

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

References m_prefix.

Referenced by ns3::Ipv6RoutingTableEntry::IsHost(), ns3::operator!=(), and ns3::operator==().

+ Here is the caller graph for this function:

bool ns3::Ipv6Prefix::IsMatch ( Ipv6Address  a,
Ipv6Address  b 
) const

If the Address match the type.

Parameters
aa first address
ba second address
Returns
true if the type match, false otherwise

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

References ns3::Ipv6Address::GetBytes(), m_prefix, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6Interface::GetAddressMatchingDestination(), ns3::Ipv6StaticRouting::HasNetworkDest(), and ns3::Ipv6StaticRouting::LookupStatic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6Prefix::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 741 of file ipv6-address.cc.

References m_prefix, and NS_LOG_FUNCTION.

Referenced by ns3::operator<<().

+ Here is the caller graph for this function:

Member Data Documentation

uint8_t ns3::Ipv6Prefix::m_prefix[16]
private

The prefix representation.

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

Referenced by GetBytes(), GetPrefixLength(), Ipv6Prefix(), IsEqual(), IsMatch(), and Print().


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