table: don't use shared_ptr in FIB
refs #3164
Change-Id: I5b5eb47d60f6bf5b6389c32ac840f793767e4334
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index db8a192..204aaaa 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -126,7 +126,7 @@
}
shared_ptr<Face> face = this->getFace(mi.lastNexthop);
- if (face == nullptr || !fibEntry.hasNextHop(face)) {
+ if (face == nullptr || !fibEntry.hasNextHop(*face)) {
NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone");
return false;
}
@@ -140,7 +140,7 @@
NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop <<
" last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
- this->sendInterest(pitEntry, face);
+ this->sendInterest(pitEntry, *face);
// schedule RTO timeout
shared_ptr<PitInfo> pi = pitEntry->getOrCreateStrategyInfo<PitInfo>();
@@ -171,11 +171,11 @@
std::unordered_set<FaceId> exceptFaces)
{
for (const fib::NextHop& nexthop : fibEntry.getNextHops()) {
- shared_ptr<Face> face = nexthop.getFace();
- if (exceptFaces.count(face->getId()) > 0) {
+ Face& face = nexthop.getFace();
+ if (exceptFaces.count(face.getId()) > 0) {
continue;
}
- NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face->getId() <<
+ NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face.getId() <<
" multicast");
this->sendInterest(pitEntry, face);
}
diff --git a/daemon/fw/asf-probing-module.cpp b/daemon/fw/asf-probing-module.cpp
index f561b52..097a372 100644
--- a/daemon/fw/asf-probing-module.cpp
+++ b/daemon/fw/asf-probing-module.cpp
@@ -64,7 +64,7 @@
});
}
-shared_ptr<Face>
+Face*
ProbingModule::getFaceToProbe(const Face& inFace,
const Interest& interest,
const fib::Entry& fibEntry,
@@ -84,23 +84,23 @@
// Put eligible faces into rankedFaces. If a face does not have an RTT measurement,
// immediately pick the face for probing
for (const fib::NextHop& hop : fibEntry.getNextHops()) {
- const shared_ptr<Face>& hopFace = hop.getFace();
+ Face& hopFace = hop.getFace();
// Don't send probe Interest back to the incoming face or use the same face
// as the forwarded Interest
- if (hopFace->getId() == inFace.getId() || hopFace->getId() == faceUsed.getId()) {
+ if (hopFace.getId() == inFace.getId() || hopFace.getId() == faceUsed.getId()) {
continue;
}
- FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+ FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
// If no RTT has been recorded, probe this face
if (info == nullptr || !info->hasSrttMeasurement()) {
- return hopFace;
+ return &hopFace;
}
// Add FaceInfo to container sorted by RTT
- rankedFaces.insert(std::make_pair(info, hopFace));
+ rankedFaces.insert(std::make_pair(info, &hopFace));
}
if (rankedFaces.empty()) {
@@ -140,7 +140,7 @@
scheduleProbe(fibEntry, m_probingInterval);
}
-shared_ptr<Face>
+Face*
ProbingModule::getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces)
{
double randomNumber = getRandomNumber(0, 1);
diff --git a/daemon/fw/asf-probing-module.hpp b/daemon/fw/asf-probing-module.hpp
index 585b76a..3a4df6e 100644
--- a/daemon/fw/asf-probing-module.hpp
+++ b/daemon/fw/asf-probing-module.hpp
@@ -43,7 +43,7 @@
void
scheduleProbe(const fib::Entry& fibEntry, const time::milliseconds& interval);
- shared_ptr<Face>
+ Face*
getFaceToProbe(const Face& inFace,
const Interest& interest,
const fib::Entry& fibEntry,
@@ -57,11 +57,11 @@
private:
// Used to associate FaceInfo with the face in a NextHop
- typedef std::pair<FaceInfo*, shared_ptr<Face>> FaceInfoFacePair;
+ typedef std::pair<FaceInfo*, Face*> FaceInfoFacePair;
typedef std::function<bool(FaceInfoFacePair, FaceInfoFacePair)> FaceInfoPredicate;
typedef std::set<FaceInfoFacePair, FaceInfoPredicate> FaceInfoFacePairSet;
- shared_ptr<Face>
+ Face*
getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces);
double
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index cf616e8..3f8abf7 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -79,7 +79,7 @@
return;
}
- const shared_ptr<Face> faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
+ Face* faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
if (faceToUse == nullptr) {
sendNoRouteNack(inFace, interest, pitEntry);
@@ -87,18 +87,18 @@
return;
}
- forwardInterest(interest, fibEntry, pitEntry, faceToUse);
+ forwardInterest(interest, fibEntry, pitEntry, *faceToUse);
// If necessary, send probe
if (m_probing.isProbingNeeded(fibEntry, interest)) {
- shared_ptr<Face> faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
+ Face* faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
if (faceToProbe != nullptr) {
NFD_LOG_TRACE("Sending probe for " << fibEntry.getPrefix()
<< " to FaceId: " << faceToProbe->getId());
bool wantNewNonce = true;
- forwardInterest(interest, fibEntry, pitEntry, faceToProbe, wantNewNonce);
+ forwardInterest(interest, fibEntry, pitEntry, *faceToProbe, wantNewNonce);
m_probing.afterForwardingProbe(fibEntry, interest);
}
}
@@ -143,27 +143,27 @@
AsfStrategy::forwardInterest(const Interest& interest,
const fib::Entry& fibEntry,
shared_ptr<pit::Entry> pitEntry,
- shared_ptr<Face> outFace,
+ Face& outFace,
bool wantNewNonce)
{
this->sendInterest(pitEntry, outFace, wantNewNonce);
- FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, *outFace);
+ FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, outFace);
// Refresh measurements since Face is being used for forwarding
NamespaceInfo& namespaceInfo = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
- namespaceInfo.extendFaceInfoLifetime(faceInfo, *outFace);
+ namespaceInfo.extendFaceInfoLifetime(faceInfo, outFace);
if (!faceInfo.isTimeoutScheduled()) {
// Estimate and schedule timeout
RttEstimator::Duration timeout = faceInfo.computeRto();
NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix()
- << " FaceId: " << outFace->getId()
+ << " FaceId: " << outFace.getId()
<< " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
scheduler::EventId id = scheduler::schedule(timeout,
- bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace->getId()));
+ bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace.getId()));
faceInfo.setTimeoutEvent(id, interest.getName());
}
@@ -171,7 +171,7 @@
struct FaceStats
{
- shared_ptr<Face> face;
+ Face* face;
RttStats::Rtt rtt;
RttStats::Rtt srtt;
uint64_t cost;
@@ -196,7 +196,7 @@
}
}
-const shared_ptr<Face>
+Face*
AsfStrategy::getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace)
{
NFD_LOG_TRACE("Looking for best face for " << fibEntry.getPrefix());
@@ -222,17 +222,16 @@
});
for (const fib::NextHop& hop : fibEntry.getNextHops()) {
+ Face& hopFace = hop.getFace();
- const shared_ptr<Face>& hopFace = hop.getFace();
-
- if (hopFace->getId() == inFace.getId()) {
+ if (hopFace.getId() == inFace.getId()) {
continue;
}
- FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+ FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
if (info == nullptr) {
- FaceStats stats = {hopFace,
+ FaceStats stats = {&hopFace,
RttStats::RTT_NO_MEASUREMENT,
RttStats::RTT_NO_MEASUREMENT,
hop.getCost()};
@@ -240,7 +239,7 @@
rankedFaces.insert(stats);
}
else {
- FaceStats stats = {hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
+ FaceStats stats = {&hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
rankedFaces.insert(stats);
}
}
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index cb50e01..ad00a3d 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -69,10 +69,10 @@
forwardInterest(const Interest& interest,
const fib::Entry& fibEntry,
shared_ptr<pit::Entry> pitEntry,
- shared_ptr<Face> outFace,
+ Face& outFace,
bool wantNewNonce = false);
- const shared_ptr<Face>
+ Face*
getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace);
void
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index bae5262..b97afca 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -54,14 +54,14 @@
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
const fib::NextHopList& nexthops = fibEntry.getNextHops();
fib::NextHopList::const_iterator it = std::find_if(nexthops.begin(), nexthops.end(),
- [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, *nexthop.getFace()); });
+ [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, nexthop.getFace()); });
if (it == nexthops.end()) {
this->rejectPendingInterest(pitEntry);
return;
}
- shared_ptr<Face> outFace = it->getFace();
+ Face& outFace = it->getFace();
this->sendInterest(pitEntry, outFace);
}
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index ef68175..df6ca4d 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -59,19 +59,19 @@
bool wantUnused = false,
time::steady_clock::TimePoint now = time::steady_clock::TimePoint::min())
{
- shared_ptr<Face> upstream = nexthop.getFace();
+ Face& upstream = nexthop.getFace();
// upstream is current downstream
- if (upstream->getId() == currentDownstream)
+ if (upstream.getId() == currentDownstream)
return false;
// forwarding would violate scope
- if (violatesScope(*pitEntry, *upstream))
+ if (violatesScope(*pitEntry, upstream))
return false;
if (wantUnused) {
// NextHop must not have unexpired out-record
- pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*upstream);
+ pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(upstream);
if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
return false;
}
@@ -93,7 +93,7 @@
for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
if (!predicate_NextHop_eligible(pitEntry, *it, currentDownstream))
continue;
- pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*it->getFace());
+ pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(it->getFace());
BOOST_ASSERT(outRecord != pitEntry->out_end());
if (outRecord->getLastRenewed() < earliestRenewed) {
found = it;
@@ -136,10 +136,10 @@
return;
}
- shared_ptr<Face> outFace = it->getFace();
+ Face& outFace = it->getFace();
this->sendInterest(pitEntry, outFace);
NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
- << " newPitEntry-to=" << outFace->getId());
+ << " newPitEntry-to=" << outFace.getId());
return;
}
@@ -148,10 +148,10 @@
bind(&predicate_NextHop_eligible, pitEntry, _1, inFace.getId(),
true, time::steady_clock::now()));
if (it != nexthops.end()) {
- shared_ptr<Face> outFace = it->getFace();
+ Face& outFace = it->getFace();
this->sendInterest(pitEntry, outFace);
NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
- << " retransmit-unused-to=" << outFace->getId());
+ << " retransmit-unused-to=" << outFace.getId());
return;
}
@@ -161,10 +161,10 @@
NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " retransmitNoNextHop");
}
else {
- shared_ptr<Face> outFace = it->getFace();
+ Face& outFace = it->getFace();
this->sendInterest(pitEntry, outFace);
NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
- << " retransmit-retry-to=" << outFace->getId());
+ << " retransmit-retry-to=" << outFace.getId());
}
}
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index 8c6a778..d78baf6 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -56,10 +56,12 @@
virtual void
afterReceiveInterest(const Face& inFace, const Interest& interest,
+
shared_ptr<pit::Entry> pitEntry) override;
virtual void
afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+
shared_ptr<pit::Entry> pitEntry) override;
public:
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index 044e065..a73291b 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -66,7 +66,7 @@
return;
}
- this->sendInterest(pitEntry, outFace);
+ this->sendInterest(pitEntry, *outFace);
}
} // namespace fw
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index b4bda23..4cda948 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -108,7 +108,7 @@
" remote=" << face->getRemoteUri() <<
" local=" << face->getLocalUri());
- m_forwarder.getFib().removeNextHopFromAllEntries(face);
+ m_forwarder.getFib().removeNextHopFromAllEntries(*face);
// defer Face deallocation, so that Transport isn't deallocated during afterStateChange signal
getGlobalIoService().post([face] {});
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3bb580d..0b4c653 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -522,7 +522,7 @@
// has Link object?
if (!interest.hasLink()) {
// FIB lookup with Interest name
- const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+ const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
NFD_LOG_TRACE("lookupFib noLinkObject found=" << fibEntry.getPrefix());
return fibEntry;
}
@@ -532,7 +532,7 @@
// in producer region?
if (m_networkRegionTable.isInProducerRegion(link)) {
// FIB lookup with Interest name
- const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+ const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
NFD_LOG_TRACE("lookupFib inProducerRegion found=" << fibEntry.getPrefix());
return fibEntry;
}
@@ -541,13 +541,13 @@
if (interest.hasSelectedDelegation()) {
// FIB lookup with SelectedDelegation
Name selectedDelegation = interest.getSelectedDelegation();
- const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(selectedDelegation);
+ const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(selectedDelegation);
NFD_LOG_TRACE("lookupFib hasSelectedDelegation=" << selectedDelegation << " found=" << fibEntry.getPrefix());
return fibEntry;
}
// FIB lookup with first delegation Name
- const fib::Entry& fibEntry0 = *m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
+ const fib::Entry& fibEntry0 = m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
// in default-free zone?
bool isDefaultFreeZone = !(fibEntry0.getPrefix().size() == 0 && fibEntry0.hasNextHops());
if (!isDefaultFreeZone) {
@@ -558,7 +558,7 @@
// choose and set SelectedDelegation
for (const std::pair<uint32_t, Name>& delegation : link.getDelegations()) {
const Name& delegationName = delegation.second;
- const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(delegationName);
+ const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(delegationName);
if (fibEntry.hasNextHops()) {
/// \todo Don't modify in-record Interests.
/// Set SelectedDelegation in outgoing Interest pipeline.
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 9b89049..5373d03 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -46,8 +46,8 @@
const fib::NextHopList& nexthops = fibEntry.getNextHops();
for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
- shared_ptr<Face> outFace = it->getFace();
- if (canForwardToLegacy(*pitEntry, *outFace)) {
+ Face& outFace = it->getFace();
+ if (canForwardToLegacy(*pitEntry, outFace)) {
this->sendInterest(pitEntry, outFace);
}
}
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index a459552..fc9cd20 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -74,13 +74,13 @@
size_t nUpstreams = nexthops.size();
shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
- if (bestFace != nullptr && fibEntry.hasNextHop(bestFace) &&
+ if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace) &&
canForwardToLegacy(*pitEntry, *bestFace)) {
// TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
deferFirst = measurementsEntryInfo->prediction;
deferRange = time::microseconds((deferFirst.count() + 1) / 2);
--nUpstreams;
- this->sendInterest(pitEntry, bestFace);
+ this->sendInterest(pitEntry, *bestFace);
pitEntryInfo->bestFaceTimeout = scheduler::schedule(
measurementsEntryInfo->prediction,
bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
@@ -89,7 +89,7 @@
// use first eligible nexthop
auto firstEligibleNexthop = std::find_if(nexthops.begin(), nexthops.end(),
[&pitEntry] (const fib::NextHop& nexthop) {
- return canForwardToLegacy(*pitEntry, *nexthop.getFace());
+ return canForwardToLegacy(*pitEntry, nexthop.getFace());
});
if (firstEligibleNexthop != nexthops.end()) {
this->sendInterest(pitEntry, firstEligibleNexthop->getFace());
@@ -97,7 +97,7 @@
}
shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
- if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+ if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
canForwardToLegacy(*pitEntry, *previousFace)) {
--nUpstreams;
}
@@ -135,16 +135,16 @@
this->getMeasurementsEntryInfo(pitEntry);
shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
- if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+ if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
canForwardToLegacy(*pitEntry, *previousFace)) {
- this->sendInterest(pitEntry, previousFace);
+ this->sendInterest(pitEntry, *previousFace);
}
const fib::NextHopList& nexthops = fibEntry.getNextHops();
bool isForwarded = false;
for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
- shared_ptr<Face> face = it->getFace();
- if (canForwardToLegacy(*pitEntry, *face)) {
+ Face& face = it->getFace();
+ if (canForwardToLegacy(*pitEntry, face)) {
isForwarded = true;
this->sendInterest(pitEntry, face);
break;
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 3a11568..386dd7f 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -130,7 +130,7 @@
* rather than reusing a Nonce from one of the PIT in-records
*/
VIRTUAL_WITH_TESTS void
- sendInterest(shared_ptr<pit::Entry> pitEntry, shared_ptr<Face> outFace,
+ sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace,
bool wantNewNonce = false);
/** \brief decide that a pending Interest cannot be forwarded
@@ -200,11 +200,9 @@
}
inline void
-Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry,
- shared_ptr<Face> outFace,
- bool wantNewNonce)
+Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace, bool wantNewNonce)
{
- m_forwarder.onOutgoingInterest(pitEntry, *outFace, wantNewNonce);
+ m_forwarder.onOutgoingInterest(pitEntry, outFace, wantNewNonce);
}
inline void
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 09e184a..b7ac209 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -61,11 +61,10 @@
<< " faceid: " << faceId
<< " cost: " << cost);
- auto face = m_getFace(faceId);
- if (static_cast<bool>(face)) {
- auto entry = m_fib.insert(prefix).first;
-
- entry->addNextHop(face, cost);
+ shared_ptr<Face> face = m_getFace(faceId);
+ if (face != nullptr) {
+ fib::Entry* entry = m_fib.insert(prefix).first;
+ entry->addNextHop(*face, cost);
NFD_LOG_DEBUG("add-nexthop result: OK"
<< " prefix:" << prefix
@@ -90,11 +89,11 @@
NFD_LOG_TRACE("remove-nexthop prefix: " << parameters.getName()
<< " faceid: " << parameters.getFaceId());
- auto face = m_getFace(parameters.getFaceId());
- if (static_cast<bool>(face)) {
- auto entry = m_fib.findExactMatch(parameters.getName());
- if (static_cast<bool>(entry)) {
- entry->removeNextHop(face);
+ shared_ptr<Face> face = m_getFace(parameters.getFaceId());
+ if (face != nullptr) {
+ fib::Entry* entry = m_fib.findExactMatch(parameters.getName());
+ if (entry != nullptr) {
+ entry->removeNextHop(*face);
NFD_LOG_DEBUG("remove-nexthop result: OK prefix: " << parameters.getName()
<< " faceid: " << parameters.getFaceId());
@@ -124,7 +123,7 @@
for (auto&& next : nextHops) {
ndn::nfd::NextHopRecord nextHopRecord;
- nextHopRecord.setFaceId(next.getFace()->getId());
+ nextHopRecord.setFaceId(next.getFace().getId());
nextHopRecord.setCost(next.getCost());
record.addNextHopRecord(nextHopRecord);
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 5d9ce22..65fa80a 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -194,8 +194,7 @@
// add FIB entry for NFD Management Protocol
Name topPrefix("/localhost/nfd");
- auto entry = m_forwarder->getFib().insert(topPrefix).first;
- entry->addNextHop(m_internalFace, 0);
+ m_forwarder->getFib().insert(topPrefix).first->addNextHop(*m_internalFace, 0);
m_dispatcher->addTopPrefix(topPrefix, false);
}
diff --git a/daemon/table/fib-entry.cpp b/daemon/table/fib-entry.cpp
index b2ea76c..cb37b0f 100644
--- a/daemon/table/fib-entry.cpp
+++ b/daemon/table/fib-entry.cpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -34,40 +34,37 @@
}
NextHopList::iterator
-Entry::findNextHop(Face& face)
+Entry::findNextHop(const Face& face)
{
return std::find_if(m_nextHops.begin(), m_nextHops.end(),
[&face] (const NextHop& nexthop) {
- return nexthop.getFace().get() == &face;
+ return &nexthop.getFace() == &face;
});
}
bool
-Entry::hasNextHop(shared_ptr<Face> face) const
+Entry::hasNextHop(const Face& face) const
{
- return const_cast<Entry*>(this)->findNextHop(*face) != m_nextHops.end();
+ return const_cast<Entry*>(this)->findNextHop(face) != m_nextHops.end();
}
void
-Entry::addNextHop(shared_ptr<Face> face, uint64_t cost)
+Entry::addNextHop(Face& face, uint64_t cost)
{
- auto it = this->findNextHop(*face);
+ auto it = this->findNextHop(face);
if (it == m_nextHops.end()) {
- m_nextHops.push_back(fib::NextHop(face));
- it = m_nextHops.end();
- --it;
+ m_nextHops.emplace_back(face);
+ it = std::prev(m_nextHops.end());
}
- // now it refers to the NextHop for face
it->setCost(cost);
-
this->sortNextHops();
}
void
-Entry::removeNextHop(shared_ptr<Face> face)
+Entry::removeNextHop(const Face& face)
{
- auto it = this->findNextHop(*face);
+ auto it = this->findNextHop(face);
if (it != m_nextHops.end()) {
m_nextHops.erase(it);
}
diff --git a/daemon/table/fib-entry.hpp b/daemon/table/fib-entry.hpp
index 9106d9f..8f83266 100644
--- a/daemon/table/fib-entry.hpp
+++ b/daemon/table/fib-entry.hpp
@@ -67,37 +67,33 @@
bool
hasNextHops() const;
- /** \return whether there is a NextHop record for face
- *
- * \todo change parameter type to Face&
+ /** \return whether there is a NextHop record for \p face
*/
bool
- hasNextHop(shared_ptr<Face> face) const;
+ hasNextHop(const Face& face) const;
/** \brief adds a NextHop record
*
- * If a NextHop record for face already exists, its cost is updated.
- * \note shared_ptr is passed by value because this function will take shared ownership
+ * If a NextHop record for \p face already exists, its cost is updated.
*/
void
- addNextHop(shared_ptr<Face> face, uint64_t cost);
+ addNextHop(Face& face, uint64_t cost);
/** \brief removes a NextHop record
*
* If no NextHop record for face exists, do nothing.
- *
- * \todo change parameter type to Face&
*/
void
- removeNextHop(shared_ptr<Face> face);
+ removeNextHop(const Face& face);
private:
- /** @note This method is non-const because normal iterator is needed by callers.
+ /** \note This method is non-const because mutable iterators are needed by callers.
*/
NextHopList::iterator
- findNextHop(Face& face);
+ findNextHop(const Face& face);
- /// sorts the nexthop list
+ /** \brief sorts the nexthop list
+ */
void
sortNextHops();
diff --git a/daemon/table/fib-nexthop.cpp b/daemon/table/fib-nexthop.cpp
index 235fc79..e554362 100644
--- a/daemon/table/fib-nexthop.cpp
+++ b/daemon/table/fib-nexthop.cpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -28,29 +28,11 @@
namespace nfd {
namespace fib {
-NextHop::NextHop(shared_ptr<Face> face)
- : m_face(face)
+NextHop::NextHop(Face& face)
+ : m_face(&face)
, m_cost(0)
{
}
-const shared_ptr<Face>&
-NextHop::getFace() const
-{
- return m_face;
-}
-
-void
-NextHop::setCost(uint64_t cost)
-{
- m_cost = cost;
-}
-
-uint64_t
-NextHop::getCost() const
-{
- return m_cost;
-}
-
} // namespace fib
} // namespace nfd
diff --git a/daemon/table/fib-nexthop.hpp b/daemon/table/fib-nexthop.hpp
index 9f7ed93..c8c006e 100644
--- a/daemon/table/fib-nexthop.hpp
+++ b/daemon/table/fib-nexthop.hpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -39,19 +39,28 @@
{
public:
explicit
- NextHop(shared_ptr<Face> face);
+ NextHop(Face& face);
- const shared_ptr<Face>&
- getFace() const;
-
- void
- setCost(uint64_t cost);
+ Face&
+ getFace() const
+ {
+ return *m_face;
+ }
uint64_t
- getCost() const;
+ getCost() const
+ {
+ return m_cost;
+ }
+
+ void
+ setCost(uint64_t cost)
+ {
+ m_cost = cost;
+ }
private:
- shared_ptr<Face> m_face;
+ Face* m_face;
uint64_t m_cost;
};
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 946652e..2df3122 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -32,8 +32,9 @@
#include <type_traits>
namespace nfd {
+namespace fib {
-const shared_ptr<fib::Entry> Fib::s_emptyEntry = make_shared<fib::Entry>(Name());
+const unique_ptr<Entry> Fib::s_emptyEntry = make_unique<Entry>(Name());
// http://en.cppreference.com/w/cpp/concept/ForwardIterator
BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Fib::const_iterator>));
@@ -57,39 +58,38 @@
}
static inline bool
-predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry& entry)
+predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry& nte)
{
- return entry.getFibEntry() != nullptr;
+ return nte.getFibEntry() != nullptr;
}
-shared_ptr<fib::Entry>
+const Entry&
Fib::findLongestPrefixMatch(const Name& prefix) const
{
- shared_ptr<name_tree::Entry> nameTreeEntry =
+ shared_ptr<name_tree::Entry> nte =
m_nameTree.findLongestPrefixMatch(prefix, &predicate_NameTreeEntry_hasFibEntry);
- if (nameTreeEntry != nullptr) {
- return nameTreeEntry->getFibEntry();
+ if (nte != nullptr) {
+ return *nte->getFibEntry();
}
- return s_emptyEntry;
+ return *s_emptyEntry;
}
-shared_ptr<fib::Entry>
-Fib::findLongestPrefixMatch(shared_ptr<name_tree::Entry> nameTreeEntry) const
+const Entry&
+Fib::findLongestPrefixMatch(shared_ptr<name_tree::Entry> nte) const
{
- shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
+ Entry* entry = nte->getFibEntry();
if (entry != nullptr)
- return entry;
+ return *entry;
- nameTreeEntry = m_nameTree.findLongestPrefixMatch(nameTreeEntry,
- &predicate_NameTreeEntry_hasFibEntry);
- if (nameTreeEntry != nullptr) {
- return nameTreeEntry->getFibEntry();
+ nte = m_nameTree.findLongestPrefixMatch(nte, &predicate_NameTreeEntry_hasFibEntry);
+ if (nte != nullptr) {
+ return *nte->getFibEntry();
}
- return s_emptyEntry;
+ return *s_emptyEntry;
}
-shared_ptr<fib::Entry>
+const Entry&
Fib::findLongestPrefixMatch(const pit::Entry& pitEntry) const
{
shared_ptr<name_tree::Entry> nte = m_nameTree.findLongestPrefixMatch(pitEntry);
@@ -97,82 +97,81 @@
return findLongestPrefixMatch(nte);
}
-shared_ptr<fib::Entry>
+const Entry&
Fib::findLongestPrefixMatch(const measurements::Entry& measurementsEntry) const
{
- shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(measurementsEntry);
- BOOST_ASSERT(nameTreeEntry != nullptr);
-
- return findLongestPrefixMatch(nameTreeEntry);
+ shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(measurementsEntry);
+ BOOST_ASSERT(nte != nullptr);
+ return findLongestPrefixMatch(nte);
}
-shared_ptr<fib::Entry>
-Fib::findExactMatch(const Name& prefix) const
+Entry*
+Fib::findExactMatch(const Name& prefix)
{
- shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
- if (nameTreeEntry != nullptr)
- return nameTreeEntry->getFibEntry();
+ shared_ptr<name_tree::Entry> nte = m_nameTree.findExactMatch(prefix);
+ if (nte != nullptr)
+ return nte->getFibEntry();
return nullptr;
}
-std::pair<shared_ptr<fib::Entry>, bool>
+std::pair<Entry*, bool>
Fib::insert(const Name& prefix)
{
- shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(prefix);
- shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
- if (entry != nullptr)
+ shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(prefix);
+ Entry* entry = nte->getFibEntry();
+ if (entry != nullptr) {
return std::make_pair(entry, false);
+ }
- entry = make_shared<fib::Entry>(prefix);
- nameTreeEntry->setFibEntry(entry);
+ nte->setFibEntry(make_unique<Entry>(prefix));
++m_nItems;
- return std::make_pair(entry, true);
+ return std::make_pair(nte->getFibEntry(), true);
}
void
-Fib::erase(shared_ptr<name_tree::Entry> nameTreeEntry)
+Fib::erase(shared_ptr<name_tree::Entry> nte)
{
- nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
- m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
+ nte->setFibEntry(nullptr);
+ m_nameTree.eraseEntryIfEmpty(nte);
--m_nItems;
}
void
Fib::erase(const Name& prefix)
{
- shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
- if (nameTreeEntry != nullptr) {
- this->erase(nameTreeEntry);
+ shared_ptr<name_tree::Entry> nte = m_nameTree.findExactMatch(prefix);
+ if (nte != nullptr) {
+ this->erase(nte);
}
}
void
-Fib::erase(const fib::Entry& entry)
+Fib::erase(const Entry& entry)
{
- shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(entry);
- if (nameTreeEntry != nullptr) {
- this->erase(nameTreeEntry);
+ shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(entry);
+ if (nte != nullptr) {
+ this->erase(nte);
}
}
void
-Fib::removeNextHopFromAllEntries(shared_ptr<Face> face)
+Fib::removeNextHopFromAllEntries(const Face& face)
{
- std::list<fib::Entry*> toErase;
+ std::list<Entry*> toErase;
auto&& enumerable = m_nameTree.fullEnumerate(&predicate_NameTreeEntry_hasFibEntry);
for (const name_tree::Entry& nte : enumerable) {
- shared_ptr<fib::Entry> entry = nte.getFibEntry();
+ Entry* entry = nte.getFibEntry();
entry->removeNextHop(face);
if (!entry->hasNextHops()) {
- toErase.push_back(entry.get());
+ toErase.push_back(entry);
// entry needs to be erased, but we must wait until the enumeration ends,
// because otherwise NameTree iterator would be invalidated
}
}
- for (fib::Entry* entry : toErase) {
+ for (Entry* entry : toErase) {
this->erase(*entry);
}
}
@@ -183,4 +182,5 @@
return const_iterator(m_nameTree.fullEnumerate(&predicate_NameTreeEntry_hasFibEntry).begin());
}
+} // namespace fib
} // namespace nfd
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index bde7428..bfe6684 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,13 +33,14 @@
namespace measurements {
class Entry;
-}
+} // namespace measurements
namespace pit {
class Entry;
-}
+} // namespace pit
-/** \class Fib
- * \brief represents the FIB
+namespace fib {
+
+/** \brief represents the Forwarding Information Base (FIB)
*/
class Fib : noncopyable
{
@@ -53,44 +54,54 @@
size() const;
public: // lookup
- /// performs a longest prefix match
- shared_ptr<fib::Entry>
+ /** \brief performs a longest prefix match
+ */
+ const Entry&
findLongestPrefixMatch(const Name& prefix) const;
- /// performs a longest prefix match
- shared_ptr<fib::Entry>
+ /** \brief performs a longest prefix match
+ *
+ * This is equivalent to .findLongestPrefixMatch(pitEntry.getName())
+ */
+ const Entry&
findLongestPrefixMatch(const pit::Entry& pitEntry) const;
- /// performs a longest prefix match
- shared_ptr<fib::Entry>
+ /** \brief performs a longest prefix match
+ *
+ * This is equivalent to .findLongestPrefixMatch(measurementsEntry.getName())
+ */
+ const Entry&
findLongestPrefixMatch(const measurements::Entry& measurementsEntry) const;
- shared_ptr<fib::Entry>
- findExactMatch(const Name& prefix) const;
+ /** \brief performs an exact match lookup
+ */
+ Entry*
+ findExactMatch(const Name& prefix);
public: // mutation
/** \brief inserts a FIB entry for prefix
+ *
* If an entry for exact same prefix exists, that entry is returned.
- * \return{ the entry, and true for new entry, false for existing entry }
+ * \return the entry, and true for new entry or false for existing entry
*/
- std::pair<shared_ptr<fib::Entry>, bool>
+ std::pair<Entry*, bool>
insert(const Name& prefix);
void
erase(const Name& prefix);
void
- erase(const fib::Entry& entry);
+ erase(const Entry& entry);
- /** \brief removes the NextHop record for face in all entrites
+ /** \brief removes the NextHop record for face in all entries
*
- * This is usually invoked when face goes away.
+ * This is usually invoked when face is destroyed.
* Removing the last NextHop in a FIB entry will erase the FIB entry.
*
* \todo change parameter type to Face&
*/
void
- removeNextHopFromAllEntries(shared_ptr<Face> face);
+ removeNextHopFromAllEntries(const Face& face);
public: // enumeration
class const_iterator;
@@ -110,7 +121,7 @@
const_iterator
end() const;
- class const_iterator : public std::iterator<std::forward_iterator_tag, const fib::Entry>
+ class const_iterator : public std::iterator<std::forward_iterator_tag, const Entry>
{
public:
const_iterator() = default;
@@ -120,10 +131,10 @@
~const_iterator();
- const fib::Entry&
+ const Entry&
operator*() const;
- shared_ptr<fib::Entry>
+ const Entry*
operator->() const;
const_iterator&
@@ -143,8 +154,8 @@
};
private:
- shared_ptr<fib::Entry>
- findLongestPrefixMatch(shared_ptr<name_tree::Entry> nameTreeEntry) const;
+ const Entry&
+ findLongestPrefixMatch(shared_ptr<name_tree::Entry> nte) const;
void
erase(shared_ptr<name_tree::Entry> nameTreeEntry);
@@ -153,13 +164,12 @@
NameTree& m_nameTree;
size_t m_nItems;
- /** \brief The empty FIB entry.
+ /** \brief the empty FIB entry.
*
* This entry has no nexthops.
* It is returned by findLongestPrefixMatch if nothing is matched.
- * Returning empty entry instead of nullptr makes forwarding and strategy implementation easier.
*/
- static const shared_ptr<fib::Entry> s_emptyEntry;
+ static const unique_ptr<Entry> s_emptyEntry;
};
inline size_t
@@ -189,7 +199,7 @@
Fib::const_iterator
Fib::const_iterator::operator++(int)
{
- Fib::const_iterator temp(*this);
+ const_iterator temp(*this);
++(*this);
return temp;
}
@@ -201,30 +211,34 @@
return *this;
}
-inline const fib::Entry&
+inline const Entry&
Fib::const_iterator::operator*() const
{
- return *this->operator->();
+ return *m_nameTreeIterator->getFibEntry();
}
-inline shared_ptr<fib::Entry>
+inline const Entry*
Fib::const_iterator::operator->() const
{
return m_nameTreeIterator->getFibEntry();
}
inline bool
-Fib::const_iterator::operator==(const Fib::const_iterator& other) const
+Fib::const_iterator::operator==(const const_iterator& other) const
{
return m_nameTreeIterator == other.m_nameTreeIterator;
}
inline bool
-Fib::const_iterator::operator!=(const Fib::const_iterator& other) const
+Fib::const_iterator::operator!=(const const_iterator& other) const
{
return m_nameTreeIterator != other.m_nameTreeIterator;
}
+} // namespace fib
+
+using fib::Fib;
+
} // namespace nfd
#endif // NFD_DAEMON_TABLE_FIB_HPP
diff --git a/daemon/table/name-tree-entry.cpp b/daemon/table/name-tree-entry.cpp
index 889ed97..87853f2 100644
--- a/daemon/table/name-tree-entry.cpp
+++ b/daemon/table/name-tree-entry.cpp
@@ -65,14 +65,14 @@
}
void
-Entry::setFibEntry(shared_ptr<fib::Entry> fibEntry)
+Entry::setFibEntry(unique_ptr<fib::Entry> fibEntry)
{
BOOST_ASSERT(fibEntry == nullptr || fibEntry->m_nameTreeEntry.expired());
if (m_fibEntry != nullptr) {
m_fibEntry->m_nameTreeEntry.reset();
}
- m_fibEntry = fibEntry;
+ m_fibEntry = std::move(fibEntry);
if (m_fibEntry != nullptr) {
m_fibEntry->m_nameTreeEntry = this->shared_from_this();
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index 378d285..c650587 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -96,9 +96,9 @@
public: // attached table entries
void
- setFibEntry(shared_ptr<fib::Entry> fibEntry);
+ setFibEntry(unique_ptr<fib::Entry> fibEntry);
- shared_ptr<fib::Entry>
+ fib::Entry*
getFibEntry() const;
void
@@ -133,7 +133,7 @@
Name m_prefix;
shared_ptr<Entry> m_parent; // Pointing to the parent entry.
std::vector<shared_ptr<Entry> > m_children; // Children pointers.
- shared_ptr<fib::Entry> m_fibEntry;
+ unique_ptr<fib::Entry> m_fibEntry;
std::vector<shared_ptr<pit::Entry> > m_pitEntries;
shared_ptr<measurements::Entry> m_measurementsEntry;
shared_ptr<strategy_choice::Entry> m_strategyChoiceEntry;
@@ -187,10 +187,10 @@
return !m_children.empty();
}
-inline shared_ptr<fib::Entry>
+inline fib::Entry*
Entry::getFibEntry() const
{
- return m_fibEntry;
+ return m_fibEntry.get();
}
inline bool
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index 87d4154..796e701 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -244,7 +244,7 @@
NameTree::lookup(const fib::Entry& fibEntry) const
{
shared_ptr<name_tree::Entry> nte = this->getEntry(fibEntry);
- BOOST_ASSERT(nte == nullptr || nte->getFibEntry().get() == &fibEntry);
+ BOOST_ASSERT(nte == nullptr || nte->getFibEntry() == &fibEntry);
return nte;
}