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

a class to represent an Ipv4 address mask More...

#include <ipv4-address.h>

Public Member Functions

 Ipv4Mask ()
 Will initialize to a garbage value (0x66666666) More...
 
 Ipv4Mask (uint32_t mask)
 
 Ipv4Mask (char const *mask)
 
uint32_t Get (void) const
 Get the host-order 32-bit IP mask. More...
 
uint32_t GetInverse (void) const
 Return the inverse mask in host order. More...
 
uint16_t GetPrefixLength (void) const
 
bool IsEqual (Ipv4Mask other) const
 
bool IsMatch (Ipv4Address a, Ipv4Address b) const
 
void Print (std::ostream &os) const
 Print this mask to the given output stream. More...
 
void Set (uint32_t mask)
 input mask is in host order. More...
 

Static Public Member Functions

static Ipv4Mask GetLoopback (void)
 
static Ipv4Mask GetOnes (void)
 
static Ipv4Mask GetZero (void)
 

Private Attributes

uint32_t m_mask
 IP mask. More...
 

Detailed Description

a class to represent an Ipv4 address mask

The constructor takes arguments according to a few formats. Ipv4Mask ("255.255.255.255"), Ipv4Mask ("/32"), and Ipv4Mask (0xffffffff) are all equivalent.

Definition at line 222 of file ipv4-address.h.

Constructor & Destructor Documentation

ns3::Ipv4Mask::Ipv4Mask ( )

Will initialize to a garbage value (0x66666666)

Definition at line 69 of file ipv4-address.cc.

References NS_LOG_FUNCTION.

Referenced by GetLoopback(), GetOnes(), and GetZero().

+ Here is the caller graph for this function:

ns3::Ipv4Mask::Ipv4Mask ( uint32_t  mask)
Parameters
maskbitwise integer representation of the mask

For example, the integer input 0xffffff00 yields a 24-bit mask

Definition at line 75 of file ipv4-address.cc.

References NS_LOG_FUNCTION.

ns3::Ipv4Mask::Ipv4Mask ( char const *  mask)
Parameters
maskString constant either in "255.255.255.0" or "/24" format

Definition at line 81 of file ipv4-address.cc.

References ASCII_SLASH, ns3::AsciiToIpv4Host(), m_mask, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Function Documentation

uint32_t ns3::Ipv4Mask::GetInverse ( void  ) const

Return the inverse mask in host order.

Definition at line 138 of file ipv4-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv4Address::GetSubnetDirectedBroadcast(), and ns3::Ipv4Address::IsSubnetDirectedBroadcast().

+ Here is the caller graph for this function:

Ipv4Mask ns3::Ipv4Mask::GetLoopback ( void  )
static
Returns
the 255.0.0.0 mask corresponding to a typical loopback address

Definition at line 156 of file ipv4-address.cc.

References Ipv4Mask(), and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::SetupLoopback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16_t ns3::Ipv4Mask::GetPrefixLength ( void  ) const
Returns
the prefix length of mask (the yy in x.x.x.x/yy notation)

Definition at line 178 of file ipv4-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::PlanetLabFdNetDeviceHelper::CreateFileDescriptor(), ns3::Ipv4StaticRouting::GetDefaultRoute(), and ns3::Ipv4StaticRouting::LookupStatic().

+ Here is the caller graph for this function:

Ipv4Mask ns3::Ipv4Mask::GetZero ( void  )
static
Returns
the 0.0.0.0 mask

Definition at line 163 of file ipv4-address.cc.

References Ipv4Mask(), NS_LOG_FUNCTION_NOARGS, and zero.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::Ipv4Mask::IsEqual ( Ipv4Mask  other) const
Parameters
othera mask to compare
Returns
true if the mask equals the mask passed as input parameter

Definition at line 104 of file ipv4-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::TapBridge::CreateTap(), ns3::Ipv4RoutingTableEntry::IsHost(), ns3::operator!=(), and ns3::operator==().

+ Here is the caller graph for this function:

bool ns3::Ipv4Mask::IsMatch ( Ipv4Address  a,
Ipv4Address  b 
) const
Parameters
afirst address to compare
bsecond address to compare
Returns
true if both addresses are equal in their masked bits, corresponding to this mask

Definition at line 115 of file ipv4-address.cc.

References ns3::Ipv4Address::Get(), m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv4GlobalRouting::LookupGlobal(), and ns3::Ipv4StaticRouting::LookupStatic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Print this mask to the given output stream.

The print format is in the typical "255.255.255.0"

Parameters
osThe output stream to which this Ipv4Address is printed

Definition at line 145 of file ipv4-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::NscTcpL4Protocol::AddInterface(), and ns3::operator<<().

+ Here is the caller graph for this function:

void ns3::Ipv4Mask::Set ( uint32_t  mask)

input mask is in host order.

Parameters
maskThe host order 32-bit mask

Definition at line 132 of file ipv4-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by EpcTftClassifierTestSuite::EpcTftClassifierTestSuite().

+ Here is the caller graph for this function:

Member Data Documentation

uint32_t ns3::Ipv4Mask::m_mask
private

IP mask.

Definition at line 289 of file ipv4-address.h.

Referenced by Get(), GetInverse(), GetPrefixLength(), Ipv4Mask(), IsEqual(), IsMatch(), Print(), and Set().


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