complete sync-app-data-fetch and sync-app-data-publish
diff --git a/model/sync-app-data-fetch.cc b/model/sync-app-data-fetch.cc
index 2680859..af696e2 100644
--- a/model/sync-app-data-fetch.cc
+++ b/model/sync-app-data-fetch.cc
@@ -19,3 +19,23 @@
  *         卞超轶 Chaoyi Bian <bcy@pku.edu.cn>
  *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
+
+#include "sync-app-data-fetch.h"
+
+using namespace std;
+using namespace boost;
+
+namespace Sync
+{
+
+void AppDataFetch::fetch(string prefix, uint32_t startSeq, uint32_t endSeq)
+{
+  for (uint32_t i = startSeq; i <= endSeq; i++)
+  {
+    string interestName = prefix;
+    interestName += i;
+    m_ccnxHandle->sendInterest(interestName, m_dataCallback);
+  }
+}
+
+}
\ No newline at end of file
diff --git a/model/sync-app-data-fetch.h b/model/sync-app-data-fetch.h
index c52d55b..70b54cb 100644
--- a/model/sync-app-data-fetch.h
+++ b/model/sync-app-data-fetch.h
@@ -39,11 +39,12 @@
 	/**
 	 * @param dataCallback the callback function to process data
 	 */
-	AppDataFetch(boost::function<void (boost::shared_ptr<DataBuffer>)>
-	dataCallback);
+	AppDataFetch(boost::shared_ptr<CcnxWrapper> ccnxHandle,
+		     boost::function<void (std::string)> dataCallback)
+	{ m_ccnxHandle = ccnxHandle; m_dataCallback = dataCallback; }
 
-	void setDataCallback(boost::function<void (boost::shared_ptr<DataBuffer>)>
-	dataCallback) {m_dataCallback = dataCallback;}
+	void setDataCallback(boost::function<void (std::string)> dataCallback)
+	{ m_dataCallback = dataCallback; }
 
 	/**
 	 * @brief fetch data for a certain name prefix
@@ -52,12 +53,11 @@
 	 * @param startSeq the start of sequence number range (inclusive)
 	 * @param endSeq the end of sequence number range (inclusive)
 	 */
-	void fetch(string prefix, long startSeq, long endSeq);
+	void fetch(std::string prefix, uint32_t startSeq, uint32_t endSeq);
 
 private:
-	boost::shared_ptr<CcnxWrapper> ccnxHandle;
-	boost::shared_ptr<boost::function<void (boost::shared_ptr<DataBuffer>)>
-	m_dataCallback;
+	boost::shared_ptr<CcnxWrapper> m_ccnxHandle;
+	boost::function<void (std::string)> m_dataCallback;
 };
 
 
diff --git a/model/sync-app-data-publish.cc b/model/sync-app-data-publish.cc
index 2680859..a3347b8 100644
--- a/model/sync-app-data-publish.cc
+++ b/model/sync-app-data-publish.cc
@@ -19,3 +19,49 @@
  *         卞超轶 Chaoyi Bian <bcy@pku.edu.cn>
  *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
+
+#include "sync-app-data-publish.h"
+
+using namespace std;
+using namespace boost;
+
+namespace Sync
+{
+
+pair<string, string> AppDataPublish::getRecentData(string prefix)
+{
+
+}
+
+uint32_t AppDataPublish::getHighestSeq(string prefix)
+{
+  unordered_map<string, uint32_t>::iterator i = m_sequenceLog.find(prefix);
+
+  if (i != m_sequenceLog.end())
+  {
+    return i->second;
+  }
+  else
+  {
+    m_sequenceLog[prefix] = 0;
+    return 0;
+  }
+
+}
+
+bool AppDataPublish::publishData(string name, string dataBuffer, int freshness)
+{
+  uint32_t seq = getHighestSeq(name) + 1;
+  string contentName = name;
+
+  contentName += seq;
+
+  m_sequenceLog[contentName] = seq;
+  m_recentData[contentName] = dataBuffer;
+
+  m_ccnxHandle->publishData(contentName, dataBuffer, freshness);
+
+  return true;
+}
+
+}
\ No newline at end of file
diff --git a/model/sync-app-data-publish.h b/model/sync-app-data-publish.h
index 2031532..f02a188 100644
--- a/model/sync-app-data-publish.h
+++ b/model/sync-app-data-publish.h
@@ -23,6 +23,7 @@
 #ifndef SYNC_APP_DATA_PUBLISH_H
 #define SYNC_APP_DATA_PUBLISH_H
 #include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
 #include "sync-ccnx-wrapper.h"
 
 /**
@@ -35,29 +36,29 @@
 /**
  * \ingroup sync
  * @brief publishes application data using incrementing sequence number (for
- * each sequence namber and keeps track of most recently published data for 
+ * each sequence namber and keeps track of most recently published data for
  * each name prefix
  */
 class AppDataPublish
 {
 public:
-	AppDataPublish();
+	AppDataPublish(boost::shared_ptr<CcnxWrapper> ccnxHandle)
+	{ m_ccnxHandle = ccnxHandle; }
 	~AppDataPublish() {};
 
 	/**
 	 * @brief get the name (including sequence number) and the content
 	 * (unencoded, just XML stanza) of the most recent published data
 	 *
-	 * @param prefix the name prefix to look for 
+	 * @param prefix the name prefix to look for
 	 * @return the pair of name and content
 	 */
-	std::pair<std::string, boost::shared_ptr<const DataBuffer> >
-	getRecentData(std::string prefix);
+	std::pair<std::string, std::string> getRecentData(std::string prefix);
 
 	/**
 	 * brief get the most recent sequence number for a name prefix
 	 */
-	 long getHighestSeq(std:string prefix);
+	 u_int32_t getHighestSeq(std::string prefix);
 
 	/**
 	 * @brief publish data for a name prefix, updates the corresponding
@@ -68,13 +69,12 @@
 	 * @param freshness the freshness for the data object
 	 * @return whether the publish succeeded
 	 */
-	bool publishData(std::string name, boost::shared_ptr<DataBufer> dataBuffer,
-	int freshness);
-  
+	bool publishData(std::string name, std::string dataBuffer, int freshness);
+
 private:
-	boost::unordered_map<string, long> m_sequenceLog;
+	boost::unordered_map<std::string, uint32_t> m_sequenceLog;
 	boost::shared_ptr<CcnxWrapper> m_ccnxHandle;
-	std::pair<std::string, boost::shared_ptr<DataBuffer> > m_recentData;
+	boost::unordered_map<std::string, std::string> m_recentData;
 };
 
 } // Sync