ns3::Ipv4Address Class Reference
[Address]

Ipv4 addresses are stored in host order in this class. More...

#include <ipv4-address.h>

List of all members.

Public Member Functions

 Ipv4Address (uint32_t address)
 Ipv4Address (char const *address)
 Constructs an Ipv4Address by parsing a the input C-string.
uint32_t Get (void) const
void Set (uint32_t address)
void Set (char const *address)
 Sets an Ipv4Address by parsing a the input C-string.
bool IsEqual (const Ipv4Address &other) const
 Comparison operation between two Ipv4Addresses.
void Serialize (uint8_t buf[4]) const
void Print (std::ostream &os) const
 Print this address to the given output stream.
bool IsBroadcast (void) const
bool IsMulticast (void) const
Ipv4Address CombineMask (Ipv4Mask const &mask) const
 Combine this address with a network mask.
Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const
 Generate subnet-directed broadcast address corresponding to mask.
bool IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const
 Generate subnet-directed broadcast address corresponding to mask.
 operator Address () const

Static Public Member Functions

static Ipv4Address Deserialize (const uint8_t buf[4])
static bool IsMatchingType (const Address &address)
static Ipv4Address ConvertFrom (const Address &address)
static Ipv4Address GetZero (void)
static Ipv4Address GetAny (void)
static Ipv4Address GetBroadcast (void)
static Ipv4Address GetLoopback (void)


Detailed Description

Ipv4 addresses are stored in host order in this class.

Constructor & Destructor Documentation

ns3::Ipv4Address::Ipv4Address ( uint32_t  address  )  [explicit]

input address is in host order.

Parameters:
address The host order 32-bit address

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

Constructs an Ipv4Address by parsing a the input C-string.

Input address is in format: hhh.xxx.xxx.lll where h is the high byte and l the low byte

Parameters:
address C-string containing the address as described above


Member Function Documentation

Ipv4Address ns3::Ipv4Address::CombineMask ( Ipv4Mask const &  mask  )  const

Combine this address with a network mask.

This method returns an IPv4 address that is this address combined (bitwise and) with a network mask, yielding an IPv4 network address.

Parameters:
mask a network mask

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

Parameters:
address a polymorphic address
Returns:
a new Ipv4Address from the polymorphic address
This function performs a type check and asserts if the type of the input address is not compatible with an Ipv4Address.

static Ipv4Address ns3::Ipv4Address::Deserialize ( const uint8_t  buf[4]  )  [static]

Parameters:
buf buffer to read address from
Returns:
an Ipv4Address
The input address is expected to be in network byte order format.

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

Get the host-order 32-bit IP address

Returns:
the host-order 32-bit IP address

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

Returns:
the 0.0.0.0 address

static Ipv4Address ns3::Ipv4Address::GetBroadcast ( void   )  [static]

Returns:
the 255.255.255.255 address

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

Returns:
the 127.0.0.1 address

Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast ( Ipv4Mask const &  mask  )  const

Generate subnet-directed broadcast address corresponding to mask.

The subnet-directed broadcast address has the host bits set to all ones. If this method is called with a mask of 255.255.255.255, (i.e., the address is a /32 address), the program will assert, since there is no subnet associated with a /32 address.

Parameters:
mask a network mask

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

Returns:
the 0.0.0.0 address

bool ns3::Ipv4Address::IsBroadcast ( void   )  const

Returns:
true if address is 255.255.255.255; false otherwise

bool ns3::Ipv4Address::IsEqual ( const Ipv4Address other  )  const [inline]

Comparison operation between two Ipv4Addresses.

Parameters:
other address to which to compare this address
Returns:
True if the addresses are equal. False otherwise.

References m_address.

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

Parameters:
address an address to compare type with
Returns:
true if the type of the address stored internally is compatible with the type of the input address, false otherwise.

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

Returns:
true only if address is in the range 224.0.0.0 - 239.255.255.255

bool ns3::Ipv4Address::IsSubnetDirectedBroadcast ( Ipv4Mask const &  mask  )  const

Generate subnet-directed broadcast address corresponding to mask.

The subnet-directed broadcast address has the host bits set to all ones. If this method is called with a mask of 255.255.255.255, (i.e., the address is a /32 address), the program will assert, since there is no subnet associated with a /32 address.

Parameters:
mask a network mask
Returns:
true if the address, when combined with the input mask, has all of its host bits set to one

ns3::Ipv4Address::operator Address (  )  const

Convert an instance of this class to a polymorphic Address instance.

Returns:
a new Address instance

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

Print this address to the given output stream.

The print format is in the typical "192.168.1.1"

Parameters:
os The output stream to which this Ipv4Address is printed

void ns3::Ipv4Address::Serialize ( uint8_t  buf[4]  )  const

Serialize this address to a 4-byte buffer

Parameters:
buf output buffer to which this address gets overwritten with this Ipv4Address

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

Sets an Ipv4Address by parsing a the input C-string.

Input address is in format: hhh.xxx.xxx.lll where h is the high byte and l the low byte

Parameters:
address C-string containing the address as described above

void ns3::Ipv4Address::Set ( uint32_t  address  ) 

input address is in host order.

Parameters:
address The host order 32-bit address


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

Generated on Fri Apr 9 15:01:10 2010 for NS-3 by  doxygen 1.5.8