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
face-traits.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_MGMT_NFD_FACE_TRAITS_HPP
23
#define NDN_MGMT_NFD_FACE_TRAITS_HPP
24
25
#include "../../encoding/block.hpp"
26
#include "../../encoding/nfd-constants.hpp"
27
28
namespace
ndn
{
29
namespace
nfd
{
30
36
template
<
class
C>
37
class
FaceTraits
38
{
39
public
:
40
class
Error
:
public
tlv::Error
41
{
42
public
:
43
explicit
44
Error
(
const
std::string& what)
45
: tlv::
Error
(what)
46
{
47
}
48
};
49
50
uint64_t
51
getFaceId
()
const
52
{
53
return
m_faceId
;
54
}
55
56
C&
57
setFaceId
(uint64_t faceId)
58
{
59
m_wire
.
reset
();
60
m_faceId
= faceId;
61
return
static_cast<
C&
>
(*this);
62
}
63
64
const
std::string&
65
getRemoteUri
()
const
66
{
67
return
m_remoteUri
;
68
}
69
70
C&
71
setRemoteUri
(
const
std::string& remoteUri)
72
{
73
m_wire
.
reset
();
74
m_remoteUri
= remoteUri;
75
return
static_cast<
C&
>
(*this);
76
}
77
78
const
std::string&
79
getLocalUri
()
const
80
{
81
return
m_localUri
;
82
}
83
84
C&
85
setLocalUri
(
const
std::string& localUri)
86
{
87
m_wire
.
reset
();
88
m_localUri
= localUri;
89
return
static_cast<
C&
>
(*this);
90
}
91
92
FaceScope
93
getFaceScope
()
const
94
{
95
return
m_faceScope
;
96
}
97
98
C&
99
setFaceScope
(
FaceScope
faceScope)
100
{
101
m_wire
.
reset
();
102
m_faceScope
= faceScope;
103
return
static_cast<
C&
>
(*this);
104
}
105
106
FacePersistency
107
getFacePersistency
()
const
108
{
109
return
m_facePersistency
;
110
}
111
112
C&
113
setFacePersistency
(
FacePersistency
facePersistency)
114
{
115
m_wire
.
reset
();
116
m_facePersistency
= facePersistency;
117
return
static_cast<
C&
>
(*this);
118
}
119
120
LinkType
121
getLinkType
()
const
122
{
123
return
m_linkType
;
124
}
125
126
C&
127
setLinkType
(
LinkType
linkType)
128
{
129
m_wire
.
reset
();
130
m_linkType
= linkType;
131
return
static_cast<
C&
>
(*this);
132
}
133
134
uint64_t
135
getFlags
()
const
136
{
137
return
m_flags
;
138
}
139
140
C&
141
setFlags
(uint64_t flags)
142
{
143
m_wire
.
reset
();
144
m_flags
= flags;
145
return
static_cast<
C&
>
(*this);
146
}
147
148
bool
149
getFlagBit
(
size_t
bit)
const
150
{
151
if
(bit >= 64) {
152
BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"
));
153
}
154
return
m_flags
& (1 << bit);
155
}
156
157
C&
158
setFlagBit
(
size_t
bit,
bool
value
)
159
{
160
if
(bit >= 64) {
161
BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"
));
162
}
163
164
m_wire
.
reset
();
165
166
if
(value) {
167
m_flags
|= (1 << bit);
168
}
169
else
{
170
m_flags
&= ~(1 << bit);
171
}
172
173
return
static_cast<
C&
>
(*this);
174
}
175
176
protected
:
177
FaceTraits
()
178
:
m_faceId
(
INVALID_FACE_ID
)
179
,
m_faceScope
(
FACE_SCOPE_NON_LOCAL
)
180
,
m_facePersistency
(
FACE_PERSISTENCY_PERSISTENT
)
181
,
m_linkType
(
LINK_TYPE_POINT_TO_POINT
)
182
,
m_flags
(0)
183
{
184
}
185
186
protected
:
187
uint64_t
m_faceId
;
188
std::string
m_remoteUri
;
189
std::string
m_localUri
;
190
FaceScope
m_faceScope
;
191
FacePersistency
m_facePersistency
;
192
LinkType
m_linkType
;
193
uint64_t
m_flags
;
194
195
mutable
Block
m_wire
;
196
};
197
198
}
// namespace nfd
199
}
// namespace ndn
200
201
#endif // NDN_MGMT_NFD_FACE_TRAITS_HPP
ndn::nfd::FaceTraits::getLinkType
LinkType getLinkType() const
Definition:
face-traits.hpp:121
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::nfd::LinkType
LinkType
Definition:
nfd-constants.hpp:57
ndn::nfd::FaceTraits::getFlags
uint64_t getFlags() const
Definition:
face-traits.hpp:135
ndn::nfd::FACE_SCOPE_NON_LOCAL
face is non-local
Definition:
nfd-constants.hpp:36
ndn::nfd::FaceTraits::m_localUri
std::string m_localUri
Definition:
face-traits.hpp:189
ndn::nfd::FaceTraits::m_remoteUri
std::string m_remoteUri
Definition:
face-traits.hpp:188
ndn::nfd::LINK_TYPE_POINT_TO_POINT
link is point-to-point
Definition:
nfd-constants.hpp:59
ndn::nfd::FaceTraits::getFaceScope
FaceScope getFaceScope() const
Definition:
face-traits.hpp:93
ndn::nfd::FaceTraits::m_flags
uint64_t m_flags
Definition:
face-traits.hpp:193
ndn::nfd::FaceTraits::m_facePersistency
FacePersistency m_facePersistency
Definition:
face-traits.hpp:191
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::nfd::FaceTraits::setFaceId
C & setFaceId(uint64_t faceId)
Definition:
face-traits.hpp:57
ndn::nfd::FaceTraits::getFlagBit
bool getFlagBit(size_t bit) const
Definition:
face-traits.hpp:149
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:45
ndn::nfd::FaceScope
FaceScope
Definition:
nfd-constants.hpp:34
ndn::nfd::FaceTraits::setLocalUri
C & setLocalUri(const std::string &localUri)
Definition:
face-traits.hpp:85
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::FaceTraits::m_wire
Block m_wire
Definition:
face-traits.hpp:195
ndn::nfd::FaceTraits::setRemoteUri
C & setRemoteUri(const std::string &remoteUri)
Definition:
face-traits.hpp:71
ndn::nfd::FaceTraits::m_linkType
LinkType m_linkType
Definition:
face-traits.hpp:192
ndn::nfd::FaceTraits::getFaceId
uint64_t getFaceId() const
Definition:
face-traits.hpp:51
ndn::nfd::FaceTraits::setFaceScope
C & setFaceScope(FaceScope faceScope)
Definition:
face-traits.hpp:99
ndn::nfd::FaceTraits::m_faceId
uint64_t m_faceId
Definition:
face-traits.hpp:187
ndn::Block::reset
void reset()
Reset wire buffer of the element.
Definition:
block.cpp:256
ndn::nfd::FaceTraits::getLocalUri
const std::string & getLocalUri() const
Definition:
face-traits.hpp:79
ndn::nfd::FaceTraits::getRemoteUri
const std::string & getRemoteUri() const
Definition:
face-traits.hpp:65
ndn::nfd::FaceTraits::getFacePersistency
FacePersistency getFacePersistency() const
Definition:
face-traits.hpp:107
ndn::nfd::FaceTraits::FaceTraits
FaceTraits()
Definition:
face-traits.hpp:177
ndn::nfd::FaceTraits
provides getters and setters for face information fields
Definition:
face-traits.hpp:37
ndn::nfd::FaceTraits::Error
Definition:
face-traits.hpp:40
ndn::nfd::FaceTraits::setLinkType
C & setLinkType(LinkType linkType)
Definition:
face-traits.hpp:127
ndn::nfd::FaceTraits::m_faceScope
FaceScope m_faceScope
Definition:
face-traits.hpp:190
websocketpp::session::state::value
value
Definition:
connection.hpp:179
ndn::nfd::FaceTraits::setFacePersistency
C & setFacePersistency(FacePersistency facePersistency)
Definition:
face-traits.hpp:113
ndn::nfd::FaceTraits::setFlagBit
C & setFlagBit(size_t bit, bool value)
Definition:
face-traits.hpp:158
ndn::nfd::FaceTraits::Error::Error
Error(const std::string &what)
Definition:
face-traits.hpp:44
ndn::nfd::FaceTraits::setFlags
C & setFlags(uint64_t flags)
Definition:
face-traits.hpp:141
ndn::nfd::FACE_PERSISTENCY_PERSISTENT
face is persistent
Definition:
nfd-constants.hpp:47
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndn::nfd::INVALID_FACE_ID
const uint64_t INVALID_FACE_ID
Definition:
nfd-constants.hpp:30
ndnSIM
ndn-cxx
src
mgmt
nfd
face-traits.hpp
Generated on Thu Nov 2 2017 03:30:28 for ndnSIM by
1.8.11