Various fixes for NFD/ndn-cxx 0.7.0
Change-Id: I68e5d4d57d81c3f2e46fc59680cd416b06c8190c
diff --git a/.gitmodules b/.gitmodules
index e250871..8b3ca32 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,8 @@
[submodule "NFD"]
path = NFD
url = https://github.com/named-data-ndnSIM/NFD
- branch = NFD-0.6.5-ndnSIM
+branch = NFD-0.7.0-ndnSIM
[submodule "ndn-cxx"]
path = ndn-cxx
url = https://github.com/named-data-ndnSIM/ndn-cxx
- branch = ndn-cxx-0.6.5-ndnSIM
+ branch = ndn-cxx-0.7.0-ndnSIM
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index 791a3bc..6814816 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -202,6 +202,7 @@
def register_L3Protocol(cls):
cls.add_method('getL3Protocol', 'ns3::Ptr<ns3::ndn::L3Protocol>', [param('ns3::Ptr<ns3::Object>', 'node')], is_static=True)
cls.add_method('getForwarder', 'std::shared_ptr<ns3::ndn::nfd::Forwarder>', [])
+ cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
register_L3Protocol(root_module['ns3::ndn::L3Protocol'])
# shared_ptr<Face>
@@ -220,7 +221,6 @@
cls.add_method('getFib', retval('const ns3::ndn::nfd::Fib&', caller_manages_return=False), [], is_const=True)
cls.add_method('getPit', retval('const ns3::ndn::nfd::Pit&', caller_manages_return=False), [], is_const=True)
cls.add_method('getCs', retval('const ns3::ndn::nfd::Cs&', caller_manages_return=False), [], is_const=True)
- cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
reg_NfdForwarder(root_module['ns3::ndn::nfd::Forwarder'])
#############
@@ -252,7 +252,7 @@
reg_Entry(root_module['ns3::ndn::nfd::fib::Entry'])
def reg_NextHop(cls):
- cls.add_constructor([param('const ns3::ndn::Face&', 'face'), param('uint64_t', 'endpointId')])
+ cls.add_constructor([param('const ns3::ndn::Face&', 'face')])
cls.add_function_as_method('getFaceFromFibNextHop', 'std::shared_ptr<ns3::ndn::Face>',
[param('const ns3::ndn::nfd::fib::NextHop&', 'obj')],
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index 791a3bc..6814816 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -202,6 +202,7 @@
def register_L3Protocol(cls):
cls.add_method('getL3Protocol', 'ns3::Ptr<ns3::ndn::L3Protocol>', [param('ns3::Ptr<ns3::Object>', 'node')], is_static=True)
cls.add_method('getForwarder', 'std::shared_ptr<ns3::ndn::nfd::Forwarder>', [])
+ cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
register_L3Protocol(root_module['ns3::ndn::L3Protocol'])
# shared_ptr<Face>
@@ -220,7 +221,6 @@
cls.add_method('getFib', retval('const ns3::ndn::nfd::Fib&', caller_manages_return=False), [], is_const=True)
cls.add_method('getPit', retval('const ns3::ndn::nfd::Pit&', caller_manages_return=False), [], is_const=True)
cls.add_method('getCs', retval('const ns3::ndn::nfd::Cs&', caller_manages_return=False), [], is_const=True)
- cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
reg_NfdForwarder(root_module['ns3::ndn::nfd::Forwarder'])
#############
@@ -252,7 +252,7 @@
reg_Entry(root_module['ns3::ndn::nfd::fib::Entry'])
def reg_NextHop(cls):
- cls.add_constructor([param('const ns3::ndn::Face&', 'face'), param('uint64_t', 'endpointId')])
+ cls.add_constructor([param('const ns3::ndn::Face&', 'face')])
cls.add_function_as_method('getFaceFromFibNextHop', 'std::shared_ptr<ns3::ndn::Face>',
[param('const ns3::ndn::nfd::fib::NextHop&', 'obj')],
diff --git a/examples/ndn-cxx-simple/real-app.hpp b/examples/ndn-cxx-simple/real-app.hpp
index b7b2a87..8c9208b 100644
--- a/examples/ndn-cxx-simple/real-app.hpp
+++ b/examples/ndn-cxx-simple/real-app.hpp
@@ -42,7 +42,7 @@
std::bind([]{}), std::bind([]{}));
// use scheduler to send interest later on consumer face
- m_scheduler.scheduleEvent(ndn::time::seconds(2), [this] {
+ m_scheduler.schedule(ndn::time::seconds(2), [this] {
m_faceConsumer.expressInterest(ndn::Interest("/hello/world"),
std::bind([] { std::cout << "Hello!" << std::endl; }),
std::bind([] { std::cout << "NACK!" << std::endl; }),
diff --git a/helper/ndn-global-routing-helper.cpp b/helper/ndn-global-routing-helper.cpp
index 282f784..ebc4617 100644
--- a/helper/ndn-global-routing-helper.cpp
+++ b/helper/ndn-global-routing-helper.cpp
@@ -80,7 +80,7 @@
gr = CreateObject<GlobalRouter>();
node->AggregateObject(gr);
- for (auto& face : ndn->getForwarder()->getFaceTable()) {
+ for (auto& face : ndn->getFaceTable()) {
auto transport = dynamic_cast<NetDeviceTransport*>(face.getTransport());
if (transport == nullptr) {
NS_LOG_DEBUG("Skipping non ndnSIM-specific transport face");
@@ -316,7 +316,7 @@
// remember interface statuses
std::list<nfd::FaceId> faceIds;
std::unordered_map<nfd::FaceId, uint16_t> originalMetrics;
- for (auto& nfdFace : l3->getForwarder()->getFaceTable()) {
+ for (auto& nfdFace : l3->getFaceTable()) {
faceIds.push_back(nfdFace.getId());
originalMetrics[nfdFace.getId()] = nfdFace.getMetric();
nfdFace.setMetric(std::numeric_limits<uint16_t>::max() - 1);
@@ -324,7 +324,7 @@
}
for (auto& faceId : faceIds) {
- auto* face = l3->getForwarder()->getFaceTable().get(faceId);
+ auto* face = l3->getFaceTable().get(faceId);
NS_ASSERT(face != nullptr);
auto transport = dynamic_cast<NetDeviceTransport*>(face->getTransport());
if (transport == nullptr) {
@@ -381,7 +381,7 @@
// recover original interface statuses
for (auto& i : originalMetrics) {
- l3->getForwarder()->getFaceTable().get(i.first)->setMetric(i.second);
+ l3->getFaceTable().get(i.first)->setMetric(i.second);
}
}
}
diff --git a/helper/ndn-link-control-helper.cpp b/helper/ndn-link-control-helper.cpp
index 2b46946..b0894d5 100644
--- a/helper/ndn-link-control-helper.cpp
+++ b/helper/ndn-link-control-helper.cpp
@@ -56,7 +56,7 @@
NS_ASSERT(ndn1 != nullptr && ndn2 != nullptr);
// iterate over all faces to find the right one
- for (const auto& face : ndn1->getForwarder()->getFaceTable()) {
+ for (const auto& face : ndn1->getFaceTable()) {
auto transport = dynamic_cast<NetDeviceTransport*>(face.getTransport());
if (transport == nullptr)
continue;
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index cf60551..af9c055 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -391,7 +391,7 @@
if (ndn == nullptr)
continue;
- for (auto& face : ndn->getForwarder()->getFaceTable()) {
+ for (auto& face : ndn->getFaceTable()) {
auto transport = dynamic_cast<NetDeviceTransport*>(face.getTransport());
if (transport == nullptr)
continue;
diff --git a/model/ndn-app-link-service.cpp b/model/ndn-app-link-service.cpp
index 2dbce52..e5b1ee7 100644
--- a/model/ndn-app-link-service.cpp
+++ b/model/ndn-app-link-service.cpp
@@ -47,7 +47,7 @@
}
void
-AppLinkService::doSendInterest(const Interest& interest)
+AppLinkService::doSendInterest(const Interest& interest, const nfd::EndpointId& endpoint)
{
NS_LOG_FUNCTION(this << &interest);
@@ -56,7 +56,7 @@
}
void
-AppLinkService::doSendData(const Data& data)
+AppLinkService::doSendData(const Data& data, const nfd::EndpointId& endpoint)
{
NS_LOG_FUNCTION(this << &data);
@@ -65,7 +65,7 @@
}
void
-AppLinkService::doSendNack(const lp::Nack& nack)
+AppLinkService::doSendNack(const lp::Nack& nack, const nfd::EndpointId& endpoint)
{
NS_LOG_FUNCTION(this << &nack);
@@ -78,19 +78,19 @@
void
AppLinkService::onReceiveInterest(const Interest& interest)
{
- this->receiveInterest(interest);
+ this->receiveInterest(interest, 0);
}
void
AppLinkService::onReceiveData(const Data& data)
{
- this->receiveData(data);
+ this->receiveData(data, 0);
}
void
AppLinkService::onReceiveNack(const lp::Nack& nack)
{
- this->receiveNack(nack);
+ this->receiveNack(nack, 0);
}
} // namespace ndn
diff --git a/model/ndn-app-link-service.hpp b/model/ndn-app-link-service.hpp
index 798ac1a..21c50d1 100644
--- a/model/ndn-app-link-service.hpp
+++ b/model/ndn-app-link-service.hpp
@@ -60,16 +60,16 @@
private:
virtual void
- doSendInterest(const Interest& interest) override;
+ doSendInterest(const Interest& interest, const nfd::EndpointId& endpoint) override;
virtual void
- doSendData(const Data& data) override;
+ doSendData(const Data& data, const nfd::EndpointId& endpoint) override;
virtual void
- doSendNack(const lp::Nack& nack) override;
+ doSendNack(const lp::Nack& nack, const nfd::EndpointId& endpoint) override;
virtual void
- doReceivePacket(nfd::face::Transport::Packet&& packet) override
+ doReceivePacket(const Block& packet, const nfd::EndpointId& endpoint) override
{
// does nothing (all operations for now handled by LinkService)
BOOST_ASSERT(false);
diff --git a/model/ndn-block-header.cpp b/model/ndn-block-header.cpp
index fbab70f..6665fa4 100644
--- a/model/ndn-block-header.cpp
+++ b/model/ndn-block-header.cpp
@@ -56,8 +56,8 @@
{
}
-BlockHeader::BlockHeader(const nfdFace::Transport::Packet& packet)
- : m_block(packet.packet)
+BlockHeader::BlockHeader(const Block& packet)
+ : m_block(packet)
{
}
diff --git a/model/ndn-block-header.hpp b/model/ndn-block-header.hpp
index f2c73ab..4c9f491 100644
--- a/model/ndn-block-header.hpp
+++ b/model/ndn-block-header.hpp
@@ -39,7 +39,7 @@
BlockHeader();
- BlockHeader(const nfdFace::Transport::Packet& packet);
+ BlockHeader(const Block& packet);
virtual uint32_t
GetSerializedSize(void) const;
diff --git a/model/ndn-common.hpp b/model/ndn-common.hpp
index a678f5d..b0cfe7a 100644
--- a/model/ndn-common.hpp
+++ b/model/ndn-common.hpp
@@ -56,8 +56,6 @@
using namespace ::ndn::lp;
}
-using ::ndn::Exclude;
-
using std::shared_ptr;
using std::make_shared;
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index f7ad619..8271587 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -171,6 +171,7 @@
// note that shared_ptr needed for Python bindings
std::shared_ptr<::nfd::Forwarder> m_forwarder;
+ std::unique_ptr<::nfd::FaceTable> m_faceTable;
std::unique_ptr<::nfd::face::FaceSystem> m_faceSystem;
std::shared_ptr<::nfd::face::Face> m_internalFace;
@@ -209,12 +210,9 @@
void
L3Protocol::initialize()
{
- m_impl->m_forwarder = make_shared<::nfd::Forwarder>();
-
- ::nfd::FaceTable& faceTable = m_impl->m_forwarder->getFaceTable();
- faceTable.addReserved(::nfd::face::makeNullFace(), ::nfd::face::FACEID_NULL);
- // faceTable.addReserved(face::makeNullFace(FaceUri("contentstore://")), face::FACEID_CONTENT_STORE);
- m_impl->m_faceSystem = make_unique<::nfd::face::FaceSystem>(faceTable, nullptr);
+ m_impl->m_faceTable = make_unique<::nfd::FaceTable>();
+ m_impl->m_forwarder = make_shared<::nfd::Forwarder>(*m_impl->m_faceTable);
+ m_impl->m_faceSystem = make_unique<::nfd::face::FaceSystem>(*m_impl->m_faceTable, nullptr);
initializeManagement();
initializeRibManager();
@@ -263,10 +261,10 @@
using namespace nfd;
std::tie(m_impl->m_internalFace, m_impl->m_internalClientFace) = face::makeInternalFace(StackHelper::getKeyChain());
- forwarder->getFaceTable().addReserved(m_impl->m_internalFace, face::FACEID_INTERNAL_FACE);
+ m_impl->m_faceTable->addReserved(m_impl->m_internalFace, face::FACEID_INTERNAL_FACE);
std::tie(m_impl->m_internalFaceForInjects, m_impl->m_internalClientFaceForInjects) = face::makeInternalFace(StackHelper::getKeyChain());
- forwarder->getFaceTable().addReserved(m_impl->m_internalFaceForInjects, face::FACEID_INTERNAL_FACE + 1);
+ m_impl->m_faceTable->addReserved(m_impl->m_internalFaceForInjects, face::FACEID_INTERNAL_FACE + 1);
m_impl->m_dispatcher = make_unique<::ndn::mgmt::Dispatcher>(*m_impl->m_internalClientFace, StackHelper::getKeyChain());
m_impl->m_authenticator = ::nfd::CommandAuthenticator::create();
@@ -275,7 +273,7 @@
m_impl->m_forwarderStatusManager = make_unique<::nfd::ForwarderStatusManager>(*m_impl->m_forwarder, *m_impl->m_dispatcher);
}
m_impl->m_faceManager = make_unique<::nfd::FaceManager>(*m_impl->m_faceSystem, *m_impl->m_dispatcher, *m_impl->m_authenticator);
- m_impl->m_fibManager = make_shared<::nfd::FibManager>(m_impl->m_forwarder->getFib(), m_impl->m_forwarder->getFaceTable(),
+ m_impl->m_fibManager = make_shared<::nfd::FibManager>(m_impl->m_forwarder->getFib(), *m_impl->m_faceTable,
*m_impl->m_dispatcher, *m_impl->m_authenticator);
m_impl->m_csManager = make_unique<::nfd::CsManager>(m_impl->m_forwarder->getCs(), m_impl->m_forwarder->getCounters(),
*m_impl->m_dispatcher, *m_impl->m_authenticator);
@@ -308,7 +306,8 @@
// add FIB entry for NFD Management Protocol
Name topPrefix("/localhost/nfd");
- m_impl->m_forwarder->getFib().insert(topPrefix).first->addOrUpdateNextHop(*m_impl->m_internalFace, 0, 0);
+ auto entry = m_impl->m_forwarder->getFib().insert(topPrefix).first;
+ m_impl->m_forwarder->getFib().addOrUpdateNextHop(*entry, *m_impl->m_internalFace, 0);
m_impl->m_dispatcher->addTopPrefix(topPrefix, false);
}
@@ -318,7 +317,7 @@
using namespace nfd;
std::tie(m_impl->m_internalRibFace, m_impl->m_internalRibClientFace) = face::makeInternalFace(StackHelper::getKeyChain());
- m_impl->m_forwarder->getFaceTable().add(m_impl->m_internalRibFace);
+ m_impl->m_faceTable->add(m_impl->m_internalRibFace);
m_impl->m_ribService = make_unique<rib::Service>(m_impl->m_config,
std::ref(*m_impl->m_internalRibClientFace),
@@ -331,6 +330,12 @@
return m_impl->m_forwarder;
}
+nfd::FaceTable&
+L3Protocol::getFaceTable()
+{
+ return *m_impl->m_faceTable;
+}
+
shared_ptr<nfd::FibManager>
L3Protocol::getFibManager()
{
@@ -392,26 +397,26 @@
{
NS_LOG_FUNCTION(this << face.get());
- m_impl->m_forwarder->addFace(face);
+ m_impl->m_faceTable->add(face);
std::weak_ptr<Face> weakFace = face;
// // Connect Signals to TraceSource
- face->afterReceiveInterest.connect([this, weakFace](const Interest& interest) {
+ face->afterReceiveInterest.connect([this, weakFace](const Interest& interest, const nfd::EndpointId&) {
shared_ptr<Face> face = weakFace.lock();
if (face != nullptr) {
this->m_inInterests(interest, *face);
}
});
- face->afterReceiveData.connect([this, weakFace](const Data& data) {
+ face->afterReceiveData.connect([this, weakFace](const Data& data, const nfd::EndpointId&) {
shared_ptr<Face> face = weakFace.lock();
if (face != nullptr) {
this->m_inData(data, *face);
}
});
- face->afterReceiveNack.connect([this, weakFace](const lp::Nack& nack) {
+ face->afterReceiveNack.connect([this, weakFace](const lp::Nack& nack, const nfd::EndpointId&) {
shared_ptr<Face> face = weakFace.lock();
if (face != nullptr) {
this->m_inNack(nack, *face);
@@ -447,13 +452,13 @@
shared_ptr<Face>
L3Protocol::getFaceById(nfd::FaceId id) const
{
- return m_impl->m_forwarder->getFaceTable().get(id)->shared_from_this();
+ return m_impl->m_faceTable->get(id)->shared_from_this();
}
shared_ptr<Face>
L3Protocol::getFaceByNetDevice(Ptr<NetDevice> netDevice) const
{
- for (auto& i : m_impl->m_forwarder->getFaceTable()) {
+ for (auto& i : *m_impl->m_faceTable) {
auto transport = dynamic_cast<NetDeviceTransport*>(i.getTransport());
if (transport == nullptr)
continue;
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index e5169af..3b8c775 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -35,6 +35,7 @@
namespace nfd {
class Forwarder;
class FibManager;
+class FaceTable;
class StrategyChoiceManager;
typedef boost::property_tree::ptree ConfigSection;
namespace pit {
@@ -104,6 +105,9 @@
shared_ptr<nfd::Forwarder>
getForwarder();
+ nfd::FaceTable&
+ getFaceTable();
+
/**
* \brief Get smart pointer to nfd::FibManager, used by node's NFD
*/
diff --git a/model/ndn-net-device-transport.cpp b/model/ndn-net-device-transport.cpp
index a8565fb..e0439f0 100644
--- a/model/ndn-net-device-transport.cpp
+++ b/model/ndn-net-device-transport.cpp
@@ -106,7 +106,7 @@
}
void
-NetDeviceTransport::doSend(Packet&& packet)
+NetDeviceTransport::doSend(const Block& packet, const nfd::EndpointId& endpoint)
{
NS_LOG_FUNCTION(this << "Sending packet from netDevice with URI"
<< this->getLocalUri());
@@ -125,10 +125,10 @@
// callback
void
NetDeviceTransport::receiveFromNetDevice(Ptr<NetDevice> device,
- Ptr<const ns3::Packet> p,
- uint16_t protocol,
- const Address& from, const Address& to,
- NetDevice::PacketType packetType)
+ Ptr<const ns3::Packet> p,
+ uint16_t protocol,
+ const Address& from, const Address& to,
+ NetDevice::PacketType packetType)
{
NS_LOG_FUNCTION(device << p << protocol << from << to << packetType);
@@ -138,9 +138,7 @@
BlockHeader header;
packet->RemoveHeader(header);
- auto nfdPacket = Packet(std::move(header.getBlock()));
-
- this->receive(std::move(nfdPacket));
+ this->receive(std::move(header.getBlock()));
}
Ptr<NetDevice>
diff --git a/model/ndn-net-device-transport.hpp b/model/ndn-net-device-transport.hpp
index e68382d..22b07de 100644
--- a/model/ndn-net-device-transport.hpp
+++ b/model/ndn-net-device-transport.hpp
@@ -62,7 +62,7 @@
doClose() override;
virtual void
- doSend(Packet&& packet) override;
+ doSend(const Block& packet, const nfd::EndpointId& endpoint) override;
void
receiveFromNetDevice(Ptr<NetDevice> device,
diff --git a/model/null-transport.hpp b/model/null-transport.hpp
index 42ef9c6..3c27e1f 100644
--- a/model/null-transport.hpp
+++ b/model/null-transport.hpp
@@ -47,19 +47,14 @@
}
private:
- virtual void
- beforeChangePersistency(::ndn::nfd::FacePersistency newPersistency)
- {
- }
-
- virtual void
- doClose()
+ void
+ doClose() final
{
this->setState(nfd::face::TransportState::CLOSED);
}
- virtual void
- doSend(Packet&& packet)
+ void
+ doSend(const Block& packet, const nfd::EndpointId& endpoint) final
{
}
};
diff --git a/tests/unit-tests/helper/ndn-fib-helper.t.cpp b/tests/unit-tests/helper/ndn-fib-helper.t.cpp
index 60a5967..7426fda 100644
--- a/tests/unit-tests/helper/ndn-fib-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-fib-helper.t.cpp
@@ -38,7 +38,7 @@
addApps({
{"1", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1"}},
- "0s", "9.99s"},
+ "0s", "10.5s"},
{"2", "ns3::ndn::Producer",
{{"Prefix", "/prefix"}, {"PayloadSize", "1024"}},
"0s", "100s"}
@@ -47,7 +47,7 @@
~AddRouteFixture()
{
- Simulator::Stop(Seconds(20.001));
+ Simulator::Stop(Seconds(20.101));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nOutInterests, 10);
diff --git a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
index 3d79ffa..0df5280 100644
--- a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
@@ -55,17 +55,17 @@
Simulator::Schedule(Seconds(10.1), ndn::LinkControlHelper::UpLink, getNode("1"), getNode("2"));
nfd::getScheduler().schedule(time::milliseconds(5200), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 6);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 6);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 5);
});
nfd::getScheduler().schedule(time::milliseconds(10200), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 6);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 6);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 5);
});
nfd::getScheduler().schedule(time::milliseconds(15100), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 11);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 11);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 10);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 10);
});
Simulator::Stop(Seconds(15.2));
diff --git a/tests/unit-tests/model/ndn-block-header.t.cpp b/tests/unit-tests/model/ndn-block-header.t.cpp
index 474f7e5..9360998 100644
--- a/tests/unit-tests/model/ndn-block-header.t.cpp
+++ b/tests/unit-tests/model/ndn-block-header.t.cpp
@@ -56,17 +56,17 @@
interest.setNonce(10);
interest.setCanBePrefix(true);
lp::Packet lpPacket(interest.wireEncode());
- nfd::face::Transport::Packet packet(lpPacket.wireEncode());
+ auto packet(lpPacket.wireEncode());
BlockHeader header(packet);
- BOOST_CHECK_EQUAL(header.GetSerializedSize(), 18); // 18
+ BOOST_CHECK_EQUAL(header.GetSerializedSize(), 20); // 20
{
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
packet->Print(output);
- BOOST_CHECK(output.is_equal("ns3::ndn::Packet (Interest: /prefix?ndn.Nonce=10)"));
+ BOOST_CHECK(output.is_equal("ns3::ndn::Packet (Interest: /prefix?CanBePrefix&Nonce=10)"));
}
}
@@ -77,7 +77,7 @@
data.setContent(std::make_shared< ::ndn::Buffer>(1024));
ndn::StackHelper::getKeyChain().sign(data);
lp::Packet lpPacket(data.wireEncode());
- nfd::face::Transport::Packet packet(lpPacket.wireEncode());
+ auto packet(lpPacket.wireEncode());
BlockHeader header(packet);
BOOST_CHECK_EQUAL(header.GetSerializedSize(), 1350);
@@ -102,23 +102,23 @@
lpPacket.add<::ndn::lp::FragmentField>(std::make_pair(interest.wireEncode().begin(), interest.wireEncode().end()));
{
- BlockHeader header(nfd::face::Transport::Packet(lpPacket.wireEncode()));
+ BlockHeader header(lpPacket.wireEncode());
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
packet->Print(output);
- BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(Interest: /prefix?ndn.Nonce=10))"));
+ BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(Interest: /prefix?CanBePrefix&Nonce=10))"));
}
lpPacket.add<::ndn::lp::NackField>(::ndn::lp::NackHeader().setReason(::ndn::lp::NackReason::NO_ROUTE));
{
- BlockHeader header(nfd::face::Transport::Packet(lpPacket.wireEncode()));
+ BlockHeader header(lpPacket.wireEncode());
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
packet->Print(output);
- BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(NACK(NoRoute) for Interest: /prefix?ndn.Nonce=10))"));
+ BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(NACK(NoRoute) for Interest: /prefix?CanBePrefix&Nonce=10))"));
}
lpPacket.remove<::ndn::lp::NackField>();
@@ -126,18 +126,18 @@
lpPacket.add<::ndn::lp::FragCountField>(1);
{
- BlockHeader header(nfd::face::Transport::Packet(lpPacket.wireEncode()));
+ BlockHeader header(lpPacket.wireEncode());
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
packet->Print(output);
- BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(Interest: /prefix?ndn.Nonce=10))"));
+ BOOST_CHECK(output.is_equal("ns3::ndn::Packet (NDNLP(Interest: /prefix?CanBePrefix&Nonce=10))"));
}
lpPacket.set<::ndn::lp::FragCountField>(2);
{
- BlockHeader header(nfd::face::Transport::Packet(lpPacket.wireEncode()));
+ BlockHeader header(lpPacket.wireEncode());
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
@@ -151,7 +151,7 @@
lpPacket.remove<::ndn::lp::FragIndexField>();
{
- BlockHeader header(nfd::face::Transport::Packet(lpPacket.wireEncode()));
+ BlockHeader header(lpPacket.wireEncode());
Ptr<Packet> packet = Create<Packet>();
packet->AddHeader(header);
boost::test_tools::output_test_stream output;
diff --git a/tests/unit-tests/ndn-cxx/face.t.cpp b/tests/unit-tests/ndn-cxx/face.t.cpp
index 32a1c1c..98d880b 100644
--- a/tests/unit-tests/ndn-cxx/face.t.cpp
+++ b/tests/unit-tests/ndn-cxx/face.t.cpp
@@ -230,7 +230,7 @@
private:
::ndn::Scheduler m_scheduler;
- ::ndn::util::scheduler::ScopedEventId m_event;
+ ::ndn::scheduler::ScopedEventId m_event;
};
BOOST_AUTO_TEST_CASE(ExpressMultipleInterests)
diff --git a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
index 3e8804c..fe9b380 100644
--- a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
@@ -54,7 +54,7 @@
addApps({
{"1", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1"}},
- "0s", "0.9s"}, // send just one packet
+ "1s", "1.9s"}, // send just one packet
// Second consumer will capture effect of the bug #2764
{"2", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1"}},
@@ -89,12 +89,12 @@
BOOST_CHECK_EQUAL(buffer.str(),
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
-0.0417744 1 0 0 LastDelay 0.0417744 41774.4 1 2
-0.0417744 1 0 0 FullDelay 0.0417744 41774.4 1 2
+1.04177 1 0 0 LastDelay 0.0417664 41766.4 1 2
+1.04177 1 0 0 FullDelay 0.0417664 41766.4 1 2
2 2 0 0 LastDelay 0 0 1 1
2 2 0 0 FullDelay 0 0 1 1
-3.02089 2 0 1 LastDelay 0.0208872 20887.2 1 1
-3.02089 2 0 1 FullDelay 0.0208872 20887.2 1 1
+3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1
+3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1
)STR");
}
@@ -116,8 +116,8 @@
BOOST_CHECK_EQUAL(buffer.str(),
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
-0.0417744 1 0 0 LastDelay 0.0417744 41774.4 1 2
-0.0417744 1 0 0 FullDelay 0.0417744 41774.4 1 2
+1.04177 1 0 0 LastDelay 0.0417664 41766.4 1 2
+1.04177 1 0 0 FullDelay 0.0417664 41766.4 1 2
)STR");
}
@@ -138,8 +138,8 @@
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
2 2 0 0 LastDelay 0 0 1 1
2 2 0 0 FullDelay 0 0 1 1
-3.02089 2 0 1 LastDelay 0.0208872 20887.2 1 1
-3.02089 2 0 1 FullDelay 0.0208872 20887.2 1 1
+3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1
+3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1
)STR");
}
@@ -156,8 +156,8 @@
BOOST_CHECK(output->is_equal(
R"STR(2 2 0 0 LastDelay 0 0 1 1
2 2 0 0 FullDelay 0 0 1 1
-3.02089 2 0 1 LastDelay 0.0208872 20887.2 1 1
-3.02089 2 0 1 FullDelay 0.0208872 20887.2 1 1
+3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1
+3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1
)STR"));
}
diff --git a/utils/dummy-keychain.cpp b/utils/dummy-keychain.cpp
index 02a3fad..3f62a4e 100644
--- a/utils/dummy-keychain.cpp
+++ b/utils/dummy-keychain.cpp
@@ -251,6 +251,13 @@
return make_shared<Buffer>(DUMMY_SIGNATURE, sizeof(DUMMY_SIGNATURE));
}
+bool
+DummyKeyHandle::doVerify(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t bufLen,
+ const uint8_t* sig, size_t sigLen) const
+{
+ throw Error("Not supported");
+}
+
ConstBufferPtr
DummyKeyHandle::doDecrypt(const uint8_t* cipherText, size_t cipherTextLen) const
{
@@ -329,6 +336,12 @@
throw Error("Not supported");
}
+void
+DummyTpm::doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key)
+{
+ throw Error("Not supported");
+}
+
std::string
DummyTpm::getScheme()
{
diff --git a/utils/dummy-keychain.hpp b/utils/dummy-keychain.hpp
index e71d083..7f8b0a3 100644
--- a/utils/dummy-keychain.hpp
+++ b/utils/dummy-keychain.hpp
@@ -147,6 +147,10 @@
ConstBufferPtr
doSign(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t size) const final;
+ bool
+ doVerify(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t bufLen,
+ const uint8_t* sig, size_t sigLen) const final;
+
ConstBufferPtr
doDecrypt(const uint8_t* cipherText, size_t cipherTextLen) const final;
@@ -209,6 +213,9 @@
void
doImportKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len, const char* pw, size_t pwLen) final;
+ void
+ doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key) final;
+
public:
static const std::string SCHEME;
};
diff --git a/utils/topology/annotated-topology-reader.hpp b/utils/topology/annotated-topology-reader.hpp
index 343743d..2f066dc 100644
--- a/utils/topology/annotated-topology-reader.hpp
+++ b/utils/topology/annotated-topology-reader.hpp
@@ -25,6 +25,7 @@
#include "ns3/topology-reader.h"
#include "ns3/random-variable-stream.h"
#include "ns3/object-factory.h"
+#include "ns3/node-container.h"
namespace ns3 {
diff --git a/wscript b/wscript
index 09725c6..94206b4 100644
--- a/wscript
+++ b/wscript
@@ -124,8 +124,7 @@
excl=['ndn-cxx/ndn-cxx/net/impl/*.cpp',
'ndn-cxx/ndn-cxx/net/network-monitor*.cpp',
'ndn-cxx/ndn-cxx/util/dummy-client-face.cpp',
- 'ndn-cxx/ndn-cxx/security/tpm/*osx.cpp',
- 'ndn-cxx/ndn-cxx/detail/*osx.cpp',
+ 'ndn-cxx/ndn-cxx/**/*osx.cpp',
'ndn-cxx/ndn-cxx/net/network-interface.cpp'])
nfdSrc = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in ['NFD/core', 'NFD/daemon']],