NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
fib-enumeration-publisher.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#include "
fib-enumeration-publisher.hpp
"
26
#include "
core/logger.hpp
"
27
#include "
table/fib.hpp
"
28
29
#include <ndn-cxx/management/nfd-fib-entry.hpp>
30
31
namespace
nfd
{
32
33
NFD_LOG_INIT
(
"FibEnumerationPublisher"
);
34
35
FibEnumerationPublisher::FibEnumerationPublisher
(
const
Fib
& fib,
36
AppFace
& face,
37
const
Name
& prefix,
38
ndn::KeyChain
& keyChain)
39
:
SegmentPublisher
(face, prefix, keyChain)
40
, m_fib(fib)
41
{
42
}
43
44
FibEnumerationPublisher::~FibEnumerationPublisher
()
45
{
46
}
47
48
size_t
49
FibEnumerationPublisher::generate
(
ndn::EncodingBuffer
& outBuffer)
50
{
51
size_t
totalLength = 0;
52
54
for
(
Fib::const_iterator
i = m_fib.
begin
(); i != m_fib.
end
(); ++i)
55
{
56
const
fib::Entry
& entry = *i;
57
const
Name
& prefix = entry.
getPrefix
();
58
size_t
fibEntryLength = 0;
59
60
ndn::nfd::FibEntry
tlvEntry;
61
const
fib::NextHopList
& nextHops = entry.
getNextHops
();
62
63
for
(fib::NextHopList::const_iterator j = nextHops.begin();
64
j != nextHops.end();
65
++j)
66
{
67
const
fib::NextHop
& next = *j;
68
ndn::nfd::NextHopRecord
nextHopRecord;
69
nextHopRecord.
setFaceId
(next.
getFace
()->getId());
70
nextHopRecord.
setCost
(next.
getCost
());
71
72
tlvEntry.
addNextHopRecord
(nextHopRecord);
73
}
74
75
tlvEntry.
setPrefix
(prefix);
76
fibEntryLength += tlvEntry.
wireEncode
(outBuffer);
77
78
NFD_LOG_DEBUG
(
"generate: fib entry length = "
<< fibEntryLength);
79
80
totalLength += fibEntryLength;
81
}
82
83
NFD_LOG_DEBUG
(
"generate: Total length = "
<< totalLength);
84
return
totalLength;
85
}
86
87
}
// namespace nfd
nfd::SegmentPublisher
provides a publisher of Status Dataset or other segmented octet stream
Definition:
segment-publisher.hpp:40
nfd::AppFace
Definition:
app-face.hpp:37
nfd::Fib::begin
const_iterator begin() const
returns an iterator pointing to the first FIB entry
Definition:
fib.cpp:180
fib-enumeration-publisher.hpp
nfd::fib::Entry::getPrefix
const Name & getPrefix() const
Definition:
fib-entry.hpp:115
NFD_LOG_DEBUG
#define NFD_LOG_DEBUG(expression)
Definition:
logger.hpp:36
nfd::fib::NextHop::getCost
uint64_t getCost() const
Definition:
fib-nexthop.cpp:50
nfd::Fib::end
const_iterator end() const
returns an iterator referring to the past-the-end FIB entry
Definition:
fib.hpp:172
ndn::nfd::NextHopRecord::setFaceId
NextHopRecord & setFaceId(uint64_t faceId)
Definition:
nfd-fib-entry.cpp:59
ndn::nfd::FibEntry::setPrefix
FibEntry & setPrefix(const Name &prefix)
Definition:
nfd-fib-entry.cpp:170
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:53
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
nfd::FibEnumerationPublisher::~FibEnumerationPublisher
virtual ~FibEnumerationPublisher()
Definition:
fib-enumeration-publisher.cpp:44
nfd::Fib
represents the FIB
Definition:
fib.hpp:44
fib.hpp
ndn::nfd::NextHopRecord
Definition:
nfd-fib-entry.hpp:34
logger.hpp
ndn::nfd::FibEntry::wireEncode
size_t wireEncode(EncodingImpl< TAG > &block) const
Definition:
nfd-fib-entry.cpp:187
ndn::encoding::EncodingBuffer
EncodingImpl< EncoderTag > EncodingBuffer
Definition:
encoding-buffer-fwd.hpp:45
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::FibEnumerationPublisher::generate
virtual size_t generate(ndn::EncodingBuffer &outBuffer)
In a derived class, write the octets into outBuffer.
Definition:
fib-enumeration-publisher.cpp:49
nfd::fib::NextHopList
std::vector< fib::NextHop > NextHopList
Definition:
fib-entry.hpp:48
ndn::nfd::NextHopRecord::setCost
NextHopRecord & setCost(uint64_t cost)
Definition:
nfd-fib-entry.cpp:67
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::fib::NextHop::getFace
const shared_ptr< Face > & getFace() const
Definition:
fib-nexthop.cpp:38
ndn::nfd::FibEntry::addNextHopRecord
FibEntry & addNextHopRecord(const NextHopRecord &nextHopRecord)
Definition:
nfd-fib-entry.cpp:178
nfd::Fib::const_iterator
Definition:
fib.hpp:113
ndn::nfd::FibEntry
Definition:
nfd-fib-entry.hpp:89
NFD_LOG_INIT
#define NFD_LOG_INIT(name)
Definition:
logger.hpp:33
nfd::fib::Entry::getNextHops
const NextHopList & getNextHops() const
Definition:
fib-entry.hpp:121
nfd::FibEnumerationPublisher::FibEnumerationPublisher
FibEnumerationPublisher(const Fib &fib, AppFace &face, const Name &prefix, ndn::KeyChain &keyChain)
Definition:
fib-enumeration-publisher.cpp:35
nfd::fib::NextHop
represents a nexthop record in FIB entry
Definition:
fib-nexthop.hpp:38
ndnSIM
NFD
daemon
mgmt
fib-enumeration-publisher.cpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14