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-2018 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_MGMT_NFD_FIB_ENTRY_HPP
23
#define NDN_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
explicit
108
Error
(
const
std::string& what)
109
: tlv::
Error
(what)
110
{
111
}
112
};
113
114
FibEntry
();
115
116
explicit
117
FibEntry
(
const
Block
& block);
118
119
const
Name
&
120
getPrefix
()
const
121
{
122
return
m_prefix;
123
}
124
125
FibEntry
&
126
setPrefix
(
const
Name
& prefix);
127
128
const
std::vector<NextHopRecord>&
129
getNextHopRecords
()
const
130
{
131
return
m_nextHopRecords;
132
}
133
134
template
<
typename
InputIt>
135
FibEntry
&
136
setNextHopRecords
(InputIt first, InputIt last)
137
{
138
m_nextHopRecords.assign(first, last);
139
m_wire.
reset
();
140
return
*
this
;
141
}
142
143
FibEntry
&
144
addNextHopRecord
(
const
NextHopRecord
& nh);
145
146
FibEntry
&
147
clearNextHopRecords
();
148
149
template
<encoding::Tag TAG>
150
size_t
151
wireEncode
(
EncodingImpl<TAG>
& block)
const
;
152
153
const
Block
&
154
wireEncode
()
const
;
155
156
void
157
wireDecode
(
const
Block
& block);
158
159
private
:
160
Name
m_prefix;
161
std::vector<NextHopRecord> m_nextHopRecords;
162
163
mutable
Block
m_wire;
164
};
165
166
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
FibEntry
);
167
168
bool
169
operator==
(
const
FibEntry
& a,
const
FibEntry
& b);
170
171
inline
bool
172
operator!=
(
const
FibEntry
& a,
const
FibEntry
& b)
173
{
174
return
!(a == b);
175
}
176
177
std::ostream&
178
operator<<
(std::ostream& os,
const
FibEntry
& entry);
179
180
}
// namespace nfd
181
}
// namespace ndn
182
183
#endif // NDN_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::FibEntry::wireDecode
void wireDecode(const Block &block)
Definition:
fib-entry.cpp:208
ndn::nfd::NextHopRecord::setFaceId
NextHopRecord & setFaceId(uint64_t faceId)
Definition:
fib-entry.cpp:48
ndn::nfd::FibEntry::setNextHopRecords
FibEntry & setNextHopRecords(InputIt first, InputIt last)
Definition:
fib-entry.hpp:136
ndn::nfd::FibEntry::setPrefix
FibEntry & setPrefix(const Name &prefix)
Definition:
fib-entry.cpp:150
ndn::nfd::FibEntry::getNextHopRecords
const std::vector< NextHopRecord > & getNextHopRecords() const
Definition:
fib-entry.hpp:129
ndn::nfd::NextHopRecord::Error
Definition:
fib-entry.hpp:37
ndn::nfd::NextHopRecord
Definition:
fib-entry.hpp:34
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::tlv::nfd::NextHopRecord
Definition:
tlv-nfd.hpp:96
ndn::nfd::NextHopRecord::wireDecode
void wireDecode(const Block &block)
Definition:
fib-entry.cpp:96
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:40
ndn::nfd::FibEntry::Error
Definition:
fib-entry.hpp:104
ndn::nfd::FibEntry::clearNextHopRecords
FibEntry & clearNextHopRecords()
Definition:
fib-entry.cpp:166
ndn::nfd::FibEntry::FibEntry
FibEntry()
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.cpp:96
ndn::nfd::NextHopRecord::setCost
NextHopRecord & setCost(uint64_t cost)
Definition:
fib-entry.cpp:56
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition:
nfd-constants.cpp:35
ndn::Block::reset
void reset()
Reset wire buffer of the element.
Definition:
block.cpp:255
ndn::Name
Represents an absolute name.
Definition:
name.hpp:43
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::nfd::NextHopRecord::NextHopRecord
NextHopRecord()
Definition:
fib-entry.cpp:36
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)
ndn::nfd::FibEntry::wireEncode
const Block & wireEncode() const
Definition:
fib-entry.cpp:192
name.hpp
ndn::tlv::nfd::FibEntry
Definition:
tlv-nfd.hpp:95
ndn::nfd::FibEntry::Error::Error
Error(const std::string &what)
Definition:
fib-entry.hpp:108
ndn::nfd::FibEntry::getPrefix
const Name & getPrefix() const
Definition:
fib-entry.hpp:120
ndn::nfd::NextHopRecord::getFaceId
uint64_t getFaceId() const
Definition:
fib-entry.hpp:49
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:80
ndn::nfd::FibEntry::addNextHopRecord
FibEntry & addNextHopRecord(const NextHopRecord &nh)
Definition:
fib-entry.cpp:158
ndnSIM
ndn-cxx
ndn-cxx
mgmt
nfd
fib-entry.hpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15