diff --git a/include/ndn-cpp/exclude.hpp b/include/ndn-cpp/exclude.hpp
index 8fee29e..276aa5b 100644
--- a/include/ndn-cpp/exclude.hpp
+++ b/include/ndn-cpp/exclude.hpp
@@ -17,16 +17,15 @@
 
 namespace ndn {
 
-namespace error {
-struct Exclude : public std::runtime_error { Exclude(const std::string &what) : std::runtime_error(what) {} };
-}
-
 /**
  * @brief Class to represent Exclude component in NDN interests
  */
 class Exclude
 {
 public:
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
+  
   typedef std::map< Name::Component, bool /*any*/, std::greater<Name::Component> > exclude_type;
 
   typedef exclude_type::iterator iterator;
@@ -88,7 +87,7 @@
    *
    * If there is an error with ranges (e.g., order of components is wrong) an exception is thrown
    */
-  void
+  inline void
   appendExclude (const Name::Component &name, bool any);
 
   /**
@@ -132,6 +131,20 @@
    */
   inline std::string
   toUri () const;
+
+  /**
+   * Encode this Interest for a particular wire format.
+   * @return The encoded byte array.
+   */
+  const Block&
+  wireEncode() const;
+  
+  /**
+   * Decode the input using a particular wire format and update this Interest.
+   * @param input The input byte array to be decoded.
+   */
+  void 
+  wireDecode(const Block &wire);
   
 private:
   Exclude &
@@ -139,6 +152,8 @@
 
 private:
   exclude_type m_exclude;
+
+  mutable Block wire_;
 };
 
 std::ostream&
@@ -150,6 +165,12 @@
   return excludeRange (Name::Component (), to);
 }
 
+inline void
+Exclude::appendExclude (const Name::Component &name, bool any)
+{
+  m_exclude[name] = any;
+}
+
 inline bool
 Exclude::empty () const
 {
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 4d65b6c..446db79 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -87,10 +87,10 @@
 {
   if (from >= to)
     {
-      throw error::Exclude ("Invalid exclude range [" +
-                            from.toEscapedString() + ", " +
-                            to.toEscapedString() +
-                            "] (for single name exclude use Exclude::excludeOne)");
+      throw Error ("Invalid exclude range [" +
+                   from.toEscapedString() + ", " +
+                   to.toEscapedString() +
+                   "] (for single name exclude use Exclude::excludeOne)");
     }
 
   iterator newFrom = m_exclude.lower_bound (from);
@@ -172,5 +172,78 @@
   return os;
 }
 
+const Block&
+Exclude::wireEncode() const
+{
+  if (wire_.hasWire())
+    return wire_;
+
+  wire_ = Block(Tlv::Exclude);
+
+  for (Exclude::const_reverse_iterator i = m_exclude.rbegin (); i != m_exclude.rend (); i++)
+    {
+      if (!i->first.empty())
+        {
+          OBufferStream os;
+          Tlv::writeVarNumber(os, Tlv::NameComponent);
+          Tlv::writeVarNumber(os, i->first.getValue().size());
+          os.write(reinterpret_cast<const char *>(i->first.getValue().buf()), i->first.getValue().size());
+          
+          wire_.push_back(Block(os.buf()));
+
+        }
+      if (i->second)
+        {
+          OBufferStream os;
+          Tlv::writeVarNumber(os, Tlv::Any);
+          Tlv::writeVarNumber(os, 0);
+          wire_.push_back(Block(os.buf()));
+        }
+    }
+
+  wire_.encode();
+  return wire_;
+}
+  
+void 
+Exclude::wireDecode(const Block &wire)
+{
+  wire_ = wire;
+  wire_.parse();
+
+  Block::element_const_iterator i = wire_.getAll().begin();
+  if (i->type() == Tlv::Any)
+    {
+      appendExclude("/", true);
+      ++i;
+    }
+
+  while (i != wire_.getAll().end())
+    {
+      if (i->type() != Tlv::NameComponent)
+        throw Error("Incorrect format of Exclude filter");
+
+      Name::Component excludedComponent (i->value(), i->value_size());
+      ++i;
+
+      if (i != wire_.getAll().end())
+        {
+          if (i->type() == Tlv::Any)
+            {
+              appendExclude(excludedComponent, true);
+              ++i;
+            }
+          else
+            {
+              appendExclude(excludedComponent, false);
+            }
+        }
+      else
+        {
+          appendExclude(excludedComponent, false);
+        }
+    }
+}
+
 
 } // ndn
