Moving some logic of dealing with sequence numbers to SyncAppDataFetch

Adding recursive mutexes to SyncLogic, so hopefully it is now thread-safe

Small modification of publishing/retrieval names. Now session ID is
appended by SyncAppDataFetch / SyncAppDataPublish
diff --git a/model/sync-diff-leaf.h b/model/sync-diff-leaf.h
index 1e3143a..c4aab82 100644
--- a/model/sync-diff-leaf.h
+++ b/model/sync-diff-leaf.h
@@ -74,6 +74,7 @@
 };
 
 typedef boost::shared_ptr<DiffLeaf> DiffLeafPtr;
+typedef boost::shared_ptr<const DiffLeaf> DiffLeafConstPtr;
 
 std::ostream &
 operator << (std::ostream &os, Operation op);