NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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-2017 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 "../../encoding/block.hpp"
26
#include "../../name.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
explicit
41
Error
(
const
std::string& what)
42
: tlv::
Error
(what)
43
{
44
}
45
};
46
47
NextHopRecord
();
48
49
explicit
50
NextHopRecord
(
const
Block
& block);
51
52
uint64_t
53
getFaceId
()
const
54
{
55
return
m_faceId;
56
}
57
58
NextHopRecord
&
59
setFaceId
(uint64_t faceId);
60
61
uint64_t
62
getCost
()
const
63
{
64
return
m_cost;
65
}
66
67
NextHopRecord
&
68
setCost
(uint64_t cost);
69
70
template
<encoding::Tag TAG>
71
size_t
72
wireEncode
(EncodingImpl<TAG>& block)
const
;
73
74
const
Block
&
75
wireEncode
()
const
;
76
77
void
78
wireDecode
(
const
Block
& block);
79
80
private
:
81
uint64_t m_faceId;
82
uint64_t m_cost;
83
84
mutable
Block
m_wire;
85
};
86
87
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
NextHopRecord
);
88
89
bool
90
operator==
(
const
NextHopRecord
& a,
const
NextHopRecord
& b);
91
92
inline
bool
93
operator!=
(
const
NextHopRecord
& a,
const
NextHopRecord
& b)
94
{
95
return
!(a == b);
96
}
97
98
std::ostream&
99
operator<<
(std::ostream& os,
const
NextHopRecord
& nh);
100
101
105
class
FibEntry
106
{
107
public
:
108
class
Error
:
public
tlv::Error
109
{
110
public
:
111
explicit
112
Error
(
const
std::string& what)
113
: tlv::
Error
(what)
114
{
115
}
116
};
117
118
FibEntry
();
119
120
explicit
121
FibEntry
(
const
Block
& block);
122
123
const
Name
&
124
getPrefix
()
const
125
{
126
return
m_prefix;
127
}
128
129
FibEntry
&
130
setPrefix(
const
Name
& prefix);
131
132
const
std::vector<NextHopRecord>&
133
getNextHopRecords
()
const
134
{
135
return
m_nextHopRecords;
136
}
137
138
template
<
typename
InputIt>
139
FibEntry
&
140
setNextHopRecords
(InputIt first, InputIt last)
141
{
142
m_nextHopRecords.assign(first, last);
143
m_wire.reset();
144
return
*
this
;
145
}
146
147
FibEntry
&
148
addNextHopRecord(
const
NextHopRecord
& nh);
149
150
FibEntry
&
151
clearNextHopRecords();
152
153
template
<encoding::Tag TAG>
154
size_t
155
wireEncode
(EncodingImpl<TAG>& block)
const
;
156
157
const
Block
&
158
wireEncode
()
const
;
159
160
void
161
wireDecode
(
const
Block
& block);
162
163
private
:
164
Name
m_prefix;
165
std::vector<NextHopRecord> m_nextHopRecords;
166
167
mutable
Block
m_wire;
168
};
169
170
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
FibEntry
);
171
172
bool
173
operator==
(
const
FibEntry
& a,
const
FibEntry
& b);
174
175
inline
bool
176
operator!=
(
const
FibEntry
& a,
const
FibEntry
& b)
177
{
178
return
!(a == b);
179
}
180
181
std::ostream&
182
operator<<
(std::ostream& os,
const
FibEntry
& entry);
183
184
}
// namespace nfd
185
}
// namespace ndn
186
187
#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:85
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:140
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::nfd::NextHopRecord::wireDecode
void wireDecode(const Block &block)
Definition:
fib-entry.cpp:96
ndn::nfd::NextHopRecord::wireEncode
const Block & wireEncode() const
Definition:
fib-entry.cpp:80
ndn::nfd::FibEntry::getPrefix
const Name & getPrefix() const
Definition:
fib-entry.hpp:124
ndn::nfd::NextHopRecord::getCost
uint64_t getCost() const
Definition:
fib-entry.hpp:62
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::FibEntry::Error
Definition:
fib-entry.hpp:108
ndn::nfd::NextHopRecord::Error::Error
Error(const std::string &what)
Definition:
fib-entry.hpp:41
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::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::nfd::NextHopRecord::NextHopRecord
NextHopRecord()
Definition:
fib-entry.cpp:36
ndn::nfd::FibEntry::getNextHopRecords
const std::vector< NextHopRecord > & getNextHopRecords() const
Definition:
fib-entry.hpp:133
ndn::nfd::FibEntry
Definition:
fib-entry.hpp:105
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ndn::tlv::nfd::FibEntry
Definition:
tlv-nfd.hpp:84
ndn::nfd::FibEntry::Error::Error
Error(const std::string &what)
Definition:
fib-entry.hpp:112
ndn::nfd::NextHopRecord::getFaceId
uint64_t getFaceId() const
Definition:
fib-entry.hpp:53
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndnSIM
ndn-cxx
src
mgmt
nfd
fib-entry.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11