network: Add IsLocalhost and IsAny to Ipv4Address

This commit is contained in:
Tommaso Pecorella
2016-02-07 22:24:16 +01:00
parent 377821fd56
commit dfe7129d43
4 changed files with 42 additions and 0 deletions

View File

@@ -1848,6 +1848,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
@@ -1863,6 +1868,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',

View File

@@ -1848,6 +1848,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
@@ -1863,6 +1868,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',

View File

@@ -264,6 +264,20 @@ Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const
return ( (Get () | mask.GetInverse ()) == Get () );
}
bool
Ipv4Address::IsAny (void) const
{
NS_LOG_FUNCTION (this);
return (m_address == 0x00000000U);
}
bool
Ipv4Address::IsLocalhost (void) const
{
NS_LOG_FUNCTION (this);
return (m_address == 0x7f000001U);
}
bool
Ipv4Address::IsBroadcast (void) const
{

View File

@@ -105,6 +105,14 @@ public:
* \param os The output stream to which this Ipv4Address is printed
*/
void Print (std::ostream &os) const;
/**
* \return true if address is 0.0.0.0; false otherwise
*/
bool IsAny (void) const;
/**
* \return true if address is 127.0.0.1; false otherwise
*/
bool IsLocalhost (void) const;
/**
* \return true if address is 255.255.255.255; false otherwise
*/