1.1 --- a/src/node/ipv4-address.cc Mon Aug 17 18:58:54 2009 -0700
1.2 +++ b/src/node/ipv4-address.cc Sat Aug 22 14:58:27 2009 -0700
1.3 @@ -133,6 +133,20 @@
1.4 return ones;
1.5 }
1.6
1.7 +uint16_t
1.8 +Ipv4Mask::GetPrefixLength (void) const
1.9 +{
1.10 + uint16_t tmp = 0;
1.11 + uint32_t mask = m_mask;
1.12 + while (mask != 0 )
1.13 + {
1.14 + mask = mask << 1;
1.15 + tmp++;
1.16 + }
1.17 + return tmp;
1.18 +}
1.19 +
1.20 +
1.21 Ipv4Address::Ipv4Address ()
1.22 : m_address (0x66666666)
1.23 {}
2.1 --- a/src/node/ipv4-address.h Mon Aug 17 18:58:54 2009 -0700
2.2 +++ b/src/node/ipv4-address.h Sat Aug 22 14:58:27 2009 -0700
2.3 @@ -238,6 +238,10 @@
2.4 */
2.5 void Print (std::ostream &os) const;
2.6 /**
2.7 + * \return the prefix length of mask (the yy in x.x.x.x/yy notation)
2.8 + */
2.9 + uint16_t GetPrefixLength (void) const;
2.10 + /**
2.11 * \return the 255.0.0.0 mask corresponding to a typical loopback address
2.12 */
2.13 static Ipv4Mask GetLoopback (void);