NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
propagated-entry.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
core/logger.hpp
"
27
#include "
propagated-entry.hpp
"
28
29
namespace
nfd
{
30
namespace
rib {
31
32
void
33
operator<<
(std::ostream& out,
PropagationStatus
status)
34
{
35
switch
(status) {
36
case
PropagationStatus::NEW
:
37
out <<
"NEW"
;
38
break
;
39
case
PropagationStatus::PROPAGATING
:
40
out <<
"PROPAGATING"
;
41
break
;
42
case
PropagationStatus::PROPAGATED
:
43
out <<
"PROPAGATED"
;
44
break
;
45
case
PropagationStatus::PROPAGATE_FAIL
:
46
out <<
"PROPAGATE_FAIL"
;
47
break
;
48
default
:
49
out <<
"undefined status"
;
50
break
;
51
}
52
}
53
54
PropagatedEntry::PropagatedEntry
()
55
: m_propagationStatus(
PropagationStatus
::NEW)
56
{
57
}
58
59
PropagatedEntry::PropagatedEntry
(
const
PropagatedEntry
& other)
60
: m_signingIdentity(other.m_signingIdentity)
61
, m_propagationStatus(other.m_propagationStatus)
62
{
63
BOOST_ASSERT(!other.
isPropagated
() && !other.
isPropagateFail
());
64
}
65
66
PropagatedEntry
&
67
PropagatedEntry::setSigningIdentity
(
const
Name
& identity)
68
{
69
m_signingIdentity = identity;
70
return
*
this
;
71
}
72
73
const
Name
&
74
PropagatedEntry::getSigningIdentity
()
const
75
{
76
return
m_signingIdentity;
77
}
78
79
void
80
PropagatedEntry::startPropagation
()
81
{
82
m_propagationStatus =
PropagationStatus::PROPAGATING
;
83
}
84
85
void
86
PropagatedEntry::succeed
(
const
scheduler::EventId
& event)
87
{
88
m_propagationStatus =
PropagationStatus::PROPAGATED
;
89
m_rePropagateEvent = event;
90
}
91
92
void
93
PropagatedEntry::fail
(
const
scheduler::EventId
& event)
94
{
95
m_propagationStatus =
PropagationStatus::PROPAGATE_FAIL
;
96
m_rePropagateEvent = event;
97
}
98
99
void
100
PropagatedEntry::initialize
()
101
{
102
m_propagationStatus =
PropagationStatus::NEW
;
103
m_rePropagateEvent.
cancel
();
104
}
105
106
bool
107
PropagatedEntry::isNew
()
const
108
{
109
return
PropagationStatus::NEW
== m_propagationStatus;
110
}
111
112
bool
113
PropagatedEntry::isPropagating
()
const
114
{
115
return
PropagationStatus::PROPAGATING
== m_propagationStatus;
116
}
117
118
bool
119
PropagatedEntry::isPropagated
()
const
120
{
121
return
PropagationStatus::PROPAGATED
== m_propagationStatus;
122
}
123
124
bool
125
PropagatedEntry::isPropagateFail
()
const
126
{
127
return
PropagationStatus::PROPAGATE_FAIL
== m_propagationStatus;
128
}
129
130
}
// namespace rib
131
}
// namespace nfd
nfd::rib::PropagatedEntry::fail
void fail(const scheduler::EventId &event)
switch the propagation status to PROPAGATE_FAIL, and then set the rePropagateEvent to event for retry...
Definition:
propagated-entry.cpp:93
nfd::scheduler::EventId
Opaque handle for a scheduled event.
nfd::scheduler::ScopedEventId::cancel
void cancel()
Cancels the event manually.
Definition:
scheduler.cpp:96
nfd::rib::PropagationStatus
PropagationStatus
Definition:
propagated-entry.hpp:34
nfd::rib::operator<<
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition:
fib-update.hpp:74
nfd::rib::PropagatedEntry::setSigningIdentity
PropagatedEntry & setSigningIdentity(const Name &identity)
set the signing identity
Definition:
propagated-entry.cpp:67
nfd::rib::PropagatedEntry::PropagatedEntry
PropagatedEntry()
Definition:
propagated-entry.cpp:54
nfd::rib::PropagatedEntry::getSigningIdentity
const Name & getSigningIdentity() const
get the signing identity
Definition:
propagated-entry.cpp:74
nfd::rib::PropagatedEntry::initialize
void initialize()
cancel the events of re-sending propagation commands.
Definition:
propagated-entry.cpp:100
nfd::rib::PropagatedEntry::isPropagateFail
bool isPropagateFail() const
check whether this entry has failed in propagating.
Definition:
propagated-entry.cpp:125
nfd::rib::PropagatedEntry::isPropagating
bool isPropagating() const
check whether this entry is being propagated.
Definition:
propagated-entry.cpp:113
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
propagated-entry.hpp
nfd::rib::PropagatedEntry::isPropagated
bool isPropagated() const
check whether this entry has been successfully propagated.
Definition:
propagated-entry.cpp:119
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
nfd::rib::PropagationStatus::PROPAGATING
is being propagated
nfd::rib::PropagationStatus::PROPAGATE_FAIL
has failed in propagation
nfd::rib::PropagatedEntry::isNew
bool isNew() const
check whether this entry is a new entry.
Definition:
propagated-entry.cpp:107
nfd::rib::PropagatedEntry::succeed
void succeed(const scheduler::EventId &event)
switch the propagation status to PROPAGATED, and set the rePropagateEvent to event for refresh...
Definition:
propagated-entry.cpp:86
nfd::rib::PropagationStatus::PROPAGATED
has been propagated successfully
nfd::rib::PropagatedEntry
represents an entry for prefix propagation.
Definition:
propagated-entry.hpp:56
nfd::rib::PropagatedEntry::startPropagation
void startPropagation()
switch the propagation status to PROPAGATING.
Definition:
propagated-entry.cpp:80
nfd::rib::PropagationStatus::NEW
initial status
logger.hpp
ndnSIM
NFD
rib
propagated-entry.cpp
Generated on Tue Aug 7 2018 16:19:18 for ndnSIM by
1.8.14