NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-query-status-publisher.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
face-query-status-publisher.hpp
"
27
28
#include <boost/range/adaptor/reversed.hpp>
29
#include <ndn-cxx/management/nfd-face-status.hpp>
30
31
namespace
nfd
{
32
33
FaceQueryStatusPublisher::FaceQueryStatusPublisher
(
const
FaceTable
& faceTable,
34
AppFace
& face,
35
const
Name
& prefix,
36
const
ndn::nfd::FaceQueryFilter
& filter,
37
ndn::KeyChain
& keyChain)
38
:
SegmentPublisher
(face, prefix, keyChain)
39
, m_faceTable(faceTable)
40
, m_faceFilter(filter)
41
{
42
}
43
44
FaceQueryStatusPublisher::~FaceQueryStatusPublisher
()
45
{
46
}
47
48
bool
49
FaceQueryStatusPublisher::doesMatchFilter
(
const
shared_ptr<Face>& face)
50
{
51
if
(m_faceFilter.
hasFaceId
() &&
52
m_faceFilter.
getFaceId
() !=
static_cast<
uint64_t
>
(face->getId())) {
53
return
false
;
54
}
55
56
if
(m_faceFilter.
hasUriScheme
() &&
57
(m_faceFilter.
getUriScheme
() != face->getRemoteUri().getScheme() ||
58
m_faceFilter.
getUriScheme
() != face->getLocalUri().getScheme())) {
59
return
false
;
60
}
61
62
if
(m_faceFilter.
hasRemoteUri
() &&
63
m_faceFilter.
getRemoteUri
() != face->getRemoteUri().toString()) {
64
return
false
;
65
}
66
67
if
(m_faceFilter.
hasLocalUri
() && m_faceFilter.
getLocalUri
() != face->getLocalUri().toString()) {
68
return
false
;
69
}
70
71
if
(m_faceFilter.
hasFaceScope
() &&
72
(m_faceFilter.
getFaceScope
() ==
ndn::nfd::FACE_SCOPE_LOCAL
) != face->isLocal()) {
73
return
false
;
74
}
75
76
if
(m_faceFilter.
hasFacePersistency
() &&
77
m_faceFilter.
getFacePersistency
() != face->getPersistency()) {
78
return
false
;
79
}
80
81
if
(m_faceFilter.
hasLinkType
() &&
82
(m_faceFilter.
getLinkType
() ==
ndn::nfd::LINK_TYPE_MULTI_ACCESS
) != face->isMultiAccess()) {
83
return
false
;
84
}
85
86
return
true
;
87
}
88
89
size_t
90
FaceQueryStatusPublisher::generate
(
ndn::EncodingBuffer
& outBuffer)
91
{
92
size_t
totalLength = 0;
93
94
for
(
const
shared_ptr<Face>& face : m_faceTable | boost::adaptors::reversed) {
95
if
(
doesMatchFilter
(face)) {
96
ndn::nfd::FaceStatus
status = face->getFaceStatus();
97
totalLength += status.
wireEncode
(outBuffer);
98
}
99
}
100
return
totalLength;
101
}
102
103
}
// namespace nfd
nfd::SegmentPublisher
provides a publisher of Status Dataset or other segmented octet stream
Definition:
segment-publisher.hpp:40
ndn::nfd::FaceQueryFilter::getLinkType
LinkType getLinkType() const
Definition:
nfd-face-query-filter.hpp:193
ndn::nfd::FaceQueryFilter::hasFaceScope
bool hasFaceScope() const
Definition:
nfd-face-query-filter.hpp:149
nfd::AppFace
Definition:
app-face.hpp:37
nfd::FaceQueryStatusPublisher::FaceQueryStatusPublisher
FaceQueryStatusPublisher(const FaceTable &faceTable, AppFace &face, const Name &prefix, const ndn::nfd::FaceQueryFilter &filter, ndn::KeyChain &keyChain)
Definition:
face-query-status-publisher.cpp:33
ndn::nfd::FaceQueryFilter::getLocalUri
const std::string & getLocalUri() const
Definition:
nfd-face-query-filter.hpp:136
ndn::nfd::FaceQueryFilter::hasFaceId
bool hasFaceId() const
Definition:
nfd-face-query-filter.hpp:73
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
ndn::nfd::FaceQueryFilter::getFaceScope
FaceScope getFaceScope() const
Definition:
nfd-face-query-filter.hpp:155
ndn::nfd::LINK_TYPE_MULTI_ACCESS
link is multi-access
Definition:
nfd-constants.hpp:71
ndn::nfd::FaceQueryFilter::getRemoteUri
const std::string & getRemoteUri() const
Definition:
nfd-face-query-filter.hpp:117
face-query-status-publisher.hpp
ndn::nfd::FaceQueryFilter::hasRemoteUri
bool hasRemoteUri() const
Definition:
nfd-face-query-filter.hpp:111
ndn::nfd::FACE_SCOPE_LOCAL
face is local
Definition:
nfd-constants.hpp:40
ndn::nfd::FaceQueryFilter::hasUriScheme
bool hasUriScheme() const
Definition:
nfd-face-query-filter.hpp:92
nfd::FaceTable
container of all Faces
Definition:
face-table.hpp:38
ndn::encoding::EncodingBuffer
EncodingImpl< EncoderTag > EncodingBuffer
Definition:
encoding-buffer-fwd.hpp:45
nfd::FaceQueryStatusPublisher::~FaceQueryStatusPublisher
virtual ~FaceQueryStatusPublisher()
Definition:
face-query-status-publisher.cpp:44
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::FaceQueryFilter::getFaceId
uint64_t getFaceId() const
Definition:
nfd-face-query-filter.hpp:79
ndn::nfd::FaceQueryFilter::hasLinkType
bool hasLinkType() const
Definition:
nfd-face-query-filter.hpp:187
ndn::nfd::FaceStatus::wireEncode
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend FaceStatus to the encoder
Definition:
nfd-face-status.cpp:54
ndn::nfd::FaceStatus
represents Face status
Definition:
nfd-face-status.hpp:37
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
ndn::nfd::FaceQueryFilter::hasLocalUri
bool hasLocalUri() const
Definition:
nfd-face-query-filter.hpp:130
ndn::nfd::FaceQueryFilter
represents Face Query Filter
Definition:
nfd-face-query-filter.hpp:36
nfd::FaceQueryStatusPublisher::generate
virtual size_t generate(ndn::EncodingBuffer &outBuffer)
In a derived class, write the octets into outBuffer.
Definition:
face-query-status-publisher.cpp:90
ndn::nfd::FaceQueryFilter::getUriScheme
const std::string & getUriScheme() const
Definition:
nfd-face-query-filter.hpp:98
ndn::nfd::FaceQueryFilter::getFacePersistency
FacePersistency getFacePersistency() const
Definition:
nfd-face-query-filter.hpp:174
ndn::nfd::FaceQueryFilter::hasFacePersistency
bool hasFacePersistency() const
Definition:
nfd-face-query-filter.hpp:168
nfd::FaceQueryStatusPublisher::doesMatchFilter
bool doesMatchFilter(const shared_ptr< Face > &face)
Definition:
face-query-status-publisher.cpp:49
ndnSIM
NFD
daemon
mgmt
face-query-status-publisher.cpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14