model: Returning back support for CCNb wire format

Refs #1008 (http://redmine.named-data.net/)
diff --git a/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc
new file mode 100644
index 0000000..91112da
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.cc
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "content-type-visitor.h"
+#include "../syntax-tree/blob.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+ContentTypeVisitor::visit (Blob &n) 
+{
+  // Buffer n.m_blob;
+  if (n.m_blobSize != 3)
+    throw CcnbDecodingException ();
+
+  uint32_t type =
+    (n.m_blob [0] << 16) |
+    (n.m_blob [1] << 8 ) |
+    (n.m_blob [2]      );
+    
+  return boost::any (type);
+}
+
+boost::any
+ContentTypeVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  throw CcnbDecodingException ();
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h
new file mode 100644
index 0000000..aa9abbf
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/content-type-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
+#define _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
+
+#include "no-argu-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain nonce value from BLOB block
+ *
+ * Note, only first 32 bits will be actually parsed into nonce. If
+ * original Nonce contains more, the rest will be ignored
+ *
+ * Will return empty boost::any() if called on anything except BLOB block
+ */
+class ContentTypeVisitor : public NoArguDepthFirstVisitor
+{
+public:
+  virtual boost::any visit (Blob &n); 
+  virtual boost::any visit (Udata &n); ///< Throws parsing error if BLOB object is encountered
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc
new file mode 100644
index 0000000..b82b140
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.cc
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "depth-first-visitor.h"
+
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
+
+#include <boost/foreach.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+DepthFirstVisitor::visit (Blob &n, boost::any param)
+{
+  // Buffer n.m_blob;
+  return n.m_blob;
+}
+ 
+boost::any
+DepthFirstVisitor::visit (Udata &n, boost::any param)
+{
+  // std::string n.m_udata;
+  return n.m_udata;
+}
+ 
+boost::any
+DepthFirstVisitor::visit (Tag &n, boost::any param)
+{
+  // std::string n.m_tag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this, param);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this, param);
+    }
+  return boost::any();
+}
+
+boost::any
+DepthFirstVisitor::visit (Dtag &n, boost::any param)
+{
+  // std::string n.m_tag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this, param);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this, param);
+    }
+  return boost::any ();
+}
+
+boost::any
+DepthFirstVisitor::visit (Attr &n, boost::any param)
+{
+  // std::string n.m_attr;
+  // Ptr<Udata> n.m_value;
+  return boost::any ();
+}
+
+boost::any
+DepthFirstVisitor::visit (Dattr &n, boost::any param)
+{
+  // uint32_t n.m_dattr;
+  // Ptr<Udata> n.m_value;
+  return boost::any ();
+}
+ 
+boost::any
+DepthFirstVisitor::visit (Ext &n, boost::any param)
+{
+  // uint64_t n.m_extSubtype;
+  return n.m_extSubtype;
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h
new file mode 100644
index 0000000..be701b1
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/depth-first-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
+#define _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
+
+#include "visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Depth-first visitor that takes boot::any as argument and returns boost::any value
+ */
+class DepthFirstVisitor : public Visitor
+{
+public:
+  virtual boost::any visit (Blob&,  boost::any);
+  virtual boost::any visit (Udata&, boost::any);
+  virtual boost::any visit (Tag&,   boost::any);
+  virtual boost::any visit (Attr&,  boost::any);
+  virtual boost::any visit (Dtag&,  boost::any);
+  virtual boost::any visit (Dattr&, boost::any);
+  virtual boost::any visit (Ext&,   boost::any);
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc
new file mode 100644
index 0000000..13043d3
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.cc
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "name-visitor.h"
+
+#include "string-visitor.h"
+#include "../syntax-tree/dtag.h"
+
+#include "ns3/ndn-name.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+void
+NameVisitor::visit (Dtag &n, boost::any param/*should be Name* */)
+{
+  // uint32_t n.m_dtag;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  static StringVisitor stringVisitor; 
+ 
+  Name &components = *(boost::any_cast<Name*> (param));
+
+  switch (n.m_dtag)
+    {
+    case CCN_DTAG_Component:
+      if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
+        throw CcnbDecodingException ();
+      components.Add (
+                      boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept(
+                                                                                      stringVisitor
+                                                                                      )));
+      break;
+    default:
+      // ignore any other components
+      // when parsing Exclude, there could be <Any /> and <Bloom /> tags
+      break;
+    }
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/name-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.h
new file mode 100644
index 0000000..f71e202
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/name-visitor.h
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
+#define _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
+
+#include "void-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain fill CcnxName object with name components
+ */
+class NameVisitor : public VoidDepthFirstVisitor
+{
+public:
+  virtual void visit (Dtag &n, boost::any param/*should be Name* */);
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
+
diff --git a/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
new file mode 100644
index 0000000..6393e7e
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "no-argu-depth-first-visitor.h"
+
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
+
+#include <boost/foreach.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+NoArguDepthFirstVisitor::visit (Blob &n)
+{
+  // Buffer n.m_blob;
+  return n.m_blob;
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  return n.m_udata;
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Tag &n)
+{
+  // uint32_t n.m_dtag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this);
+    }
+  return boost::any ();
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Dtag &n)
+{
+  // uint32_t n.m_dtag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this);
+    }
+  return boost::any();
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Attr &n)
+{
+  // std::string n.m_attr;
+  // Ptr<Udata> n.m_value;
+  return boost::any ();
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Dattr &n)
+{
+  // uint32_t n.m_dattr;
+  // Ptr<Udata> n.m_value;
+  return boost::any ();
+}
+ 
+boost::any
+NoArguDepthFirstVisitor::visit (Ext &n)
+{
+  // uint64_t n.m_extSubtype;
+  return n.m_extSubtype;
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h
new file mode 100644
index 0000000..c400083
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-depth-first-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
+#define _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
+
+#include "no-argu-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Depth-first visitor that takes no arguments and returns boost::any value
+ */
+class NoArguDepthFirstVisitor : public NoArguVisitor
+{
+public:
+  virtual boost::any visit (Blob& );
+  virtual boost::any visit (Udata&);
+  virtual boost::any visit (Tag&  );
+  virtual boost::any visit (Attr& );
+  virtual boost::any visit (Dtag& );
+  virtual boost::any visit (Dattr&);
+  virtual boost::any visit (Ext&  );
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h
new file mode 100644
index 0000000..d603a0a
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/no-argu-visitor.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_NO_ARGU_VISITOR_H_
+#define _CCNB_PARSER_NO_ARGU_VISITOR_H_
+
+#include "../common.h"
+#include <boost/any.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor interface that takes no arguments and returns boost::any
+ *
+ * \see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ * for ccnb encoding format help
+ */
+class NoArguVisitor
+{
+public:
+  virtual boost::any visit (Blob& )=0; ///< \brief Method accepting BLOB block  
+  virtual boost::any visit (Udata&)=0; ///< \brief Method accepting UDATA block 
+  virtual boost::any visit (Tag&  )=0; ///< \brief Method accepting TAG block   
+  virtual boost::any visit (Attr& )=0; ///< \brief Method accepting ATTR block  
+  virtual boost::any visit (Dtag& )=0; ///< \brief Method accepting DTAG block  
+  virtual boost::any visit (Dattr&)=0; ///< \brief Method accepting DATTR block 
+  virtual boost::any visit (Ext&  )=0; ///< \brief Method accepting EXT block
+
+  virtual ~NoArguVisitor () { }
+};
+  
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_NO_ARGU_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc
new file mode 100644
index 0000000..9c2fee3
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.cc
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "non-negative-integer-visitor.h"
+
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include <sstream>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+NonNegativeIntegerVisitor::visit (Blob &n) //to throw parsing error
+{
+  // Buffer n.m_blob;
+  throw CcnbDecodingException ();
+}
+
+boost::any
+NonNegativeIntegerVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  std::istringstream is (n.m_udata);
+  int32_t value;
+  is >> value;
+  if (value<0) // value should be non-negative
+    throw CcnbDecodingException ();
+
+  return static_cast<uint32_t> (value);
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h
new file mode 100644
index 0000000..027e0eb
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/non-negative-integer-visitor.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
+#define _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
+
+#include "no-argu-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain non-negative integer value from UDATA block
+ *
+ * Will return empty boost::any() if called on anything except UDATA block
+ */
+class NonNegativeIntegerVisitor : public NoArguDepthFirstVisitor
+{
+public:
+  virtual boost::any visit (Blob &n); ///< Throws an exception if BLOB object is encountered
+  virtual boost::any visit (Udata &n);
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc
new file mode 100644
index 0000000..5c41779
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.cc
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "string-visitor.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/blob.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+StringVisitor::visit (Blob &n) 
+{
+  // Buffer n.m_blob;
+  return std::string (n.m_blob, n.m_blobSize);
+}
+
+boost::any
+StringVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  return n.m_udata;
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/string-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.h
new file mode 100644
index 0000000..b6a74fd
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/string-visitor.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_STRING_VISITOR_H_
+#define _CCNB_PARSER_STRING_VISITOR_H_
+
+#include "no-argu-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain string value from UDATA block
+ *
+ * Will return empty boost::any() if called on anything except UDATA block
+ */
+class StringVisitor : public NoArguDepthFirstVisitor
+{
+public:
+  virtual boost::any visit (Blob &n);
+  virtual boost::any visit (Udata &n);
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_STRING_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc
new file mode 100644
index 0000000..efea82a
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.cc
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "timestamp-visitor.h"
+#include "../syntax-tree/blob.h"
+
+#include "ns3/nstime.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any/*Time*/
+TimestampVisitor::visit (Blob &n) 
+{
+  // Buffer n.m_blob;
+  if (n.m_blobSize < 2)
+    throw CcnbDecodingException ();
+
+  const char *start = n.m_blob;
+  
+  intmax_t seconds = 0;
+  intmax_t nanoseconds = 0;
+
+  for (uint32_t i=0; i < n.m_blobSize-2; i++)
+    {
+      seconds = (seconds << 8) | (uint8_t)start[i];
+    }
+  uint8_t combo = start[n.m_blobSize-2]; // 4 most significant bits hold 4 least significant bits of number of seconds
+  seconds = (seconds << 4) | (combo >> 4);
+
+  nanoseconds = combo & 0x0F; /*00001111*/ // 4 least significant bits hold 4 most significant bits of number of
+  nanoseconds = (nanoseconds << 8) | start[n.m_blobSize-1];
+  nanoseconds = (intmax_t) ((nanoseconds / 4096.0/*2^12*/) * 1000000 /*up-convert useconds*/);
+
+  return boost::any (Time::FromInteger (seconds, Time::S) + Time::FromInteger (nanoseconds, Time::US));
+}
+
+boost::any
+TimestampVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  throw CcnbDecodingException ();
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h
new file mode 100644
index 0000000..a5ad224
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/timestamp-visitor.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_TIMESTAMP_VISITOR_H_
+#define _CCNB_PARSER_TIMESTAMP_VISITOR_H_
+
+#include "no-argu-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain timestamp value from BLOB block
+ *
+ * Will return empty boost::any() if called on anything except BLOB block
+ */
+class TimestampVisitor : public NoArguDepthFirstVisitor
+{
+public:
+  virtual boost::any visit (Blob &n); 
+  virtual boost::any/*Time*/ visit (Udata &n); ///< Throws parsing error if UDATA object is encountered
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_TIMESTAMP_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc
new file mode 100644
index 0000000..f5620ae
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.cc
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "uint32t-blob-visitor.h"
+#include "../syntax-tree/blob.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+boost::any
+Uint32tBlobVisitor::visit (Blob &n) 
+{
+  // Buffer n.m_blob;
+  if (n.m_blobSize < 4)
+    throw CcnbDecodingException ();
+     
+  return boost::any (*(reinterpret_cast<uint32_t*> (n.m_blob)));
+}
+
+boost::any
+Uint32tBlobVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+  throw CcnbDecodingException ();
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h
new file mode 100644
index 0000000..5d30405
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/uint32t-blob-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
+#define _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
+
+#include "no-argu-depth-first-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor to obtain nonce value from BLOB block
+ *
+ * Note, only first 32 bits will be actually parsed into nonce. If
+ * original Nonce contains more, the rest will be ignored
+ *
+ * Will return empty boost::any() if called on anything except BLOB block
+ */
+class Uint32tBlobVisitor : public NoArguDepthFirstVisitor
+{
+public:
+  virtual boost::any visit (Blob &n); 
+  virtual boost::any visit (Udata &n); ///< Throws parsing error if BLOB object is encountered
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/visitor.h b/model/wire/ccnb/ccnb-parser/visitors/visitor.h
new file mode 100644
index 0000000..ee9f831
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/visitor.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_VISITOR_H_
+#define _CCNB_PARSER_VISITOR_H_
+
+#include "../common.h"
+#include <boost/any.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Visitor interface that takes one boost::any argument and returns boost::any
+ *
+ * \see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ * for ccnb encoding format help
+ */
+class Visitor
+{
+public:
+  virtual boost::any visit (Blob&,  boost::any)=0; ///< \brief Method accepting BLOB block  
+  virtual boost::any visit (Udata&, boost::any)=0; ///< \brief Method accepting UDATA block 
+  virtual boost::any visit (Tag&,   boost::any)=0; ///< \brief Method accepting TAG block   
+  virtual boost::any visit (Attr&,  boost::any)=0; ///< \brief Method accepting ATTR block  
+  virtual boost::any visit (Dtag&,  boost::any)=0; ///< \brief Method accepting DTAG block  
+  virtual boost::any visit (Dattr&, boost::any)=0; ///< \brief Method accepting DATTR block 
+  virtual boost::any visit (Ext&,   boost::any)=0; ///< \brief Method accepting EXT block
+
+  virtual ~Visitor () { }
+};                                                
+                                                  
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+                                                  
+#endif // _CCNB_PARSER_VISITOR_H_                             
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc
new file mode 100644
index 0000000..8a8adde
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.cc
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "void-depth-first-visitor.h"
+
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
+
+#include <boost/foreach.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+void
+VoidDepthFirstVisitor::visit (Blob &n, boost::any param)
+{
+  // Buffer n.m_blob;
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Udata &n, boost::any param)
+{
+  // std::string n.m_udata;
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Tag &n, boost::any param)
+{
+  // std::string n.m_tag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this, param);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this, param);
+    }
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Dtag &n, boost::any param)
+{
+  // std::string n.m_tag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this, param);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this, param);
+    }
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Attr &n, boost::any param)
+{
+  // std::string n.m_attr;
+  // Ptr<Udata> n.m_value;
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Dattr &n, boost::any param)
+{
+  // uint32_t n.m_dattr;
+  // Ptr<Udata> n.m_value;
+}
+ 
+void
+VoidDepthFirstVisitor::visit (Ext &n, boost::any param)
+{
+  // uint64_t n.m_extSubtype;
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h
new file mode 100644
index 0000000..96f8b6f
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-depth-first-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
+#define _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
+
+#include "void-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Depth-first visitor that takes one argument and returns nothing
+ */
+class VoidDepthFirstVisitor : public VoidVisitor
+{
+public:
+  virtual void visit (Blob&,  boost::any);
+  virtual void visit (Udata&, boost::any);
+  virtual void visit (Tag&,   boost::any);
+  virtual void visit (Attr&,  boost::any);
+  virtual void visit (Dtag&,  boost::any);
+  virtual void visit (Dattr&, boost::any);
+  virtual void visit (Ext&,   boost::any);
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
new file mode 100644
index 0000000..5bcecb8
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "void-no-argu-depth-first-visitor.h"
+
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
+
+#include <boost/foreach.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+void
+VoidNoArguDepthFirstVisitor::visit (Blob &n)
+{
+  // Buffer n.m_blob;
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Udata &n)
+{
+  // std::string n.m_udata;
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Tag &n)
+{
+  // std::string n.m_tag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this);
+    }
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Dtag &n)
+{
+  // uint32_t n.m_dtag;
+  // std::list<Ptr<Block> > n.m_attrs;
+  // std::list<Ptr<Block> > n.m_nestedBlocks;
+  BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
+    {
+      block->accept (*this);
+    }
+  BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+    {
+      block->accept (*this);
+    }
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Attr &n)
+{
+  // std::string n.m_attr;
+  // Ptr<Udata> n.m_value;
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Dattr &n)
+{
+  // uint32_t n.m_dattr;
+  // Ptr<Udata> n.m_value;
+}
+ 
+void
+VoidNoArguDepthFirstVisitor::visit (Ext &n)
+{
+  // uint64_t n.m_extSubtype;
+}
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
new file mode 100644
index 0000000..59b59d7
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
+#define _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
+
+#include "void-no-argu-visitor.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ccnx-ccnb
+ * \brief Depth-first visitor that takes no arguments and returns nothing
+ */
+class VoidNoArguDepthFirstVisitor : public VoidNoArguVisitor
+{
+public:
+  virtual void visit (Blob& );
+  virtual void visit (Udata&);
+  virtual void visit (Tag&  );
+  virtual void visit (Attr& );
+  virtual void visit (Dtag& );
+  virtual void visit (Dattr&);
+  virtual void visit (Ext&  );
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h
new file mode 100644
index 0000000..a98d933
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-no-argu-visitor.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
+#define _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
+
+#include "../common.h"
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ndn-ccnb
+ * \brief Visitor interface that takes no arguments and returns nothing
+ *
+ * \see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ * for ccnb encoding format help
+ */
+class VoidNoArguVisitor
+{
+public:
+  virtual void visit (Blob& )=0; ///< \brief Method accepting BLOB block
+  virtual void visit (Udata&)=0; ///< \brief Method accepting UDATA block
+  virtual void visit (Tag&  )=0; ///< \brief Method accepting TAG block
+  virtual void visit (Attr& )=0; ///< \brief Method accepting ATTR block
+  virtual void visit (Dtag& )=0; ///< \brief Method accepting DTAG block
+  virtual void visit (Dattr&)=0; ///< \brief Method accepting DATTR block
+  virtual void visit (Ext&  )=0; ///< \brief Method accepting EXT block
+
+  virtual ~VoidNoArguVisitor () { }
+};
+  
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
diff --git a/model/wire/ccnb/ccnb-parser/visitors/void-visitor.h b/model/wire/ccnb/ccnb-parser/visitors/void-visitor.h
new file mode 100644
index 0000000..8c51e21
--- /dev/null
+++ b/model/wire/ccnb/ccnb-parser/visitors/void-visitor.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef _CCNB_PARSER_VOID_VISITOR_H_
+#define _CCNB_PARSER_VOID_VISITOR_H_
+
+#include "../common.h"
+#include <boost/any.hpp>
+
+NDN_NAMESPACE_BEGIN
+
+namespace wire {
+namespace CcnbParser {
+
+/**
+ * \ingroup ndn-ccnb
+ * \brief Visitor interface that takes one boost::any argument and returns nothing
+ *
+ * \see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html
+ * for ccnb encoding format help
+ */
+class VoidVisitor
+{
+public:
+  virtual void visit (Blob&,  boost::any)=0; ///< \brief Method accepting BLOB block  
+  virtual void visit (Udata&, boost::any)=0; ///< \brief Method accepting UDATA block 
+  virtual void visit (Tag&,   boost::any)=0; ///< \brief Method accepting TAG block   
+  virtual void visit (Attr&,  boost::any)=0; ///< \brief Method accepting ATTR block  
+  virtual void visit (Dtag&,  boost::any)=0; ///< \brief Method accepting DTAG block  
+  virtual void visit (Dattr&, boost::any)=0; ///< \brief Method accepting DATTR block 
+  virtual void visit (Ext&,   boost::any)=0; ///< \brief Method accepting EXT block
+
+  virtual ~VoidVisitor () { }
+};
+
+} // CcnbParser
+} // wire
+
+NDN_NAMESPACE_END
+
+#endif // _CCNB_PARSER_VOID_VISITOR_H_