model+ndn.cxx+apps: New application template (CallbackBasedApp) that can be used to prototype NS-3 applications in python
The current code allows simulating in python using ApiFace (passed basic tests)
Refs #1005 (http://redmine.named-data.net/)
diff --git a/ndn.cxx/ndn-api-face.cc b/ndn.cxx/ndn-api-face.cc
index 6adfe99..578f424 100644
--- a/ndn.cxx/ndn-api-face.cc
+++ b/ndn.cxx/ndn-api-face.cc
@@ -186,8 +186,9 @@
{
return false;
}
-
- entry->payload ()->m_callback (entry->payload ()->GetPrefix (), interest);
+
+ if (!entry->payload ()->m_callback.IsNull ())
+ entry->payload ()->m_callback (entry->payload ()->GetPrefix (), interest);
return true;
}
@@ -197,7 +198,6 @@
// data has been send out from NDN stack towards the application
NS_LOG_DEBUG ("<< D " << data->GetName ());
-
NS_LOG_FUNCTION (this << data);
if (!IsUp ())
@@ -213,7 +213,8 @@
while (entry != m_this->m_pendingInterests.end ())
{
- entry->payload ()->m_dataCallback (entry->payload ()->GetInterest (), data);
+ if (!entry->payload ()->m_dataCallback.IsNull ())
+ entry->payload ()->m_dataCallback (entry->payload ()->GetInterest (), data);
m_this->m_pendingInterests.erase (entry);
entry = m_this->m_pendingInterests.longest_prefix_match (data->GetName ());