add Address::IsInvalid
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 01 Aug 2007 09:01:54 +0200
changeset 1187 8ea0f4d4fd34
parent 1186 909e9eb2124e
child 1188 34386185bc1f
add Address::IsInvalid
src/node/address.cc
src/node/address.h
--- a/src/node/address.cc	Wed Aug 01 08:58:18 2007 +0200
+++ b/src/node/address.cc	Wed Aug 01 09:01:54 2007 +0200
@@ -40,6 +40,12 @@
   return *this;
 }
 
+bool
+Address::IsInvalid (void) const
+{
+  return m_len == 0 && m_type == 0;
+}
+
 uint8_t 
 Address::GetLength (void) const
 {
--- a/src/node/address.h	Wed Aug 01 08:58:18 2007 +0200
+++ b/src/node/address.h	Wed Aug 01 09:01:54 2007 +0200
@@ -87,6 +87,14 @@
   Address &operator = (const Address &address);
 
   /**
+   * \returns true if this address is invalid, false otherwise.
+   *
+   * An address is invalid if and only if it was created
+   * through the default constructor and it was never
+   * re-initialized.
+   */
+  bool IsInvalid (void);
+  /**
    * \returns the length of the underlying address.
    */
   uint8_t GetLength (void) const;