NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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) {
37  out << "NEW";
38  break;
40  out << "PROPAGATING";
41  break;
43  out << "PROPAGATED";
44  break;
46  out << "PROPAGATE_FAIL";
47  break;
48  default:
49  out << "undefined status";
50  break;
51  }
52 }
53 
55  : m_propagationStatus(PropagationStatus::NEW)
56 {
57 }
58 
60  : m_signingIdentity(other.m_signingIdentity)
61  , m_propagationStatus(other.m_propagationStatus)
62 {
63  BOOST_ASSERT(!other.isPropagated() && !other.isPropagateFail());
64 }
65 
68 {
69  m_signingIdentity = identity;
70  return *this;
71 }
72 
73 const Name&
75 {
76  return m_signingIdentity;
77 }
78 
79 void
81 {
82  m_propagationStatus = PropagationStatus::PROPAGATING;
83 }
84 
85 void
87 {
88  m_propagationStatus = PropagationStatus::PROPAGATED;
89  m_rePropagateEvent = event;
90 }
91 
92 void
94 {
95  m_propagationStatus = PropagationStatus::PROPAGATE_FAIL;
96  m_rePropagateEvent = event;
97 }
98 
99 void
101 {
102  m_propagationStatus = PropagationStatus::NEW;
103  m_rePropagateEvent.cancel();
104 }
105 
106 bool
108 {
109  return PropagationStatus::NEW == m_propagationStatus;
110 }
111 
112 bool
114 {
115  return PropagationStatus::PROPAGATING == m_propagationStatus;
116 }
117 
118 bool
120 {
121  return PropagationStatus::PROPAGATED == m_propagationStatus;
122 }
123 
124 bool
126 {
127  return PropagationStatus::PROPAGATE_FAIL == m_propagationStatus;
128 }
129 
130 } // namespace rib
131 } // namespace nfd
void fail(const scheduler::EventId &event)
switch the propagation status to PROPAGATE_FAIL, and then set the rePropagateEvent to event for retry...
void cancel()
cancels the event manually
Definition: scheduler.cpp:95
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition: fib-update.hpp:74
PropagatedEntry & setSigningIdentity(const Name &identity)
set the signing identity
const Name & getSigningIdentity() const
get the signing identity
void initialize()
cancel the events of re-sending propagation commands.
bool isPropagateFail() const
check whether this entry has failed in propagating.
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
bool isPropagating() const
check whether this entry is being propagated.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
bool isPropagated() const
check whether this entry has been successfully propagated.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
bool isNew() const
check whether this entry is a new entry.
void succeed(const scheduler::EventId &event)
switch the propagation status to PROPAGATED, and set the rePropagateEvent to event for refresh...
has been propagated successfully
represents an entry for prefix propagation.
void startPropagation()
switch the propagation status to PROPAGATING.