route: replace FibEntry class with struct
fix warnings from ndn-cxx
Change-Id: I1be322251dcfe5d867717a64547e1908b99c78ba
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index f5c0929..cc3ed63 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -187,9 +187,9 @@
HelloProtocol::onContent(const ndn::Interest& interest, const ndn::Data& data)
{
NLSR_LOG_DEBUG("Received data for INFO(name): " << data.getName());
- if (data.getSignature().hasKeyLocator() &&
- data.getSignature().getKeyLocator().getType() == ndn::tlv::Name) {
- NLSR_LOG_DEBUG("Data signed with: " << data.getSignature().getKeyLocator().getName());
+ auto kl = data.getKeyLocator();
+ if (kl && kl->getType() == ndn::tlv::Name) {
+ NLSR_LOG_DEBUG("Data signed with: " << kl->getName());
}
m_confParam.getValidator().validate(data,
std::bind(&HelloProtocol::onContentValidated, this, _1),
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index f3da897..fac8ae7 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -128,9 +128,9 @@
m_strategySetOnRouters.push_back(originRouter);
ndn::Name routerKey(originRouter);
- routerKey.append("KEY");
+ routerKey.append(ndn::security::Certificate::KEY_COMPONENT);
ndn::Name instanceKey(originRouter);
- instanceKey.append("nlsr").append("KEY");
+ instanceKey.append("nlsr").append(ndn::security::Certificate::KEY_COMPONENT);
m_fib.setStrategy(routerKey, Fib::BEST_ROUTE_V2_STRATEGY, 0);
m_fib.setStrategy(instanceKey, Fib::BEST_ROUTE_V2_STRATEGY, 0);
@@ -143,7 +143,7 @@
siteKey.append(originRouter[i]);
}
ndn::Name opPrefix(siteKey);
- siteKey.append("KEY");
+ siteKey.append(ndn::security::Certificate::KEY_COMPONENT);
m_fib.setStrategy(siteKey, Fib::BEST_ROUTE_V2_STRATEGY, 0);
opPrefix.append(std::string("%C1.Operator"));
diff --git a/src/route/fib-entry.cpp b/src/route/fib-entry.cpp
deleted file mode 100644
index bc11634..0000000
--- a/src/route/fib-entry.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2020, The University of Memphis,
- * Regents of the University of California
- *
- * This file is part of NLSR (Named-data Link State Routing).
- * See AUTHORS.md for complete list of NLSR authors and contributors.
- *
- * NLSR is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "fib-entry.hpp"
-#include "logger.hpp"
-
-namespace nlsr {
-
-INIT_LOGGER(route.FibEntry);
-
-void
-FibEntry::writeLog() const
-{
- NLSR_LOG_DEBUG("Name Prefix: " << m_name);
- NLSR_LOG_DEBUG("Seq No: " << m_seqNo);
- NLSR_LOG_DEBUG(m_nexthopList);
-}
-
-} // namespace nlsr
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
deleted file mode 100644
index e5542e1..0000000
--- a/src/route/fib-entry.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2020, The University of Memphis,
- * Regents of the University of California
- *
- * This file is part of NLSR (Named-data Link State Routing).
- * See AUTHORS.md for complete list of NLSR authors and contributors.
- *
- * NLSR is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef NLSR_FIB_ENTRY_HPP
-#define NLSR_FIB_ENTRY_HPP
-
-#include "nexthop-list.hpp"
-
-#include <ndn-cxx/util/scheduler.hpp>
-
-namespace nlsr {
-
-class FibEntry
-{
-public:
- FibEntry() = default;
-
- FibEntry(const ndn::Name& name)
- : m_name(name)
- {
- }
-
- const ndn::Name&
- getName() const
- {
- return m_name;
- }
-
- NexthopList&
- getNexthopList()
- {
- return m_nexthopList;
- }
-
- void
- setRefreshEventId(ndn::scheduler::EventId id)
- {
- m_refreshEventId = std::move(id);
- }
-
- ndn::scheduler::EventId
- getRefreshEventId() const
- {
- return m_refreshEventId;
- }
-
- void
- setSeqNo(int32_t fsn)
- {
- m_seqNo = fsn;
- }
-
- int32_t
- getSeqNo() const
- {
- return m_seqNo;
- }
-
- void
- writeLog() const;
-
- typedef NexthopList::const_iterator const_iterator;
-
- const_iterator
- begin() const;
-
- const_iterator
- end() const;
-
-private:
- ndn::Name m_name;
- ndn::scheduler::EventId m_refreshEventId;
- int32_t m_seqNo = 1;
- NexthopList m_nexthopList;
-};
-
-inline FibEntry::const_iterator
-FibEntry::begin() const
-{
- return m_nexthopList.cbegin();
-}
-
-inline FibEntry::const_iterator
-FibEntry::end() const
-{
- return m_nexthopList.cend();
-}
-
-} // namespace nlsr
-
-#endif // NLSR_FIB_ENTRY_HPP
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 2fef853..1004889 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -33,7 +33,6 @@
INIT_LOGGER(route.Fib);
-const uint64_t Fib::GRACE_PERIOD = 10;
const std::string Fib::MULTICAST_STRATEGY("ndn:/localhost/nfd/strategy/multicast");
const std::string Fib::BEST_ROUTE_V2_STRATEGY("ndn:/localhost/nfd/strategy/best-route");
@@ -54,11 +53,10 @@
auto it = m_table.find(name);
// Only unregister the prefix if it ISN'T a neighbor.
- if (it != m_table.end() && isNotNeighbor((it->second).getName())) {
- for (const auto& nexthop : (it->second).getNexthopList().getNextHops()) {
- unregisterPrefix((it->second).getName(), nexthop.getConnectingFaceUri());
+ if (it != m_table.end() && isNotNeighbor((it->second).name)) {
+ for (const auto& nexthop : (it->second).nexthopList.getNextHops()) {
+ unregisterPrefix((it->second).name, nexthop.getConnectingFaceUri());
}
- cancelEntryRefresh(it->second);
m_table.erase(it);
}
}
@@ -66,14 +64,14 @@
void
Fib::addNextHopsToFibEntryAndNfd(FibEntry& entry, const NexthopList& hopsToAdd)
{
- const ndn::Name& name = entry.getName();
+ const ndn::Name& name = entry.name;
bool shouldRegister = isNotNeighbor(name);
for (const auto& hop : hopsToAdd.getNextHops())
{
// Add nexthop to FIB entry
- entry.getNexthopList().addNextHop(hop);
+ entry.nexthopList.addNextHop(hop);
if (shouldRegister) {
// Add nexthop to NDN-FIB
@@ -108,11 +106,12 @@
if (entryIt == m_table.end() && hopsToAdd.size() != 0) {
NLSR_LOG_DEBUG("New FIB Entry");
- FibEntry entry(name);
+ FibEntry entry;
+ entry.name = name;
addNextHopsToFibEntryAndNfd(entry, hopsToAdd);
- m_table.emplace(name, entry);
+ m_table.emplace(name, std::move(entry));
entryIt = m_table.find(name);
}
@@ -131,47 +130,39 @@
addNextHopsToFibEntryAndNfd(entry, hopsToAdd);
std::set<NextHop, NextHopComparator> hopsToRemove;
- std::set_difference(entry.getNexthopList().begin(), entry.getNexthopList().end(),
+ std::set_difference(entry.nexthopList.begin(), entry.nexthopList.end(),
hopsToAdd.begin(), hopsToAdd.end(),
std::inserter(hopsToRemove, hopsToRemove.end()), NextHopComparator());
- bool isUpdatable = isNotNeighbor(entry.getName());
+ bool isUpdatable = isNotNeighbor(entry.name);
// Remove the uninstalled next hops from NFD and FIB entry
for (const auto& hop : hopsToRemove){
if (isUpdatable) {
- unregisterPrefix(entry.getName(), hop.getConnectingFaceUri());
+ unregisterPrefix(entry.name, hop.getConnectingFaceUri());
}
- NLSR_LOG_DEBUG("Removing " << hop.getConnectingFaceUri() << " from " << entry.getName());
- entry.getNexthopList().removeNextHop(hop);
+ NLSR_LOG_DEBUG("Removing " << hop.getConnectingFaceUri() << " from " << entry.name);
+ entry.nexthopList.removeNextHop(hop);
}
// Increment sequence number
- entry.setSeqNo(entry.getSeqNo() + 1);
-
+ entry.seqNo += 1;
entryIt = m_table.find(name);
-
}
+
if (entryIt != m_table.end() &&
- !entryIt->second.getRefreshEventId() &&
- isNotNeighbor(entryIt->second.getName())) {
- scheduleEntryRefresh(entryIt->second,
- [this] (FibEntry& entry) {
- scheduleLoop(entry);
- });
+ !entryIt->second.refreshEventId &&
+ isNotNeighbor(entryIt->second.name)) {
+ scheduleEntryRefresh(entryIt->second, [this] (FibEntry& entry) { scheduleLoop(entry); });
}
}
void
Fib::clean()
{
- NLSR_LOG_DEBUG("Fib::clean called");
- // can't use const ref here as getNexthopList can't be marked const
- for (auto&& it : m_table) {
- NLSR_LOG_DEBUG("Canceling Scheduled event. Name: " << it.second.getName());
- cancelEntryRefresh(it.second);
-
- for (const auto& hop : it.second.getNexthopList().getNextHops()) {
- unregisterPrefix(it.second.getName(), hop.getConnectingFaceUri());
+ NLSR_LOG_DEBUG("Clean called");
+ for (const auto& it : m_table) {
+ for (const auto& hop : it.second.nexthopList.getNextHops()) {
+ unregisterPrefix(it.second.name, hop.getConnectingFaceUri());
}
}
}
@@ -182,13 +173,8 @@
uint32_t nNextHops = static_cast<uint32_t>(nextHopList.getNextHops().size());
uint32_t nMaxFaces = m_confParameter.getMaxFacesPerPrefix();
- // Allow all faces
- if (nMaxFaces == 0) {
- return nNextHops;
- }
- else {
- return std::min(nNextHops, nMaxFaces);
- }
+ // 0 == all faces
+ return nMaxFaces == 0 ? nNextHops : std::min(nNextHops, nMaxFaces);
}
bool
@@ -325,13 +311,13 @@
void
Fib::scheduleEntryRefresh(FibEntry& entry, const afterRefreshCallback& refreshCallback)
{
- NLSR_LOG_DEBUG("Scheduling refresh for " << entry.getName() <<
- " Seq Num: " << entry.getSeqNo() <<
+ NLSR_LOG_DEBUG("Scheduling refresh for " << entry.name <<
+ " Seq Num: " << entry.seqNo <<
" in " << m_refreshTime << " seconds");
- entry.setRefreshEventId(m_scheduler.schedule(ndn::time::seconds(m_refreshTime),
- std::bind(&Fib::refreshEntry, this,
- entry.getName(), refreshCallback)));
+ entry.refreshEventId = m_scheduler.schedule(ndn::time::seconds(m_refreshTime),
+ std::bind(&Fib::refreshEntry, this,
+ entry.name, refreshCallback));
}
void
@@ -341,13 +327,6 @@
}
void
-Fib::cancelEntryRefresh(const FibEntry& entry)
-{
- NLSR_LOG_DEBUG("Canceling refresh for " << entry.getName() << " Seq Num: " << entry.getSeqNo());
- entry.getRefreshEventId().cancel();
-}
-
-void
Fib::refreshEntry(const ndn::Name& name, afterRefreshCallback refreshCb)
{
auto it = m_table.find(name);
@@ -356,13 +335,12 @@
}
FibEntry& entry = it->second;
- NLSR_LOG_DEBUG("Refreshing " << entry.getName() << " Seq Num: " << entry.getSeqNo());
+ NLSR_LOG_DEBUG("Refreshing " << entry.name << " Seq Num: " << entry.seqNo);
- // Increment sequence number
- entry.setSeqNo(entry.getSeqNo() + 1);
+ entry.seqNo += 1;
- for (const NextHop& hop : entry) {
- registerPrefix(entry.getName(),
+ for (const NextHop& hop : entry.nexthopList) {
+ registerPrefix(entry.name,
ndn::FaceUri(hop.getConnectingFaceUri()),
hop.getRouteCostAsAdjustedInteger(),
ndn::time::seconds(m_refreshTime + GRACE_PERIOD),
@@ -377,7 +355,9 @@
{
NLSR_LOG_DEBUG("-------------------FIB-----------------------------");
for (const auto& entry : m_table) {
- entry.second.writeLog();
+ NLSR_LOG_DEBUG("Name Prefix: " << entry.second.name);
+ NLSR_LOG_DEBUG("Seq No: " << entry.second.seqNo);
+ NLSR_LOG_DEBUG(entry.second.nexthopList);
}
}
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 27891eb..e8f8a40 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -22,19 +22,26 @@
#ifndef NLSR_ROUTE_FIB_HPP
#define NLSR_ROUTE_FIB_HPP
-#include "fib-entry.hpp"
#include "test-access-control.hpp"
+#include "nexthop-list.hpp"
#include <ndn-cxx/mgmt/nfd/controller.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/time.hpp>
namespace nlsr {
+struct FibEntry {
+ ndn::Name name;
+ ndn::scheduler::ScopedEventId refreshEventId;
+ int32_t seqNo = 1;
+ NexthopList nexthopList;
+};
+
typedef std::function<void(FibEntry&)> afterRefreshCallback;
class AdjacencyList;
class ConfParameter;
-class FibEntry;
/*! \brief Maps names to lists of next hops, and exports this information to NFD.
*
@@ -203,16 +210,6 @@
void
scheduleLoop(FibEntry& entry);
- /*! \brief Cancel an entry's refresh event.
- *
- * Cancel an entry's refresh event. This only needs to be done when
- * an entry is removed. Typically this happens when NLSR is
- * terminated or crashes, and we don't want the scheduler to crash
- * because it's referencing memory that has no valid function.
- */
- void
- cancelEntryRefresh(const FibEntry& entry);
-
/*! \brief Refreshes an entry in NFD.
*/
void
@@ -239,7 +236,7 @@
* allow for things like stuttering prefix registrations and
* processing time when refreshing events.
*/
- static const uint64_t GRACE_PERIOD;
+ static constexpr uint64_t GRACE_PERIOD = 10;
};
} // namespace nlsr
diff --git a/src/security/certificate-store.cpp b/src/security/certificate-store.cpp
index 11db5e3..684969a 100644
--- a/src/security/certificate-store.cpp
+++ b/src/security/certificate-store.cpp
@@ -85,12 +85,12 @@
// Router's NLSR certificate
ndn::Name nlsrKeyPrefix = m_confParam.getRouterPrefix();
nlsrKeyPrefix.append("nlsr");
- nlsrKeyPrefix.append("KEY");
+ nlsrKeyPrefix.append(ndn::security::Certificate::KEY_COMPONENT);
prefixes.push_back(nlsrKeyPrefix);
// Router's certificate
ndn::Name routerKeyPrefix = m_confParam.getRouterPrefix();
- routerKeyPrefix.append("KEY");
+ routerKeyPrefix.append(ndn::security::Certificate::KEY_COMPONENT);
prefixes.push_back(routerKeyPrefix);
// Router's operator's certificate
@@ -102,7 +102,7 @@
// Router's site's certificate
ndn::Name siteKeyPrefix = m_confParam.getNetwork();
siteKeyPrefix.append(m_confParam.getSiteName());
- siteKeyPrefix.append("KEY");
+ siteKeyPrefix.append(ndn::security::Certificate::KEY_COMPONENT);
prefixes.push_back(siteKeyPrefix);
// Start listening for interest of this router's NLSR certificate,
@@ -152,8 +152,9 @@
setInterestFilter(certName);
- if (cert->getKeyName() != cert->getSignature().getKeyLocator().getName()) {
- publishCertFromCache(cert->getSignature().getKeyLocator().getName());
+ const ndn::Name& keyLocatorName = cert->getSignatureInfo().getKeyLocator().getName();
+ if (cert->getKeyName() != keyLocatorName) {
+ publishCertFromCache(keyLocatorName);
}
}
else {
@@ -165,7 +166,7 @@
void
CertificateStore::afterFetcherSignalEmitted(const ndn::Data& lsaSegment)
{
- const auto keyName = lsaSegment.getSignature().getKeyLocator().getName();
+ const auto keyName = lsaSegment.getSignatureInfo().getKeyLocator().getName();
if (!find(keyName)) {
NLSR_LOG_TRACE("Publishing certificate for: " << keyName);
publishCertFromCache(keyName);
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 77cc97c..4e6f731 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -104,7 +104,7 @@
v2::AdditionalDescription description;
description.set("type", "sub-certificate");
- info.appendTypeSpecificTlv(description.wireEncode());
+ info.addCustomTlv(description.wireEncode());
m_keyChain.sign(request, ndn::signingByIdentity(issuer).setSignatureInfo(info));
m_keyChain.setDefaultCertificate(subIdentity.getDefaultKey(), request);
diff --git a/tests/route/test-fib-entry.cpp b/tests/route/test-fib-entry.cpp
deleted file mode 100644
index b323ca5..0000000
--- a/tests/route/test-fib-entry.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2019, The University of Memphis,
- * Regents of the University of California
- *
- * This file is part of NLSR (Named-data Link State Routing).
- * See AUTHORS.md for complete list of NLSR authors and contributors.
- *
- * NLSR is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- **/
-
-#include "route/fib-entry.hpp"
-#include "route/nexthop-list.hpp"
-
-#include "tests/boost-test.hpp"
-
-#include <ndn-cxx/util/time.hpp>
-
-namespace nlsr {
-namespace test {
-
-BOOST_AUTO_TEST_SUITE(TestFibEntry)
-
-BOOST_AUTO_TEST_CASE(FibEntryConstructorAndGetters)
-{
- FibEntry fe1("next1");
-
- BOOST_CHECK_EQUAL(fe1.getName(), "next1");
- BOOST_CHECK_EQUAL(fe1.getSeqNo(), 1); // Initial Seq No.
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace test
-} // namespace nlsr
diff --git a/tests/route/test-fib.cpp b/tests/route/test-fib.cpp
index 5d2d27e..fd68e80 100644
--- a/tests/route/test-fib.cpp
+++ b/tests/route/test-fib.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
@@ -16,8 +16,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- **/
+ */
#include "route/fib.hpp"
#include "../test-common.hpp"
@@ -301,13 +300,14 @@
BOOST_FIXTURE_TEST_CASE(ScheduleFibEntryRefresh, FibFixture)
{
ndn::Name name1("/name/1");
- FibEntry fe(name1);
- fib->m_table.emplace(name1, fe);
- int origSeqNo = fe.getSeqNo();
+ FibEntry fe;
+ fe.name = name1;
+ int origSeqNo = fe.seqNo;
+ fib->m_table.emplace(name1, std::move(fe));
fib->scheduleEntryRefresh(fe,
[&] (FibEntry& entry) {
- BOOST_CHECK_EQUAL(origSeqNo + 1, entry.getSeqNo());
+ BOOST_CHECK_EQUAL(origSeqNo + 1, entry.seqNo);
});
this->advanceClocks(ndn::time::milliseconds(10), 1);
}
diff --git a/tests/security/test-certificate-store.cpp b/tests/security/test-certificate-store.cpp
index b4ef2da..00d5d62 100644
--- a/tests/security/test-certificate-store.cpp
+++ b/tests/security/test-certificate-store.cpp
@@ -153,12 +153,12 @@
// check if nlsrKeyPrefix is registered
ndn::Name nlsrKeyPrefix = conf.getRouterPrefix();
nlsrKeyPrefix.append("nlsr");
- nlsrKeyPrefix.append("KEY");
+ nlsrKeyPrefix.append(ndn::security::Certificate::KEY_COMPONENT);
checkPrefixRegistered(face, nlsrKeyPrefix);
// check if routerPrefix is registered
ndn::Name routerKeyPrefix = conf.getRouterPrefix();
- routerKeyPrefix.append("KEY");
+ routerKeyPrefix.append(ndn::security::Certificate::KEY_COMPONENT);
checkPrefixRegistered(face, routerKeyPrefix);
// check if operatorKeyPrefix is registered
@@ -206,7 +206,7 @@
});
lsdb.emitSegmentValidatedSignal(data);
- const auto keyName = data.getSignature().getKeyLocator().getName();
+ const auto keyName = data.getSignatureInfo().getKeyLocator().getName();
BOOST_CHECK(certStore.find(keyName) != nullptr);
// testing a callback after segment validation signal from lsdb
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index b611390..b2db763 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "test-common.hpp"
@@ -26,9 +26,8 @@
ndn::Data&
signData(ndn::Data& data)
{
- ndn::SignatureSha256WithRsa fakeSignature;
- fakeSignature.setValue(ndn::encoding::makeEmptyBlock(ndn::tlv::SignatureValue));
- data.setSignature(fakeSignature);
+ data.setSignatureInfo(ndn::SignatureInfo(ndn::tlv::SignatureTypeValue::SignatureSha256WithRsa));
+ data.setSignatureValue(ndn::encoding::makeEmptyBlock(ndn::tlv::SignatureValue).getBuffer());
data.wireEncode();
return data;