Add Ipv4Address::CombineMask, and implement Ipv4Address::IsBroadcast.
This commit is contained in:
@@ -145,6 +145,18 @@ Ipv4Address::IsEqual (Ipv4Address other) const
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsBroadcast (void) const
|
||||
{
|
||||
return (m_address == 0xffffffffU);
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4Address::CombineMask (Ipv4Mask const &mask) const
|
||||
{
|
||||
return Ipv4Address (GetHostOrder () & mask.GetHostOrder ());
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsMulticast (void)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Ipv4Mask;
|
||||
|
||||
/** Ipv4 addresses are stored in host order in
|
||||
* this class.
|
||||
*/
|
||||
@@ -80,8 +82,19 @@ public:
|
||||
*/
|
||||
void Print (std::ostream &os) const;
|
||||
|
||||
bool IsBroadcast (void);
|
||||
bool IsBroadcast (void) const;
|
||||
bool IsMulticast (void);
|
||||
|
||||
/**
|
||||
* \brief 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.
|
||||
*
|
||||
* \param a network mask
|
||||
*/
|
||||
Ipv4Address CombineMask (Ipv4Mask const &mask) const;
|
||||
|
||||
static Ipv4Address GetZero (void);
|
||||
static Ipv4Address GetAny (void);
|
||||
|
||||
Reference in New Issue
Block a user