Now code compiles and seem to have all the features... Though most likely not yet working
diff --git a/model/sync-interest-table.cc b/model/sync-interest-table.cc
index 7b9ed35..a9ed265 100644
--- a/model/sync-interest-table.cc
+++ b/model/sync-interest-table.cc
@@ -32,7 +32,7 @@
SyncInterestTable::SyncInterestTable ()
{
- m_scheduler.schedule (posix_time::seconds (4),
+ m_scheduler.schedule (TIME_SECONDS (4),
bind (&SyncInterestTable::expireInterests, this),
0);
}
@@ -113,7 +113,7 @@
_LOG_DEBUG ("expireInterests (): expired " << count);
- m_scheduler.schedule (posix_time::seconds (4),
+ m_scheduler.schedule (TIME_SECONDS (4),
bind (&SyncInterestTable::expireInterests, this),
0);
}
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 773f368..17a0935 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -65,7 +65,7 @@
m_ccnxHandle->setInterestFilter (m_syncPrefix,
bind (&SyncLogic::respondSyncInterest, this, _1));
- m_scheduler.schedule (posix_time::seconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -117,7 +117,7 @@
m_syncResponseFreshness);
if (m_outstandingInterest == interestName)
{
- m_scheduler.schedule (posix_time::seconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -163,7 +163,7 @@
m_syncResponseFreshness);
if (m_outstandingInterest == interestName)
{
- m_scheduler.schedule (posix_time::seconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -172,7 +172,7 @@
if (!timedProcessing)
{
- m_scheduler.schedule (posix_time::milliseconds (m_rangeUniformRandom ()) /*from 20 to 100ms*/,
+ m_scheduler.schedule (TIME_MILLISECONDS (m_rangeUniformRandom ()) /*from 20 to 100ms*/,
bind (&SyncLogic::processSyncInterest, this, digest, interestName, true),
DELAYED_INTEREST_PROCESSING);
@@ -188,7 +188,7 @@
if (m_outstandingInterest == interestName)
{
- m_scheduler.schedule (posix_time::seconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -280,7 +280,7 @@
// if state has changed, then it is safe to express a new interest
if (diffLog->getLeaves ().size () > 0)
{
- m_scheduler.schedule (posix_time::seconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -290,7 +290,7 @@
// Otherwise we will get immediate reply from the local daemon and there will be 100% utilization
m_scheduler.cancel (REEXPRESSING_INTEREST);
// m_scheduler.schedule (posix_time::seconds (0),
- m_scheduler.schedule (posix_time::seconds (m_syncResponseFreshness) + posix_time::milliseconds (1),
+ m_scheduler.schedule (TIME_SECONDS (m_syncResponseFreshness) + TIME_MILLISECONDS (1),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -322,7 +322,7 @@
{
_LOG_DEBUG ("Have satisfied our own interest. Scheduling interest reexpression");
// we need to reexpress interest only if we satisfied our own interest
- m_scheduler.schedule (posix_time::milliseconds (0),
+ m_scheduler.schedule (TIME_SECONDS (0),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
@@ -405,9 +405,25 @@
bind (&SyncLogic::processSyncData, this, _1, _2));
m_scheduler.cancel (REEXPRESSING_INTEREST);
- m_scheduler.schedule (posix_time::seconds (4),
+ m_scheduler.schedule (TIME_SECONDS (4),
bind (&SyncLogic::sendSyncInterest, this),
REEXPRESSING_INTEREST);
}
+#ifdef NS3_MODULE
+void
+SyncLogic::StartApplication ()
+{
+ m_ccnxHandle->SetNode (GetNode ());
+ m_ccnxHandle->StartApplication ();
+}
+
+void
+SyncLogic::StopApplication ()
+{
+ m_ccnxHandle->StopApplication ();
+}
+#endif
+
+
}
diff --git a/model/sync-logic.h b/model/sync-logic.h
index ad0a208..64d551b 100644
--- a/model/sync-logic.h
+++ b/model/sync-logic.h
@@ -43,6 +43,10 @@
#endif
#endif
+#ifdef NS3_MODULE
+#include <ns3/application.h>
+#endif
+
namespace Sync {
/**
@@ -51,6 +55,9 @@
* interests and data)
*/
class SyncLogic
+#ifdef NS3_MODULE
+ : public ns3::Application
+#endif
{
public:
typedef boost::function< void ( const std::string &/*prefix*/, const SeqNo &/*newSeq*/, const SeqNo &/*oldSeq*/ ) > LogicUpdateCallback;
@@ -98,6 +105,12 @@
Scheduler &
getScheduler () { return m_scheduler; }
#endif
+
+protected:
+#ifdef NS3_MODULE
+ virtual void StartApplication ();
+ virtual void StopApplication ();
+#endif
private:
void