NFD+model+apps+helper+tests: Upgrade NFD and related changes
Based on NFD:commit:2fc649bfc67b93b4191cfbee5bcd70330bfb48f0 (version 0.3.4)
Change-Id: I89f5182600467171797af4f8f83e1edffe14ad95
Refs: #3125
diff --git a/model/ndn-app-face.cpp b/model/ndn-app-face.cpp
index 1488dff..61c3c21 100644
--- a/model/ndn-app-face.cpp
+++ b/model/ndn-app-face.cpp
@@ -58,7 +58,7 @@
{
NS_LOG_FUNCTION(this << &interest);
- this->onSendInterest(interest);
+ this->emitSignal(onSendInterest, interest);
// to decouple callbacks
Simulator::ScheduleNow(&App::OnInterest, m_app, interest.shared_from_this());
@@ -69,11 +69,23 @@
{
NS_LOG_FUNCTION(this << &data);
- this->onSendData(data);
+ this->emitSignal(onSendData, data);
// to decouple callbacks
Simulator::ScheduleNow(&App::OnData, m_app, data.shared_from_this());
}
+void
+AppFace::onReceiveInterest(const Interest& interest)
+{
+ this->emitSignal(onReceiveInterest, interest);
+}
+
+void
+AppFace::onReceiveData(const Data& data)
+{
+ this->emitSignal(onReceiveData, data);
+}
+
} // namespace ndn
} // namespace ns3
diff --git a/model/ndn-app-face.hpp b/model/ndn-app-face.hpp
index 5ae6593..ab3de90 100644
--- a/model/ndn-app-face.hpp
+++ b/model/ndn-app-face.hpp
@@ -55,20 +55,28 @@
public: // from nfd::Face
/**
* @brief Send Interest towards application
- *
- * @note To send Interest from application, use `AppFace::onReceiveInterest(interest)`
*/
virtual void
sendInterest(const Interest& interest);
/**
* @brief Send Data towards application
- *
- * @note To send Data from application, use `AppFace::onReceiveData(data)`
*/
virtual void
sendData(const Data& data);
+ /**
+ * @brief Send Interest towards NFD
+ */
+ void
+ onReceiveInterest(const Interest& interest);
+
+ /**
+ * @brief Send Data towards NFD
+ */
+ void
+ onReceiveData(const Data& data);
+
virtual void
close();
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index d45e84a..ad9c0d7 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -111,9 +111,9 @@
" strategy_choice\n"
" {\n"
" / /localhost/nfd/strategy/best-route\n"
- " /localhost /localhost/nfd/strategy/broadcast\n"
+ " /localhost /localhost/nfd/strategy/multicast\n"
" /localhost/nfd /localhost/nfd/strategy/best-route\n"
- " /ndn/broadcast /localhost/nfd/strategy/broadcast\n"
+ " /ndn/multicast /localhost/nfd/strategy/multicast\n"
" }\n"
"}\n"
"\n"
@@ -325,15 +325,15 @@
m_impl->m_forwarder->addFace(face);
// Connect Signals to TraceSource
- face->onReceiveInterest +=
- [this, face](const Interest& interest) { this->m_inInterests(interest, *face); };
+ face->onReceiveInterest.connect
+ ([this, face](const Interest& interest) { this->m_inInterests(interest, *face); });
- face->onSendInterest +=
- [this, face](const Interest& interest) { this->m_outInterests(interest, *face); };
+ face->onSendInterest.connect
+ ([this, face](const Interest& interest) { this->m_outInterests(interest, *face); });
- face->onReceiveData += [this, face](const Data& data) { this->m_inData(data, *face); };
+ face->onReceiveData.connect([this, face](const Data& data) { this->m_inData(data, *face); });
- face->onSendData += [this, face](const Data& data) { this->m_outData(data, *face); };
+ face->onSendData.connect([this, face](const Data& data) { this->m_outData(data, *face); });
return face->getId();
}
diff --git a/model/ndn-net-device-face.cpp b/model/ndn-net-device-face.cpp
index 2a6a5aa..e13f949 100644
--- a/model/ndn-net-device-face.cpp
+++ b/model/ndn-net-device-face.cpp
@@ -94,7 +94,7 @@
{
NS_LOG_FUNCTION(this << &interest);
- this->onSendInterest(interest);
+ this->emitSignal(onSendInterest, interest);
Ptr<Packet> packet = Convert::ToPacket(interest);
send(packet);
@@ -105,7 +105,7 @@
{
NS_LOG_FUNCTION(this << &data);
- this->onSendData(data);
+ this->emitSignal(onSendData, data);
Ptr<Packet> packet = Convert::ToPacket(data);
send(packet);
@@ -124,11 +124,11 @@
uint32_t type = Convert::getPacketType(p);
if (type == ::ndn::tlv::Interest) {
shared_ptr<const Interest> i = Convert::FromPacket<Interest>(packet);
- this->onReceiveInterest(*i);
+ this->emitSignal(onReceiveInterest, *i);
}
else if (type == ::ndn::tlv::Data) {
shared_ptr<const Data> d = Convert::FromPacket<Data>(packet);
- this->onReceiveData(*d);
+ this->emitSignal(onReceiveData, *d);
}
else {
NS_LOG_ERROR("Unsupported TLV packet");