NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
link.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_LINK_HPP
23
#define NDN_LINK_HPP
24
25
#include "
data.hpp
"
26
#include <set>
27
28
namespace
ndn
{
29
30
const
size_t
INVALID_SELECTED_DELEGATION_INDEX
= std::numeric_limits<size_t>::max();
31
34
class
Link
:
public
Data
35
{
36
public
:
37
class
Error
:
public
Data::Error
38
{
39
public
:
40
explicit
41
Error
(
const
std::string& what)
42
:
Data
::
Error
(what)
43
{
44
}
45
};
46
47
// The ordering is based on the preference number and needs to be preserved
48
typedef
std::set<std::pair<uint32_t, Name>>
DelegationSet
;
49
60
Link
() =
default
;
61
72
explicit
73
Link
(
const
Block
& block);
74
87
explicit
88
Link
(
const
Name
&
name
);
89
104
Link
(
const
Name
&
name
, std::initializer_list<std::pair<uint32_t, Name>> links);
105
112
void
113
addDelegation
(uint32_t preference,
const
Name
&
name
);
114
120
bool
121
removeDelegation
(
const
Name
&
name
);
122
127
const
DelegationSet&
128
getDelegations
()
const
;
129
135
void
136
wireDecode
(
const
Block
& wire);
137
144
static
std::tuple<uint32_t, Name>
145
getDelegationFromWire
(
const
Block
& block,
size_t
index);
146
153
static
ssize_t
154
findDelegationFromWire
(
const
Block
& block,
const
Name
& delegationName);
155
156
static
ssize_t
157
countDelegationsFromWire
(
const
Block
& block);
158
159
protected
:
164
template
<encoding::Tag TAG>
165
size_t
166
encodeContent
(
EncodingImpl<TAG>
& encoder)
const
;
167
168
void
169
encodeContent
();
170
171
void
172
decodeContent
();
173
174
private
:
175
bool
176
removeDelegationNoEncode(
const
Name
&
name
);
177
178
private
:
179
DelegationSet m_delegations;
180
};
181
182
}
// namespace ndn
183
184
#endif // NDN_LINK_HPP
ndn::Link::addDelegation
void addDelegation(uint32_t preference, const Name &name)
Add a delegation in the format of <Name, Preference>
Definition:
link.cpp:59
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::Data::Error
Definition:
data.hpp:40
ndn::Link::Link
Link()=default
Create an empty Link object.
ndn::Link::getDelegationFromWire
static std::tuple< uint32_t, Name > getDelegationFromWire(const Block &block, size_t index)
gets the delegation at index from block
Definition:
link.cpp:183
ndn::Link::decodeContent
void decodeContent()
Definition:
link.cpp:133
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::Link::wireDecode
void wireDecode(const Block &wire)
Decode from the wire format.
Definition:
link.cpp:176
ndn::Link::Error::Error
Error(const std::string &what)
Definition:
link.hpp:41
ndn::Link::encodeContent
void encodeContent()
Definition:
link.cpp:118
ndn::Link::Error
Definition:
link.hpp:37
ndn::Link::DelegationSet
std::set< std::pair< uint32_t, Name > > DelegationSet
Definition:
link.hpp:48
ndn::Link::countDelegationsFromWire
static ssize_t countDelegationsFromWire(const Block &block)
Definition:
link.cpp:221
ndn::Link
represents a Link instance
Definition:
link.hpp:34
data.hpp
ndn::Link::removeDelegation
bool removeDelegation(const Name &name)
Remove a delegation whose name is name.
Definition:
link.cpp:67
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:45
ndn::Link::findDelegationFromWire
static ssize_t findDelegationFromWire(const Block &block, const Name &delegationName)
finds index of a delegation with delegationName from block
Definition:
link.cpp:200
ndn::Link::getDelegations
const DelegationSet & getDelegations() const
Get the pairs of <Name, Preference>
Definition:
link.cpp:77
ndn::Data
represents a Data packet
Definition:
data.hpp:37
ndn::name
Definition:
name-component.cpp:36
ndn::INVALID_SELECTED_DELEGATION_INDEX
const size_t INVALID_SELECTED_DELEGATION_INDEX
Definition:
link.hpp:30
ndnSIM
ndn-cxx
src
link.hpp
Generated on Wed Jan 11 2017 18:17:13 for ndnSIM by
1.8.13