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 (const char *mask) | |
Ipv4Mask (uint32_t mask) | |
uint32_t | Get () const |
Get the host-order 32-bit IP mask. More... | |
uint32_t | GetInverse () const |
Return the inverse mask in host order. More... | |
uint16_t | GetPrefixLength () 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 () |
static Ipv4Mask | GetOnes () |
static Ipv4Mask | GetZero () |
Private Attributes | |
uint32_t | m_mask |
IP mask. More... | |
Friends | |
bool | operator!= (const Ipv4Mask &a, const Ipv4Mask &b) |
Not equal to operator. More... | |
bool | operator== (const Ipv4Mask &a, const Ipv4Mask &b) |
Equal to operator. More... | |
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 256 of file ipv4-address.h.
ns3::Ipv4Mask::Ipv4Mask | ( | ) |
Will initialize to a garbage value (0x66666666)
Definition at line 38 of file ipv4-address.cc.
References NS_LOG_FUNCTION.
ns3::Ipv4Mask::Ipv4Mask | ( | uint32_t | mask | ) |
mask | bitwise integer representation of the mask |
For example, the integer input 0xffffff00 yields a 24-bit mask
Definition at line 44 of file ipv4-address.cc.
References NS_LOG_FUNCTION.
ns3::Ipv4Mask::Ipv4Mask | ( | const char * | mask | ) |
mask | String constant either in "255.255.255.0" or "/24" format |
Definition at line 50 of file ipv4-address.cc.
References m_mask, NS_ABORT_MSG, NS_ASSERT, and NS_LOG_FUNCTION.
uint32_t ns3::Ipv4Mask::Get | ( | ) | const |
Get the host-order 32-bit IP mask.
Definition at line 84 of file ipv4-address.cc.
References m_mask, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(), ns3::Ipv4Address::CombineMask(), ns3::Ipv4AddressGeneratorImpl::Init(), ns3::Ipv4Address::IsSubnetDirectedBroadcast(), ns3::Ipv4AddressGeneratorImpl::MaskToIndex(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessPointToPointLink(), ns3::GlobalRouter::ProcessSingleBroadcastLink(), ns3::DhcpServer::SendOffer(), ns3::RipRte::Serialize(), and ns3::Ipv4AddressHelper::SetBase().
uint32_t ns3::Ipv4Mask::GetInverse | ( | ) | const |
Return the inverse mask in host order.
Definition at line 98 of file ipv4-address.cc.
References m_mask, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4Address::GetSubnetDirectedBroadcast().
|
static |
Definition at line 113 of file ipv4-address.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::Ipv4L3ClickProtocol::SetupLoopback(), and ns3::Ipv4L3Protocol::SetupLoopback().
|
static |
Definition at line 129 of file ipv4-address.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::Ipv4StaticRouting::AddHostRouteTo(), ns3::TapBridge::CreateTap(), ns3::Ipv4Address::GetSubnetDirectedBroadcast(), ns3::Ipv4RoutingTableEntry::IsHost(), ns3::Ipv4Address::IsSubnetDirectedBroadcast(), ns3::Ipv4StaticRouting::NotifyInterfaceUp(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendHello(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrMessage(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().
uint16_t ns3::Ipv4Mask::GetPrefixLength | ( | ) | const |
Definition at line 137 of file ipv4-address.cc.
References m_mask, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4StaticRouting::GetDefaultRoute(), ns3::Ipv4EndPointDemux::Lookup(), ns3::Rip::Lookup(), ns3::Ipv4StaticRouting::LookupStatic(), ns3::RipRte::Print(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter::ProcessSingleBroadcastLink().
|
static |
Definition at line 121 of file ipv4-address.cc.
References NS_LOG_FUNCTION_NOARGS, and zero.
Referenced by ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper(), ns3::Rip::AddDefaultRouteTo(), ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(), ns3::TapFdNetDeviceHelper::CreateFileDescriptor(), ns3::Rip::DoSendRouteUpdate(), ns3::Rip::HandleRequests(), ns3::Rip::SendRouteRequest(), and ns3::Ipv4StaticRouting::SetDefaultRoute().
bool ns3::Ipv4Mask::IsMatch | ( | Ipv4Address | a, |
Ipv4Address | b | ||
) | const |
a | first address to compare |
b | second address to compare |
Definition at line 77 of file ipv4-address.cc.
References ns3::Ipv4Address::Get(), m_mask, and NS_LOG_FUNCTION.
Referenced by ns3::Rip::Lookup(), ns3::Ipv4GlobalRouting::LookupGlobal(), and ns3::Ipv4StaticRouting::LookupStatic().
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"
os | The output stream to which this Ipv4Address is printed |
Definition at line 105 of file ipv4-address.cc.
References m_mask, and NS_LOG_FUNCTION.
Referenced by ns3::operator<<().
void ns3::Ipv4Mask::Set | ( | uint32_t | mask | ) |
input mask is in host order.
mask | The host order 32-bit mask |
Definition at line 91 of file ipv4-address.cc.
References m_mask, and NS_LOG_FUNCTION.
Referenced by EpcTftClassifierTestSuite::EpcTftClassifierTestSuite(), and ns3::RipRte::Deserialize().
Not equal to operator.
a | the first operand. |
b | the first operand. |
Definition at line 421 of file ipv4-address.h.
Equal to operator.
a | the first operand. |
b | the first operand. |
Definition at line 415 of file ipv4-address.h.
|
private |
IP mask.
Definition at line 338 of file ipv4-address.h.
Referenced by Ipv4Mask(), Get(), GetInverse(), GetPrefixLength(), IsMatch(), Print(), and Set().