merge with HEAD

This commit is contained in:
Mathieu Lacage
2007-10-16 14:44:36 +02:00
55 changed files with 5906 additions and 349 deletions

View File

@@ -151,16 +151,6 @@ Ipv4Address::Set (char const *address)
m_address = AsciiToIpv4Host (address);
}
bool
Ipv4Address::IsEqual (Ipv4Address other) const
{
if (other.m_address == m_address) {
return true;
} else {
return false;
}
}
Ipv4Address
Ipv4Address::CombineMask (Ipv4Mask const &mask) const
{
@@ -296,19 +286,6 @@ Ipv4Address::GetLoopback (void)
return loopback;
}
bool operator == (Ipv4Address const &a, Ipv4Address const &b)
{
return a.IsEqual (b);
}
bool operator != (Ipv4Address const &a, Ipv4Address const &b)
{
return !a.IsEqual (b);
}
bool operator < (Ipv4Address const &addrA, Ipv4Address const &addrB)
{
return (addrA.GetHostOrder () < addrB.GetHostOrder ());
}
size_t Ipv4AddressHash::operator()(Ipv4Address const &x) const
{
return x.GetHostOrder ();

View File

@@ -73,7 +73,10 @@ public:
* \param other address to which to compare this address
* \return True if the addresses are equal. False otherwise.
*/
bool IsEqual (Ipv4Address other) const;
bool IsEqual (const Ipv4Address &other) const
{
return m_address == other.m_address;
}
/**
* \brief Get the host-order 32-bit IP address
@@ -142,6 +145,10 @@ private:
Address ConvertTo (void) const;
static uint8_t GetType (void);
uint32_t m_address;
friend bool operator == (Ipv4Address const &a, Ipv4Address const &b);
friend bool operator != (Ipv4Address const &a, Ipv4Address const &b);
friend bool operator < (Ipv4Address const &addrA, Ipv4Address const &addrB);
};
@@ -177,9 +184,19 @@ private:
std::ostream& operator<< (std::ostream& os, Ipv4Address const& address);
std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask);
bool operator == (Ipv4Address const &a, Ipv4Address const &b);
bool operator != (Ipv4Address const &a, Ipv4Address const &b);
bool operator < (Ipv4Address const &addrA, Ipv4Address const &addrB);
inline bool operator == (const Ipv4Address &a, const Ipv4Address &b)
{
return (a.m_address == b.m_address);
}
inline bool operator != (const Ipv4Address &a, const Ipv4Address &b)
{
return (a.m_address != b.m_address);
}
inline bool operator < (const Ipv4Address &a, const Ipv4Address &b)
{
return (a.m_address < b.m_address);
}
class Ipv4AddressHash : public std::unary_function<Ipv4Address, size_t> {
public:

View File

@@ -383,6 +383,20 @@ public:
*/
virtual Ipv4Mask GetNetworkMask (uint32_t i) const = 0;
/**
* \param i index of ipv4 interface
* \param metric routing metric (cost) associated to the underlying
* ipv4 interface
*/
virtual void SetMetric (uint32_t i, uint16_t metric) = 0;
/**
* \param i index of ipv4 interface
* \returns routing metric (cost) associated to the underlying
* ipv4 interface
*/
virtual uint16_t GetMetric (uint32_t i) const = 0;
/**
* \param i index of ipv4 interface
* \returns the address associated to the underlying ipv4 interface