NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
fib-entry.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2021 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
23
#define NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
24
25
#include "
ndn-cxx/name.hpp
"
26
#include "
ndn-cxx/encoding/block.hpp
"
27
28
namespace
ndn
{
29
namespace
nfd
{
30
34
class
NextHopRecord
35
{
36
public
:
37
class
Error
:
public
tlv::Error
38
{
39
public
:
40
using
tlv::Error::Error
;
41
};
42
43
NextHopRecord
();
44
45
explicit
46
NextHopRecord
(
const
Block
& block);
47
48
uint64_t
49
getFaceId
()
const
50
{
51
return
m_faceId;
52
}
53
54
NextHopRecord
&
55
setFaceId
(uint64_t faceId);
56
57
uint64_t
58
getCost
()
const
59
{
60
return
m_cost;
61
}
62
63
NextHopRecord
&
64
setCost
(uint64_t cost);
65
66
template
<encoding::Tag TAG>
67
size_t
68
wireEncode
(
EncodingImpl<TAG>
& block)
const
;
69
70
const
Block
&
71
wireEncode
()
const
;
72
73
void
74
wireDecode
(
const
Block
& block);
75
76
private
:
77
uint64_t m_faceId;
78
uint64_t m_cost;
79
80
mutable
Block
m_wire;
81
};
82
83
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
NextHopRecord
);
84
85
bool
86
operator==
(
const
NextHopRecord
& a,
const
NextHopRecord
& b);
87
88
inline
bool
89
operator!=
(
const
NextHopRecord
& a,
const
NextHopRecord
& b)
90
{
91
return
!(a == b);
92
}
93
94
std::ostream&
95
operator<<
(std::ostream& os,
const
NextHopRecord
& nh);
96
97
101
class
FibEntry
102
{
103
public
:
104
class
Error
:
public
tlv::Error
105
{
106
public
:
107
using
tlv::Error::Error
;
108
};
109
110
FibEntry
();
111
112
explicit
113
FibEntry
(
const
Block
& block);
114
115
const
Name
&
116
getPrefix
()
const
117
{
118
return
m_prefix;
119
}
120
121
FibEntry
&
122
setPrefix(
const
Name
& prefix);
123
124
const
std::vector<NextHopRecord>&
125
getNextHopRecords
()
const
126
{
127
return
m_nextHopRecords;
128
}
129
130
template
<
typename
InputIt>
131
FibEntry
&
132
setNextHopRecords
(InputIt first, InputIt last)
133
{
134
m_nextHopRecords.assign(first, last);
135
m_wire.reset();
136
return
*
this
;
137
}
138
139
FibEntry
&
140
addNextHopRecord(
const
NextHopRecord
& nh);
141
142
FibEntry
&
143
clearNextHopRecords();
144
145
template
<encoding::Tag TAG>
146
size_t
147
wireEncode
(
EncodingImpl<TAG>
& block)
const
;
148
149
const
Block
&
150
wireEncode
()
const
;
151
152
void
153
wireDecode
(
const
Block
& block);
154
155
private
:
156
Name
m_prefix;
157
std::vector<NextHopRecord> m_nextHopRecords;
158
159
mutable
Block
m_wire;
160
};
161
162
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
FibEntry
);
163
164
bool
165
operator==
(
const
FibEntry
& a,
const
FibEntry
& b);
166
167
inline
bool
168
operator!=
(
const
FibEntry
& a,
const
FibEntry
& b)
169
{
170
return
!(a == b);
171
}
172
173
std::ostream&
174
operator<<
(std::ostream& os,
const
FibEntry
& entry);
175
176
}
// namespace nfd
177
}
// namespace ndn
178
179
#endif // NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::nfd::operator!=
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.hpp:81
ndn::nfd::NextHopRecord::setFaceId
NextHopRecord & setFaceId(uint64_t faceId)
Definition:
fib-entry.cpp:49
ndn::nfd::FibEntry::setNextHopRecords
FibEntry & setNextHopRecords(InputIt first, InputIt last)
Definition:
fib-entry.hpp:132
ndn::nfd::FibEntry::getNextHopRecords
const std::vector< NextHopRecord > & getNextHopRecords() const
Definition:
fib-entry.hpp:125
ndn::nfd::NextHopRecord::Error
Definition:
fib-entry.hpp:37
ndn::nfd::NextHopRecord
Definition:
fib-entry.hpp:34
ndn::Block
Represents a TLV element of the NDN packet format.
Definition:
block.hpp:44
ndn::nfd::NextHopRecord::wireDecode
void wireDecode(const Block &block)
Definition:
fib-entry.cpp:97
ndn::nfd::NextHopRecord::getCost
uint64_t getCost() const
Definition:
fib-entry.hpp:58
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:39
ndn::nfd::FibEntry::Error
Definition:
fib-entry.hpp:104
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.cpp:97
ndn::nfd::NextHopRecord::setCost
NextHopRecord & setCost(uint64_t cost)
Definition:
fib-entry.cpp:57
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition:
nfd-constants.cpp:36
ndn::Name
Represents an absolute name.
Definition:
name.hpp:41
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::nfd::NextHopRecord::NextHopRecord
NextHopRecord()
Definition:
fib-entry.cpp:37
block.hpp
ndn::nfd::FibEntry
Definition:
fib-entry.hpp:101
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
name.hpp
ndn::tlv::nfd::FibEntry
Definition:
tlv-nfd.hpp:95
ndn::nfd::FibEntry::getPrefix
const Name & getPrefix() const
Definition:
fib-entry.hpp:116
ndn::nfd::NextHopRecord::getFaceId
uint64_t getFaceId() const
Definition:
fib-entry.hpp:49
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition:
tlv.cpp:27
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
ndn::nfd::NextHopRecord::wireEncode
const Block & wireEncode() const
Definition:
fib-entry.cpp:81
ndnSIM
ndn-cxx
ndn-cxx
mgmt
nfd
fib-entry.hpp
Generated on Fri May 6 2022 12:34:14 for ndnSIM by
1.8.13