ns3::Ipv4Mask Class Reference
[Address]

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

#include <ipv4-address.h>

List of all members.

Public Member Functions

 Ipv4Mask ()
 Ipv4Mask (uint32_t mask)
 Ipv4Mask (char const *mask)
bool IsMatch (Ipv4Address a, Ipv4Address b) const
bool IsEqual (Ipv4Mask other) const
uint32_t Get (void) const
void Set (uint32_t mask)
uint32_t GetInverse (void) const
 Return the inverse mask in host order.
void Print (std::ostream &os) const
 Print this mask to the given output stream.
uint16_t GetPrefixLength (void) const

Static Public Member Functions

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

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.


Constructor & Destructor Documentation

ns3::Ipv4Mask::Ipv4Mask (  ) 

Will initialize to a garbage value (0x66666666)

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

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

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

Member Function Documentation

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

Get the host-order 32-bit IP mask

Returns:
the host-order 32-bit IP mask
static Ipv4Mask ns3::Ipv4Mask::GetLoopback ( void   )  [static]
Returns:
the 255.0.0.0 mask corresponding to a typical loopback address
static Ipv4Mask ns3::Ipv4Mask::GetOnes ( void   )  [static]
Returns:
the 255.255.255.255 mask
uint16_t ns3::Ipv4Mask::GetPrefixLength ( void   )  const
Returns:
the prefix length of mask (the yy in x.x.x.x/yy notation)
static Ipv4Mask ns3::Ipv4Mask::GetZero ( void   )  [static]
Returns:
the 0.0.0.0 mask
bool ns3::Ipv4Mask::IsEqual ( Ipv4Mask  other  )  const
Parameters:
other a mask to compare
Returns:
true if the mask equals the mask passed as input parameter
bool ns3::Ipv4Mask::IsMatch ( Ipv4Address  a,
Ipv4Address  b 
) const
Parameters:
a first address to compare
b second address to compare
Returns:
true if both addresses are equal in their masked bits, corresponding to this mask
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:
os The output stream to which this Ipv4Address is printed
void ns3::Ipv4Mask::Set ( uint32_t  mask  ) 

input mask is in host order.

Parameters:
mask The host order 32-bit mask

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

Generated on 6 Jan 2011 for NS-3 by  doxygen 1.6.1