NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
client-control-strategy.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
client-control-strategy.hpp
"
27
#include "
core/logger.hpp
"
28
29
namespace
nfd
{
30
namespace
fw {
31
32
NFD_LOG_INIT
(
"ClientControlStrategy"
);
33
34
const
Name
35
ClientControlStrategy::STRATEGY_NAME
(
"ndn:/localhost/nfd/strategy/client-control/%FD%01"
);
36
NFD_REGISTER_STRATEGY
(
ClientControlStrategy
);
37
38
ClientControlStrategy::ClientControlStrategy
(
Forwarder
& forwarder,
const
Name
&
name
)
39
:
BestRouteStrategy
(forwarder, name)
40
{
41
}
42
43
ClientControlStrategy::~ClientControlStrategy
()
44
{
45
}
46
47
void
48
ClientControlStrategy::afterReceiveInterest
(
const
Face
& inFace,
49
const
Interest
& interest,
50
shared_ptr<fib::Entry> fibEntry,
51
shared_ptr<pit::Entry> pitEntry)
52
{
53
// Strategy needn't check whether LocalControlHeader-NextHopFaceId is enabled.
54
// LocalFace does this check.
55
if
(!interest.
getLocalControlHeader
().
hasNextHopFaceId
()) {
56
this->
BestRouteStrategy::afterReceiveInterest
(inFace, interest, fibEntry, pitEntry);
57
return
;
58
}
59
60
FaceId
outFaceId =
static_cast<
FaceId
>
(interest.
getNextHopFaceId
());
61
shared_ptr<Face> outFace = this->
getFace
(outFaceId);
62
if
(!static_cast<bool>(outFace)) {
63
// If outFace doesn't exist, it's better to reject the Interest
64
// than to use BestRouteStrategy.
65
NFD_LOG_WARN
(
"Interest "
<< interest.
getName
() <<
66
" NextHopFaceId="
<< outFaceId <<
" non-existent face"
);
67
this->
rejectPendingInterest
(pitEntry);
68
return
;
69
}
70
71
this->
sendInterest
(pitEntry, outFace);
72
}
73
74
}
// namespace fw
75
}
// namespace nfd
nfd::fw::ClientControlStrategy::ClientControlStrategy
ClientControlStrategy(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
Definition:
client-control-strategy.cpp:38
nfd::fw::ClientControlStrategy::afterReceiveInterest
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Interest is received
Definition:
client-control-strategy.cpp:48
ndn::Interest::getName
const Name & getName() const
Definition:
interest.hpp:216
ndn::nfd::LocalControlHeader::hasNextHopFaceId
bool hasNextHopFaceId() const
Definition:
nfd-local-control-header.hpp:156
nfd::fw::ClientControlStrategy
a forwarding strategy that forwards Interests according to NextHopFaceId field in LocalControlHeader ...
Definition:
client-control-strategy.hpp:37
nfd::Forwarder
main class of NFD
Definition:
forwarder.hpp:54
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
logger.hpp
nfd::Face
represents a face
Definition:
face.hpp:57
nfd::fw::Strategy::getFace
shared_ptr< Face > getFace(FaceId id)
Definition:
strategy.hpp:181
ndn::Interest::getNextHopFaceId
uint64_t getNextHopFaceId() const
Definition:
interest.hpp:304
NFD_LOG_WARN
#define NFD_LOG_WARN(expression)
Definition:
logger.hpp:39
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::fw::BestRouteStrategy
Best Route strategy version 1.
Definition:
best-route-strategy.hpp:45
nfd::fw::NFD_REGISTER_STRATEGY
NFD_REGISTER_STRATEGY(AccessStrategy)
FaceId
identifies a face
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::fw::Strategy::rejectPendingInterest
void rejectPendingInterest(shared_ptr< pit::Entry > pitEntry)
decide that a pending Interest cannot be forwarded
Definition:
strategy.hpp:169
nfd::fw::ClientControlStrategy::STRATEGY_NAME
static const Name STRATEGY_NAME
Definition:
client-control-strategy.hpp:52
NFD_LOG_INIT
#define NFD_LOG_INIT(name)
Definition:
logger.hpp:33
nfd::fw::Strategy::sendInterest
void sendInterest(shared_ptr< pit::Entry > pitEntry, shared_ptr< Face > outFace, bool wantNewNonce=false)
send Interest to outFace
Definition:
strategy.hpp:161
client-control-strategy.hpp
ndn::name
Definition:
name-component.cpp:37
nfd::fw::ClientControlStrategy::~ClientControlStrategy
virtual ~ClientControlStrategy()
Definition:
client-control-strategy.cpp:43
nfd::fw::BestRouteStrategy::afterReceiveInterest
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Interest is received
Definition:
best-route-strategy.cpp:51
ndn::Interest::getLocalControlHeader
nfd::LocalControlHeader & getLocalControlHeader()
Definition:
interest.hpp:278
ndnSIM
NFD
daemon
fw
client-control-strategy.cpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11