NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
meta-info.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_META_INFO_HPP
23
#define NDN_META_INFO_HPP
24
25
#include "
common.hpp
"
26
#include "
encoding/block.hpp
"
27
#include "
encoding/encoding-buffer.hpp
"
28
#include "
util/time.hpp
"
29
#include "
name-component.hpp
"
30
#include <list>
31
32
namespace
ndn
{
33
56
class
MetaInfo
57
{
58
public
:
59
class
Error
:
public
tlv::Error
60
{
61
public
:
62
explicit
63
Error
(
const
std::string& what)
64
: tlv::
Error
(what)
65
{
66
}
67
};
68
69
MetaInfo
();
70
74
explicit
75
MetaInfo
(
const
Block
& block);
76
77
template
<encoding::Tag TAG>
78
size_t
79
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
80
81
const
Block
&
82
wireEncode
()
const
;
83
84
void
85
wireDecode
(
const
Block
& wire);
86
87
public
:
// getter/setter
88
uint32_t
89
getType
()
const
;
90
94
MetaInfo
&
95
setType
(uint32_t type);
96
97
const
time::milliseconds&
98
getFreshnessPeriod
()
const
;
99
100
MetaInfo
&
101
setFreshnessPeriod
(
const
time::milliseconds& freshnessPeriod);
102
103
const
name::Component
&
104
getFinalBlockId
()
const
;
105
106
MetaInfo
&
107
setFinalBlockId
(
const
name::Component
& finalBlockId);
108
109
public
:
// app-defined MetaInfo items
118
const
std::list<Block>&
119
getAppMetaInfo
()
const
;
120
134
MetaInfo
&
135
setAppMetaInfo
(
const
std::list<Block>& info);
136
148
MetaInfo
&
149
addAppMetaInfo
(
const
Block
& block);
150
161
bool
162
removeAppMetaInfo
(uint32_t tlvType);
163
177
const
Block
*
178
findAppMetaInfo
(uint32_t tlvType)
const
;
179
180
public
:
// EqualityComparable concept
181
bool
182
operator==
(
const
MetaInfo
& other)
const
;
183
184
bool
185
operator!=
(
const
MetaInfo
& other)
const
;
186
187
private
:
188
uint32_t m_type;
189
time::milliseconds m_freshnessPeriod;
190
name::Component
m_finalBlockId;
191
std::list<Block> m_appMetaInfo;
192
193
mutable
Block
m_wire;
194
};
195
196
std::ostream&
197
operator<<
(std::ostream& os,
const
MetaInfo
& info);
198
200
201
inline
uint32_t
202
MetaInfo::getType
()
const
203
{
204
return
m_type;
205
}
206
207
inline
const
time::milliseconds&
208
MetaInfo::getFreshnessPeriod
()
const
209
{
210
return
m_freshnessPeriod;
211
}
212
213
inline
const
name::Component
&
214
MetaInfo::getFinalBlockId
()
const
215
{
216
return
m_finalBlockId;
217
}
218
219
inline
bool
220
MetaInfo::operator==
(
const
MetaInfo
& other)
const
221
{
222
return
wireEncode
() == other.
wireEncode
();
223
}
224
225
inline
bool
226
MetaInfo::operator!=
(
const
MetaInfo
& other)
const
227
{
228
return
!(*
this
== other);
229
}
230
231
}
// namespace ndn
232
233
#endif // NDN_META_INFO_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::MetaInfo::findAppMetaInfo
const Block * findAppMetaInfo(uint32_t tlvType) const
Find a first app-defined MetaInfo item of type tlvType.
Definition:
meta-info.cpp:117
ndn::MetaInfo::getFreshnessPeriod
const time::milliseconds & getFreshnessPeriod() const
Definition:
meta-info.hpp:208
ndn::MetaInfo::Error::Error
Error(const std::string &what)
Definition:
meta-info.hpp:63
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:320
ndn::MetaInfo::MetaInfo
MetaInfo()
Definition:
meta-info.cpp:35
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
common.hpp
Copyright (c) 2013-2015 Regents of the University of California.
ndn::MetaInfo::getType
uint32_t getType() const
Definition:
meta-info.hpp:202
ndn::MetaInfo::setFinalBlockId
MetaInfo & setFinalBlockId(const name::Component &finalBlockId)
Definition:
meta-info.cpp:63
time.hpp
ndn::MetaInfo::setType
MetaInfo & setType(uint32_t type)
set ContentType
Definition:
meta-info.cpp:47
ndn::MetaInfo::removeAppMetaInfo
bool removeAppMetaInfo(uint32_t tlvType)
Remove a first app-defined MetaInfo item with type tlvType.
Definition:
meta-info.cpp:103
ndn::MetaInfo::wireEncode
const Block & wireEncode() const
Definition:
meta-info.cpp:176
ndn::MetaInfo
An MetaInfo holds the meta info which is signed inside the data packet.
Definition:
meta-info.hpp:56
ndn::MetaInfo::setFreshnessPeriod
MetaInfo & setFreshnessPeriod(const time::milliseconds &freshnessPeriod)
Definition:
meta-info.cpp:55
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:45
ndn::MetaInfo::getAppMetaInfo
const std::list< Block > & getAppMetaInfo() const
Get all app-defined MetaInfo items.
Definition:
meta-info.cpp:71
ndn::MetaInfo::Error
Definition:
meta-info.hpp:59
ndn::MetaInfo::operator!=
bool operator!=(const MetaInfo &other) const
Definition:
meta-info.hpp:226
ndn::MetaInfo::wireEncode
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Definition:
meta-info.cpp:130
ndn::MetaInfo::getFinalBlockId
const name::Component & getFinalBlockId() const
Definition:
meta-info.hpp:214
ndn::name::Component
Component holds a read-only name component value.
Definition:
name-component.hpp:47
block.hpp
ndn::MetaInfo::operator==
bool operator==(const MetaInfo &other) const
Definition:
meta-info.hpp:220
name-component.hpp
ndn::MetaInfo::setAppMetaInfo
MetaInfo & setAppMetaInfo(const std::list< Block > &info)
Set app-defined MetaInfo items.
Definition:
meta-info.cpp:77
ndn::MetaInfo::addAppMetaInfo
MetaInfo & addAppMetaInfo(const Block &block)
Add an app-defined MetaInfo item.
Definition:
meta-info.cpp:91
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
encoding-buffer.hpp
ndn::MetaInfo::wireDecode
void wireDecode(const Block &wire)
Definition:
meta-info.cpp:192
ndnSIM
ndn-cxx
src
meta-info.hpp
Generated on Sat Nov 12 2016 16:02:52 for ndnSIM by
1.8.12