diff --git a/nsync/src/sync-diff-state.cc b/nsync/src/sync-diff-state.cc
new file mode 100644
index 0000000..3030940
--- /dev/null
+++ b/nsync/src/sync-diff-state.cc
@@ -0,0 +1,101 @@
+/* -*- 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>
+ */
+
+#include "sync-diff-state.h"
+#include "sync-diff-leaf.h"
+
+#include <boost/make_shared.hpp>
+#include <boost/foreach.hpp>
+#include <boost/assert.hpp>
+
+using namespace boost;
+
+namespace Sync {
+
+DiffState::DiffState ()
+{
+}
+
+DiffState::~DiffState ()
+{
+}
+
+DiffStatePtr
+DiffState::diff () const
+{
+  DiffStatePtr ret = make_shared<DiffState> ();
+  
+  DiffStatePtr state = m_next;
+  while (state != 0)
+    {
+      *ret += *state;
+      state = state->m_next;
+    }
+
+  return ret;
+}
+
+DiffState &
+DiffState::operator += (const DiffState &state)
+{
+  BOOST_FOREACH (LeafConstPtr _leaf, state.getLeaves ())
+    {
+      DiffLeafConstPtr leaf = dynamic_pointer_cast<const DiffLeaf> (_leaf);
+      BOOST_ASSERT (leaf != 0);
+
+      if (leaf->getOperation () == UPDATE)
+        update (leaf->getInfo (), leaf->getSeq ());
+      else if (leaf->getOperation () == REMOVE)
+        remove (leaf->getInfo ());
+      else
+        {
+          BOOST_ASSERT (false);
+        }
+    }
+  
+  return *this;
+}
+  
+// from State
+boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+DiffState::update (NameInfoConstPtr info, const SeqNo &seq)
+{
+  m_leaves.erase (info);
+
+  DiffLeafPtr leaf = make_shared<DiffLeaf> (info, cref (seq));
+  m_leaves.insert (leaf);
+
+  return make_tuple (true, false, SeqNo ());
+}
+
+bool
+DiffState::remove (NameInfoConstPtr info)
+{
+  m_leaves.erase (info);
+
+  DiffLeafPtr leaf = make_shared<DiffLeaf> (info);
+  m_leaves.insert (leaf);
+
+  return true;
+}
+
+} // ns3
