add 3 classes
diff --git a/model/sync-app-data-publish.cc b/model/sync-app-data-publish.cc
new file mode 100644
index 0000000..2680859
--- /dev/null
+++ b/model/sync-app-data-publish.cc
@@ -0,0 +1,21 @@
+/* -*- 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>
+ */
diff --git a/model/sync-app-data-publish.h b/model/sync-app-data-publish.h
new file mode 100644
index 0000000..5d122dc
--- /dev/null
+++ b/model/sync-app-data-publish.h
@@ -0,0 +1,53 @@
+/* -*- 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_STATE_H
+#define SYNC_STATE_H
+#include <boost/shared_ptr.hpp>
+#include "sync-ccnx-wrapper.h"
+
+/**
+ * \defgroup sync SYNC protocol
+ *
+ * Implementation of SYNC protocol
+ */
+namespace Sync {
+
+/**
+ * \ingroup sync
+ * @brief publishes application data and keeps track of most recently published
+ * data
+ */
+class AppDataPublish
+{
+public:
+	std::pair<std::string, boost::shared_ptr<const DataBuffer> > getRecentData();
+	bool publishData(std::string name, const DataBufer &dataBuffer);
+  
+private:
+	boost::shared_ptr<CcnxWrapper> ccnxHandle;
+	std::pair<std::string, boost::shared_ptr<DataBuffer> > recentData;
+};
+
+} // Sync
+
+#endif // SYNC_STATE_H
diff --git a/model/sync-ccnx-wrapper.h b/model/sync-ccnx-wrapper.h
index fb552a2..91f819e 100644
--- a/model/sync-ccnx-wrapper.h
+++ b/model/sync-ccnx-wrapper.h
@@ -34,28 +34,13 @@
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 #include <string>
+#include "sync-data-buffer.h"
 /**
  * \defgroup sync SYNC protocol
  *
  * Implementation of SYNC protocol
  */
 namespace Sync {
-/**
- * \ingroup sync
- * @brief Data wrapper with size
- */
- class DataBuffer {
-private:
-	unsigned char *m_buffer;
-	size_t m_len;
-public:
-	DataBuffer(const unsigned char *buffer, size_t len);
-	DataBuffer(const DataBuffer &dataBuffer);
-	DataBuffer &operator=(const DataBuffer &dataBuffer);
-	~DataBuffer();	
-	size_t length() {return len;}
-	const unsigned char *buffer() { return const_cast<const unsigned char *> (buffer); }
-};
 
 /**
  * \ingroup sync
diff --git a/model/sync-data-buffer.cc b/model/sync-data-buffer.cc
new file mode 100644
index 0000000..2680859
--- /dev/null
+++ b/model/sync-data-buffer.cc
@@ -0,0 +1,21 @@
+/* -*- 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>
+ */
diff --git a/model/sync-data-buffer.h b/model/sync-data-buffer.h
new file mode 100644
index 0000000..da12b5c
--- /dev/null
+++ b/model/sync-data-buffer.h
@@ -0,0 +1,73 @@
+/* -*- 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_STATE_H
+#define SYNC_STATE_H
+
+#include <tinyxml.h>
+#include <boost/shared_ptr.hpp>
+#include "sync-diff-state.h"
+#include "sync-full-state.h"
+
+
+/**
+ * \defgroup sync SYNC protocol
+ *
+ * Implementation of SYNC protocol
+ */
+namespace Sync {
+
+/**
+ * \ingroup sync
+ * @brief handles conversion from xml encoded data ("wire_format") to states
+ * data (FullState or DiffState)
+ */
+/**
+ * \ingroup sync
+ * @brief Data wrapper with size; convert from/to FullState and DiffState
+ */
+class DataBuffer {
+private:
+	unsigned char *m_buffer;
+	size_t m_len;
+public:
+	DataBuffer() {m_buffer = NULL; m_len = 0;}
+	DataBuffer(const unsigned char *buffer, size_t len);
+	DataBuffer(const DataBuffer &dataBuffer);
+	DataBuffer &operator=(const DataBuffer &dataBuffer);
+	~DataBuffer();	
+	size_t length() {return len;}
+	const unsigned char *buffer() { return const_cast<const unsigned char *> (buffer); }
+
+	DataBuffer &operator<<(FullState &fs);
+	DataBuffer &operator<<(DiffState &ds);
+
+	FullState &operator>>(FullState &fs);
+	DiffState &operator>>(DiffState &ds);
+};
+
+
+
+
+} // Sync
+
+#endif // SYNC_STATE_H