Adding nsync for NLSR
diff --git a/nsync/src/sync-name-info.h b/nsync/src/sync-name-info.h
new file mode 100644
index 0000000..2f7c165
--- /dev/null
+++ b/nsync/src/sync-name-info.h
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 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: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Chaoyi Bian <bcy@pku.edu.cn>
+ *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef SYNC_NAME_INFO_H
+#define SYNC_NAME_INFO_H
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+#include <map>
+#include <string>
+#include "sync-digest.h"
+
+namespace Sync {
+
+/**
+ * @ingroup sync
+ * @brief Templated class for the leaf name
+ */
+class NameInfo
+{
+private:
+  typedef boost::weak_ptr<const NameInfo> const_weak_ptr;
+  
+public:
+  virtual ~NameInfo () { };
+
+  /**
+   * @brief Get ID of the record (should be locally-unique, but not really necessary---this is be used for hashing purposes)
+   */
+  size_t
+  getHashId () const { return m_id; }
+
+  /**
+   * @brief Check if two names are equal
+   * @param info name to check with
+   */
+  virtual bool
+  operator == (const NameInfo &info) const = 0;
+
+  /**
+   * @brief Check if two names are in order
+   * @param info name to check with
+   */
+  virtual bool
+  operator < (const NameInfo &info) const = 0;
+
+  /**
+   * @brief Calculates digest of the name
+   */
+  const Digest &
+  getDigest () const { return m_digest; }
+
+  /**
+   * @brief Convert prefix to string
+   * @returns string representation of prefix
+   */
+  virtual std::string
+  toString () const = 0;
+  
+protected:
+  // actual stuff
+  size_t m_id; ///< @brief Identifies NameInfo throughout the library (for hash container, doesn't need to be strictly unique)
+  Digest m_digest;
+
+  // static stuff
+  typedef std::map<std::string, const_weak_ptr> NameMap;
+  static size_t  m_ids;
+  static NameMap m_names;
+};
+
+typedef boost::shared_ptr<NameInfo> NameInfoPtr;
+typedef boost::shared_ptr<const NameInfo> NameInfoConstPtr;
+
+inline std::ostream &
+operator << (std::ostream &os, const NameInfo &info)
+{
+  os << info.toString ();
+  return os;
+}
+
+} // Sync
+
+#endif // SYNC_NAME_INFO_H