Finishing reorganization and making sure code compiles
diff --git a/doc/doxygen.conf b/doc/doxygen.conf
index 26021b1..851bd58 100644
--- a/doc/doxygen.conf
+++ b/doc/doxygen.conf
@@ -568,7 +568,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = doc model helper
+INPUT                  = doc src
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
diff --git a/examples/sync-example.cc b/examples/sync-example.cc
deleted file mode 100644
index 38edf4f..0000000
--- a/examples/sync-example.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-
-#include <ns3/core-module.h>
-#include <ns3/network-module.h>
-#include <ns3/NDNabstraction-module.h>
-#include <ns3/point-to-point-module.h>
-
-#include "sync-logic.h"
-#include "sync-logic-helper.h"
-
-using namespace ns3;
-using namespace Sync;
-
-NS_LOG_COMPONENT_DEFINE ("SyncExample");
-
-void OnUpdate (const std::string &prefix, const SeqNo &newSeq, const SeqNo &/*oldSeq*/)
-{
-  NS_LOG_LOGIC (Simulator::Now ().ToDouble (Time::S) <<"s\tNode: " << Simulator::GetContext () << ", prefix: " << prefix << ", seqNo: " << newSeq);
-}
-
-void OnRemove (const std::string &prefix)
-{
-  NS_LOG_LOGIC (Simulator::Now ().ToDouble (Time::S) <<"s\tNode: " << Simulator::GetContext () << ", prefix: "<< prefix);
-}
-
-int 
-main (int argc, char *argv[])
-{
-  Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
-  Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
-  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
-  
-  Config::SetDefault ("ns3::CcnxFloodingStrategy::SmartFlooding", StringValue ("false"));
-
-  LogComponentEnable ("SyncExample", LOG_ALL);
-  
-  Time finishTime = Seconds (3.0); 
-
-  CommandLine cmd;
-  cmd.AddValue ("finish", "Finish time", finishTime);
-  cmd.Parse (argc, argv);
-
-  // Creating nodes
-  NodeContainer nodes;
-  nodes.Create (11);
-
-  // Connecting nodes using two links
-  PointToPointHelper p2p;
-  p2p.Install (nodes.Get (0), nodes.Get (4));
-  p2p.Install (nodes.Get (1), nodes.Get (2));
-  p2p.Install (nodes.Get (1), nodes.Get (4));
-  p2p.Install (nodes.Get (1), nodes.Get (5));
-  p2p.Install (nodes.Get (2), nodes.Get (6));
-  p2p.Install (nodes.Get (2), nodes.Get (7));
-  p2p.Install (nodes.Get (3), nodes.Get (4));
-  p2p.Install (nodes.Get (3), nodes.Get (8));
-  p2p.Install (nodes.Get (4), nodes.Get (5));
-  p2p.Install (nodes.Get (4), nodes.Get (8));
-  p2p.Install (nodes.Get (5), nodes.Get (6));
-  p2p.Install (nodes.Get (5), nodes.Get (9));
-  p2p.Install (nodes.Get (5), nodes.Get (10));
-  p2p.Install (nodes.Get (6), nodes.Get (10));
-  p2p.Install (nodes.Get (7), nodes.Get (10));
-  p2p.Install (nodes.Get (8), nodes.Get (9));
-  p2p.Install (nodes.Get (9), nodes.Get (10));
-
-  Names::Add ("0", nodes.Get (0));
-  Names::Add ("1", nodes.Get (1));
-  Names::Add ("2", nodes.Get (2));
-  Names::Add ("3", nodes.Get(3));
-  Names::Add ("4", nodes.Get(4));
-  Names::Add ("5", nodes.Get(5));
-  Names::Add ("6", nodes.Get(6));
-  Names::Add ("7", nodes.Get(7));
-  Names::Add ("8", nodes.Get(8));
-  Names::Add ("9", nodes.Get(9));
-  Names::Add ("10", nodes.Get(10));
-  
-  // Install CCNx stack on all nodes
-  NS_LOG_INFO ("Installing CCNx stack");
-  CcnxStackHelper ccnxHelper;
-  ccnxHelper.SetForwardingStrategy ("ns3::CcnxFloodingStrategy");
-  ccnxHelper.SetDefaultRoutes (false);
-  ccnxHelper.InstallAll ();
-
-  ccnxHelper.AddRoute ("0", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("1", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("1", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("1", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("2", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("2", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("2", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("3", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("3", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("4", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("4", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("4", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("4", "/sync", 3, 0);
-  ccnxHelper.AddRoute ("4", "/sync", 4, 0);
-  ccnxHelper.AddRoute ("5", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("5", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("5", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("5", "/sync", 3, 0);
-  ccnxHelper.AddRoute ("5", "/sync", 4, 0);
-  ccnxHelper.AddRoute ("6", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("6", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("6", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("7", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("7", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("8", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("8", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("8", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("9", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("9", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("9", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("10", "/sync", 0, 0);
-  ccnxHelper.AddRoute ("10", "/sync", 1, 0);
-  ccnxHelper.AddRoute ("10", "/sync", 2, 0);
-  ccnxHelper.AddRoute ("10", "/sync", 3, 0);
-
-  SyncLogicHelper logicHelper;
-  logicHelper.SetPrefix ("/sync");
-  logicHelper.SetCallbacks (OnUpdate, OnRemove);
-  ApplicationContainer apps = logicHelper.Install (NodeContainer (nodes.Get (0), nodes.Get (1)));
-  
-  // one data
-  Simulator::ScheduleWithContext (0, Seconds (0.5), &SyncLogic::addLocalNames, DynamicCast<SyncLogic> (apps.Get (0)), "/0", 1, 1);
-
-  // two producers at the same time
-  Simulator::ScheduleWithContext (0, Seconds (1.001), &SyncLogic::addLocalNames, DynamicCast<SyncLogic> (apps.Get (0)), "/0", 1, 2);
-  Simulator::ScheduleWithContext (1, Seconds (1.001), &SyncLogic::addLocalNames, DynamicCast<SyncLogic> (apps.Get (1)), "/1", 1, 2);
-
-  logicHelper.Install (nodes.Get (2)).
-    Start (Seconds (2.001));
-  
-  Simulator::Stop (finishTime);
-  Simulator::Run ();
-  Simulator::Destroy ();
-  return 0;
-}
-
-
diff --git a/examples/wscript b/examples/wscript
deleted file mode 100644
index 3b46e2d..0000000
--- a/examples/wscript
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('sync-example', ['sync'])
-    obj.source = 'sync-example.cc'
-
diff --git a/libsync.pc.in b/libChronoSync.pc.in
similarity index 70%
rename from libsync.pc.in
rename to libChronoSync.pc.in
index b8bc57c..2e301fa 100644
--- a/libsync.pc.in
+++ b/libChronoSync.pc.in
@@ -2,8 +2,8 @@
 libdir=@LIBDIR@
 includedir=@INCLUDEDIR@
 
-Name: libsync 
-Description: Chronos library
+Name: libChronoSync
+Description: ChronoSync library
 Version: @VERSION@
 Libs: -L${libdir} -lsync
 Cflags: -I${includedir}
diff --git a/src/ccnx/sync-app-socket.cc b/src/ccnx/sync-app-socket.cc
index 3bc6954..0e4e829 100644
--- a/src/ccnx/sync-app-socket.cc
+++ b/src/ccnx/sync-app-socket.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/* -*- Mode: C32++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
  * Copyright (c) 2012 University of California, Los Angeles
  *
@@ -29,8 +29,8 @@
 {
 
 SyncAppSocket::SyncAppSocket (const string &syncPrefix, NewDataCallback dataCallback, RemoveCallback rmCallback )
-  : m_ccnxHandle (new CcnxWrapper())
-  , m_newDataCallback(dataCallback)
+  : m_newDataCallback(dataCallback)
+  , m_ccnxHandle (new CcnxWrapper())
   , m_syncLogic (syncPrefix,
                  bind(&SyncAppSocket::passCallback, this, _1),
                  rmCallback)
@@ -61,6 +61,7 @@
   m_sequenceLog[prefix] = s;
 
   m_syncLogic.addLocalNames (prefix, session, sequence);
+  return true;
 }
 
 bool 
@@ -75,6 +76,7 @@
   SeqNo s(session, sequence + 1);
   m_sequenceLog[prefix] = s;
   m_syncLogic.addLocalNames (prefix, session, sequence);
+  return true;
 }
 
 
diff --git a/src/ccnx/sync-ccnx-wrapper.cc b/src/ccnx/sync-ccnx-wrapper.cc
index b742548..c824e72 100644
--- a/src/ccnx/sync-ccnx-wrapper.cc
+++ b/src/ccnx/sync-ccnx-wrapper.cc
@@ -26,7 +26,7 @@
 #include <ccn/fetch.h>
 }
 
-#include "sync-log.h"
+#include "sync-logging.h"
 #include <poll.h>
 #include <boost/throw_exception.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
@@ -245,7 +245,7 @@
 /// @endcond
 int
 CcnxWrapper::publishStringData (const string &name, const string &dataBuffer, int freshness) {
-  publishRawData(name, dataBuffer.c_str(), dataBuffer.length(), freshness);
+  return publishRawData(name, dataBuffer.c_str(), dataBuffer.length(), freshness);
 }
 
 int
@@ -384,13 +384,13 @@
 int CcnxWrapper::sendInterestForString (const string &strInterest, const StringDataCallback &strDataCallback, int retry)
 {
   DataClosurePass * pass = new DataClosurePass(STRING_FORM, retry, strDataCallback);
-  sendInterest(strInterest, pass);
+  return sendInterest(strInterest, pass);
 }
 
 int CcnxWrapper::sendInterest (const string &strInterest, const RawDataCallback &rawDataCallback, int retry)
 {
   RawDataClosurePass * pass = new RawDataClosurePass(RAW_DATA, retry, rawDataCallback);
-  sendInterest(strInterest, pass);
+  return sendInterest(strInterest, pass);
 }
 
 int CcnxWrapper::sendInterest (const string &strInterest, void *dataPass)
@@ -439,6 +439,8 @@
 
   m_registeredInterests.insert(pair<std::string, InterestCallback>(prefix, interestCallback));
   ccn_charbuf_destroy(&pname);
+
+  return 0;
 }
 
 void
diff --git a/src/sync-interest-table.cc b/src/sync-interest-table.cc
index b91dee3..6fbf784 100644
--- a/src/sync-interest-table.cc
+++ b/src/sync-interest-table.cc
@@ -21,7 +21,7 @@
  */
 
 #include "sync-interest-table.h"
-#include "sync-log.h"
+#include "sync-logging.h"
 using namespace std;
 using namespace boost;
 
diff --git a/src/sync-logging.cc b/src/sync-logging.cc
index e80bfc8..9048964 100644
--- a/src/sync-logging.cc
+++ b/src/sync-logging.cc
@@ -20,7 +20,7 @@
  *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
 
-#include "sync-log.h"
+#include "sync-logging.h"
 
 #ifdef HAVE_LOG4CXX
 
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 25b51ce..98160b5 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -28,7 +28,7 @@
 #include "sync-logic.h"
 #include "sync-diff-leaf.h"
 #include "sync-full-leaf.h"
-#include "sync-log.h"
+#include "sync-logging.h"
 #include "sync-state.h"
 
 #include <boost/make_shared.hpp>
@@ -64,10 +64,9 @@
   , m_syncInterestTable (TIME_SECONDS (m_syncInterestReexpress))
   , m_syncPrefix (syncPrefix)
   , m_onUpdate (onUpdate)
-  , m_perBranch (false)
   , m_onRemove (onRemove)
+  , m_perBranch (false)
   , m_ccnxHandle(new CcnxWrapper ())
-  , m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
 #ifndef NS3_MODULE
   , m_randomGenerator (static_cast<unsigned int> (std::time (0)))
   , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (200,1000))
@@ -76,6 +75,7 @@
   , m_rangeUniformRandom (200,1000)
   , m_reexpressionJitter (10,500)
 #endif
+  , m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
 { 
 #ifndef NS3_MODULE
   // In NS3 module these functions are moved to StartApplication method
@@ -97,7 +97,6 @@
   , m_onUpdateBranch (onUpdateBranch)
   , m_perBranch(true)
   , m_ccnxHandle(new CcnxWrapper())
-  , m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
 #ifndef NS3_MODULE
   , m_randomGenerator (static_cast<unsigned int> (std::time (0)))
   , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (200,1000))
@@ -106,6 +105,7 @@
   , m_rangeUniformRandom (200,1000)
   , m_reexpressionJitter (10,500)
 #endif
+  , m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
 { 
 #ifndef NS3_MODULE
   // In NS3 module these functions are moved to StartApplication method
diff --git a/src/sync-logic.h b/src/sync-logic.h
index a4f2b41..1bc5984 100644
--- a/src/sync-logic.h
+++ b/src/sync-logic.h
@@ -29,7 +29,7 @@
 #include <memory>
 #include <map>
 
-#include "sync-ccnx-wrapper.h"
+#include "ccnx/sync-ccnx-wrapper.h"
 #include "sync-interest-table.h"
 #include "sync-diff-state.h"
 #include "sync-full-state.h"
diff --git a/src/sync-scheduler.cc b/src/sync-scheduler.cc
index 65739d5..fc0ca23 100644
--- a/src/sync-scheduler.cc
+++ b/src/sync-scheduler.cc
@@ -21,7 +21,7 @@
  */
 
 #include "sync-scheduler.h"
-#include "sync-log.h"
+#include "sync-logging.h"
 
 using namespace boost;
 using namespace std;
diff --git a/wscript b/wscript
index ea47f7f..5afeee3 100644
--- a/wscript
+++ b/wscript
@@ -54,9 +54,9 @@
     libsync = bld (
         target=APPNAME,
         features=['cxx', 'cxxshlib'],
-        source =  ant_glob (['src/**/*.cc', 'src/**/*.proto']),
+        source =  bld.path.ant_glob (['src/**/*.cc', 'src/**/*.proto']),
         use = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL NDNX',
-        includes = ['include', 'src'],
+        includes = ['src'],
         )
     
     # Unit tests
@@ -66,7 +66,7 @@
           source = bld.path.ant_glob(['tests/**/*.cc']),
           features=['cxx', 'cxxprogram'],
           use = 'BOOST_TEST sync',
-          includes = ['include', 'src'],
+          includes = ['src'],
           )
 
     if bld.get_define ("HAVE_LOG4CXX"):
@@ -74,17 +74,27 @@
         if bld.get_define("_TEST"):
             unittests.use += ' LOG4CXX'
 
-    headers = bld.path.ant_glob(['include/*.h'])
-    headers.extend (bld.path.get_bld().ant_glob(['model/sync-state.pb.h']))
-    bld.install_files ("%s/sync" % bld.env['INCLUDEDIR'], headers)
+    bld.install_files (
+        dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'], 
+        files = bld.path.ant_glob(['src/**/*.h']), 
+        cwd = bld.path.find_dir ("src"),
+        relative_trick = True,
+        )
+
+    bld.install_files (
+        dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'], 
+        files = bld.path.get_bld().ant_glob(['src/**/*.h']), 
+        cwd = bld.path.get_bld().find_dir ("src"),
+        relative_trick = True,
+        )
 
     pc = bld (
         features = "subst",
-        source='libsync.pc.in',
-        target='libsync.pc',
+        source='libChronoSync.pc.in',
+        target='libChronoSync.pc',
         install_path = '${LIBDIR}/pkgconfig',
         PREFIX       = bld.env['PREFIX'],
-        INCLUDEDIR   = "%s/sync" % bld.env['INCLUDEDIR'],
+        INCLUDEDIR   = "%s/ChronoSync" % bld.env['INCLUDEDIR'],
         VERSION      = VERSION,
         )