add Ipv4Address::IsMatchingType and Eui48Address::IsMatchingType

This commit is contained in:
Mathieu Lacage
2007-07-30 13:58:39 +02:00
parent f2084098e2
commit 22cf3afdfa
4 changed files with 15 additions and 0 deletions

View File

@@ -71,6 +71,11 @@ Eui48Address::CopyTo (uint8_t buffer[6]) const
memcpy (buffer, m_address, 6);
}
bool
Eui48Address::IsMatchingType (const Address &address)
{
return address.CheckCompatible (GetType (), 6);
}
Address
Eui48Address::ConvertTo (void) const
{

View File

@@ -42,6 +42,10 @@ public:
* Convert an instance of this class to a polymorphic Address instance.
*/
Address ConvertTo (void) const;
/**
* \returns true if the address matches, false otherwise.
*/
static bool IsMatchingType (const Address &address);
/**
* \param address a polymorphic address
*

View File

@@ -206,6 +206,11 @@ Ipv4Address::Print (std::ostream &os) const
<< ((m_address >> 0) & 0xff);
}
bool
Ipv4Address::IsMatchingType (const Address &address)
{
return address.CheckCompatible (GetType (), 4);
}
Address
Ipv4Address::ConvertTo (void) const
{

View File

@@ -104,6 +104,7 @@ public:
*/
Ipv4Address CombineMask (Ipv4Mask const &mask) const;
static bool IsMatchingType (const Address &address);
Address ConvertTo (void) const;
static Ipv4Address ConvertFrom (const Address &address);