NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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; -*- */
2
/*
3
* Copyright (c) 2013-2022 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_CXX_META_INFO_HPP
23
#define NDN_CXX_META_INFO_HPP
24
25
#include "
ndn-cxx/name-component.hpp
"
26
#include "
ndn-cxx/encoding/block.hpp
"
27
#include "
ndn-cxx/encoding/encoding-buffer.hpp
"
28
#include "
ndn-cxx/util/optional.hpp
"
29
#include "
ndn-cxx/util/time.hpp
"
30
31
#include <list>
32
33
namespace
ndn
{
34
35
const
time::milliseconds
DEFAULT_FRESHNESS_PERIOD
= time::milliseconds::zero();
36
58
class
MetaInfo
59
{
60
public
:
61
class
Error
:
public
tlv::Error
62
{
63
public
:
64
using
tlv::Error::Error
;
65
};
66
67
MetaInfo
();
68
72
explicit
73
MetaInfo
(
const
Block
& block);
74
75
template
<encoding::Tag TAG>
76
size_t
77
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
78
79
const
Block
&
80
wireEncode
()
const
;
81
82
void
83
wireDecode
(
const
Block
& wire);
84
85
public
:
// getter/setter
90
uint32_t
91
getType
()
const
92
{
93
return
m_type;
94
}
95
99
MetaInfo
&
100
setType
(uint32_t type);
101
106
time::milliseconds
107
getFreshnessPeriod
()
const
108
{
109
return
m_freshnessPeriod;
110
}
111
115
MetaInfo
&
116
setFreshnessPeriod
(
time::milliseconds
freshnessPeriod);
117
120
const
optional<name::Component>&
121
getFinalBlock
()
const
122
{
123
return
m_finalBlockId;
124
}
125
128
MetaInfo
&
129
setFinalBlock
(optional<name::Component> finalBlockId);
130
131
public
:
// app-defined MetaInfo items
138
const
std::list<Block>&
139
getAppMetaInfo
()
const
;
140
152
MetaInfo
&
153
setAppMetaInfo
(
const
std::list<Block>&
info
);
154
164
MetaInfo
&
165
addAppMetaInfo
(
const
Block
& block);
166
175
bool
176
removeAppMetaInfo
(uint32_t
tlvType
);
177
189
const
Block
*
190
findAppMetaInfo
(uint32_t tlvType)
const
;
191
192
private
:
193
uint32_t m_type;
194
time::milliseconds
m_freshnessPeriod;
195
optional<name::Component> m_finalBlockId;
196
std::list<Block> m_appMetaInfo;
197
198
mutable
Block
m_wire;
199
};
200
201
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
MetaInfo
);
202
203
std::ostream&
204
operator<<
(std::ostream& os,
const
MetaInfo
&
info
);
205
206
}
// namespace ndn
207
208
#endif // NDN_CXX_META_INFO_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
time.hpp
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::setFinalBlock
MetaInfo & setFinalBlock(optional< name::Component > finalBlockId)
set FinalBlockId
Definition:
meta-info.cpp:66
optional.hpp
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:376
ndn::MetaInfo::MetaInfo
MetaInfo()
Definition:
meta-info.cpp:35
info
SignatureInfo info
Definition:
verification-helpers.cpp:56
ndn::Block
Represents a TLV element of the NDN packet format.
Definition:
block.hpp:44
ndn::MetaInfo::setFreshnessPeriod
MetaInfo & setFreshnessPeriod(time::milliseconds freshnessPeriod)
set FreshnessPeriod
Definition:
meta-info.cpp:55
ndn::MetaInfo::getType
uint32_t getType() const
return ContentType
Definition:
meta-info.hpp:91
ndn::DEFAULT_FRESHNESS_PERIOD
const time::milliseconds DEFAULT_FRESHNESS_PERIOD
Definition:
meta-info.hpp:35
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:104
ndn::MetaInfo::wireEncode
const Block & wireEncode() const
Definition:
meta-info.cpp:165
ndn::MetaInfo
A MetaInfo holds the meta info which is signed inside the data packet.
Definition:
meta-info.hpp:58
ndn::MetaInfo::getFreshnessPeriod
time::milliseconds getFreshnessPeriod() const
return FreshnessPeriod
Definition:
meta-info.hpp:107
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::MetaInfo::getFinalBlock
const optional< name::Component > & getFinalBlock() const
return FinalBlockId
Definition:
meta-info.hpp:121
ndn::MetaInfo::getAppMetaInfo
const std::list< Block > & getAppMetaInfo() const
Get all app-defined MetaInfo items.
Definition:
meta-info.cpp:74
ndn::MetaInfo::Error
Definition:
meta-info.hpp:61
tlvType
uint64_t tlvType
TLV-TYPE of the field; 0 if field does not exist.
Definition:
packet.cpp:62
block.hpp
name-component.hpp
ndn::MetaInfo::setAppMetaInfo
MetaInfo & setAppMetaInfo(const std::list< Block > &info)
Set app-defined MetaInfo items.
Definition:
meta-info.cpp:80
ndn::MetaInfo::addAppMetaInfo
MetaInfo & addAppMetaInfo(const Block &block)
Add an app-defined MetaInfo item.
Definition:
meta-info.cpp:93
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition:
tlv.cpp:27
ndn::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Interest)
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
encoding-buffer.hpp
ndn::MetaInfo::wireDecode
void wireDecode(const Block &wire)
Definition:
meta-info.cpp:181
ndn::time::milliseconds
boost::chrono::milliseconds milliseconds
Definition:
time.hpp:48
ndnSIM
ndn-cxx
ndn-cxx
meta-info.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13