NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
route.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2019, Regents of the University of California,
4
* Arizona Board of Regents,
5
* Colorado State University,
6
* University Pierre & Marie Curie, Sorbonne University,
7
* Washington University in St. Louis,
8
* Beijing Institute of Technology,
9
* The University of Memphis.
10
*
11
* This file is part of NFD (Named Data Networking Forwarding Daemon).
12
* See AUTHORS.md for complete list of NFD authors and contributors.
13
*
14
* NFD is free software: you can redistribute it and/or modify it under the terms
15
* of the GNU General Public License as published by the Free Software Foundation,
16
* either version 3 of the License, or (at your option) any later version.
17
*
18
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
* PURPOSE. See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License along with
23
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
26
#ifndef NFD_RIB_ROUTE_HPP
27
#define NFD_RIB_ROUTE_HPP
28
29
#include "
core/common.hpp
"
30
31
#include <
ndn-cxx/encoding/nfd-constants.hpp
>
32
#include <
ndn-cxx/mgmt/nfd/route-flags-traits.hpp
>
33
#include <
ndn-cxx/prefix-announcement.hpp
>
34
#include <
ndn-cxx/util/scheduler.hpp
>
35
36
#include <type_traits>
37
38
namespace
nfd
{
39
namespace
rib {
40
43
class
Route
:
public
ndn::nfd::RouteFlagsTraits
<Route>
44
{
45
public
:
48
Route
() =
default
;
49
54
Route
(
const
ndn::PrefixAnnouncement
& ann, uint64_t
faceId
);
55
56
const
ndn::util::scheduler::EventId
&
57
getExpirationEvent
()
const
58
{
59
return
m_expirationEvent;
60
}
61
62
void
63
setExpirationEvent
(
const
ndn::util::scheduler::EventId
& eid)
64
{
65
m_expirationEvent = eid;
66
}
67
68
void
69
cancelExpirationEvent
()
70
{
71
m_expirationEvent.
cancel
();
72
}
73
74
std::underlying_type<ndn::nfd::RouteFlags>::type
75
getFlags
()
const
76
{
77
return
flags
;
78
}
79
80
public
:
81
uint64_t
faceId
= 0;
82
ndn::nfd::RouteOrigin
origin
=
ndn::nfd::ROUTE_ORIGIN_APP
;
83
uint64_t
cost
= 0;
84
std::underlying_type<ndn::nfd::RouteFlags>::type
flags
=
ndn::nfd::ROUTE_FLAGS_NONE
;
85
optional<time::steady_clock::TimePoint>
expires
;
86
91
optional<ndn::PrefixAnnouncement>
announcement
;
92
101
time::steady_clock::TimePoint
annExpires
;
102
103
private
:
104
ndn::util::scheduler::EventId
m_expirationEvent;
105
};
106
107
bool
108
operator==
(
const
Route
& lhs,
const
Route
& rhs);
109
110
inline
bool
111
operator!=
(
const
Route
& lhs,
const
Route
& rhs)
112
{
113
return
!(lhs == rhs);
114
}
115
116
inline
bool
117
compareFaceIdAndOrigin
(
const
Route
& lhs,
const
Route
& rhs)
118
{
119
return
(lhs.
faceId
== rhs.
faceId
&& lhs.
origin
== rhs.
origin
);
120
}
121
122
inline
bool
123
compareFaceId
(
const
Route
& route,
const
uint64_t faceId)
124
{
125
return
(route.
faceId
== faceId);
126
}
127
128
std::ostream&
129
operator<<
(std::ostream& os,
const
Route
& route);
130
131
}
// namespace rib
132
}
// namespace nfd
133
134
#endif // NFD_RIB_ROUTE_HPP
ndn::time::steady_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:225
nfd::rib::operator==
bool operator==(const Route &lhs, const Route &rhs)
Definition:
route.cpp:63
ndn::nfd::RouteFlagsTraits
defines getters for each route inheritance flag
Definition:
route-flags-traits.hpp:38
nfd::rib::Route::getFlags
std::underlying_type< ndn::nfd::RouteFlags >::type getFlags() const
Definition:
route.hpp:75
nfd::rib::operator<<
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition:
fib-update.hpp:74
ndn::nfd::ROUTE_ORIGIN_APP
Definition:
nfd-constants.hpp:101
nfd::rib::Route::Route
Route()=default
default constructor
nfd::rib::Route::flags
std::underlying_type< ndn::nfd::RouteFlags >::type flags
Definition:
route.hpp:84
route-flags-traits.hpp
nfd::rib::Route::cost
uint64_t cost
Definition:
route.hpp:83
nfd::rib::Route::faceId
uint64_t faceId
Definition:
route.hpp:81
prefix-announcement.hpp
nfd::rib::compareFaceIdAndOrigin
bool compareFaceIdAndOrigin(const Route &lhs, const Route &rhs)
Definition:
route.hpp:117
nfd::rib::Route::expires
optional< time::steady_clock::TimePoint > expires
Definition:
route.hpp:85
nfd::rib::operator!=
bool operator!=(const Route &lhs, const Route &rhs)
Definition:
route.hpp:111
common.hpp
ndn::nfd::ROUTE_FLAGS_NONE
Definition:
nfd-constants.hpp:124
ndn::PrefixAnnouncement
A prefix announcement object that represents an application's intent of registering a prefix toward i...
Definition:
prefix-announcement.hpp:33
nfd-constants.hpp
nfd::rib::Route::annExpires
time::steady_clock::TimePoint annExpires
Expiration time of the prefix announcement.
Definition:
route.hpp:101
nfd::rib::Route::announcement
optional< ndn::PrefixAnnouncement > announcement
The prefix announcement that caused the creation of this route.
Definition:
route.hpp:91
nfd::rib::Route::origin
ndn::nfd::RouteOrigin origin
Definition:
route.hpp:82
nfd::rib::Route::getExpirationEvent
const ndn::util::scheduler::EventId & getExpirationEvent() const
Definition:
route.hpp:57
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::rib::Route
represents a route for a name prefix
Definition:
route.hpp:43
nfd::rib::Route::cancelExpirationEvent
void cancelExpirationEvent()
Definition:
route.hpp:69
nfd::rib::Route::setExpirationEvent
void setExpirationEvent(const ndn::util::scheduler::EventId &eid)
Definition:
route.hpp:63
scheduler.hpp
nfd::rib::compareFaceId
bool compareFaceId(const Route &route, const uint64_t faceId)
Definition:
route.hpp:123
ndn::nfd::RouteOrigin
RouteOrigin
Definition:
nfd-constants.hpp:99
ndn::util::scheduler::EventId
A handle of scheduled event.
Definition:
scheduler.hpp:55
ndn::detail::CancelHandle::cancel
void cancel() const
Cancel the operation.
Definition:
cancel-handle.cpp:33
ndn::tlv::nfd::Route
Definition:
tlv-nfd.hpp:103
ndnSIM
NFD
rib
route.hpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15