NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
signature-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-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_SIGNATURE_INFO_HPP
23
#define NDN_SIGNATURE_INFO_HPP
24
25
#include "
key-locator.hpp
"
26
#include "
security/validity-period.hpp
"
27
#include <list>
28
29
namespace
ndn
{
30
33
class
SignatureInfo
34
{
35
public
:
36
class
Error
:
public
tlv::Error
37
{
38
public
:
39
explicit
40
Error
(
const
std::string& what)
41
: tlv::
Error
(what)
42
{
43
}
44
};
45
48
SignatureInfo
();
49
52
explicit
53
SignatureInfo
(
tlv::SignatureTypeValue
type);
54
57
SignatureInfo
(
tlv::SignatureTypeValue
type,
const
KeyLocator
& keyLocator);
58
62
explicit
63
SignatureInfo
(
const
Block
& wire);
64
68
template
<encoding::Tag TAG>
69
size_t
70
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
71
74
const
Block
&
75
wireEncode
()
const
;
76
80
void
81
wireDecode
(
const
Block
& wire);
82
83
public
:
// field access
87
int32_t
88
getSignatureType
()
const
89
{
90
return
m_type;
91
}
92
95
void
96
setSignatureType
(
tlv::SignatureTypeValue
type);
97
100
bool
101
hasKeyLocator
()
const
102
{
103
return
m_hasKeyLocator;
104
}
105
109
const
KeyLocator
&
110
getKeyLocator
()
const
;
111
114
void
115
setKeyLocator
(
const
KeyLocator
& keyLocator);
116
119
void
120
unsetKeyLocator
();
121
125
security::ValidityPeriod
126
getValidityPeriod
()
const
;
127
130
void
131
setValidityPeriod
(
const
security::ValidityPeriod
& validityPeriod);
132
135
void
136
unsetValidityPeriod
();
137
142
const
Block
&
143
getTypeSpecificTlv
(uint32_t type)
const
;
144
147
void
148
appendTypeSpecificTlv
(
const
Block
& element);
149
150
private
:
151
int32_t m_type;
152
bool
m_hasKeyLocator;
153
KeyLocator
m_keyLocator;
154
std::list<Block> m_otherTlvs;
155
156
mutable
Block
m_wire;
157
158
friend
bool
159
operator==
(
const
SignatureInfo
& lhs,
const
SignatureInfo
& rhs);
160
161
friend
std::ostream&
162
operator<<
(std::ostream& os,
const
SignatureInfo
& info);
163
};
164
165
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
SignatureInfo
);
166
167
bool
168
operator==
(
const
SignatureInfo
& lhs,
const
SignatureInfo
& rhs);
169
170
inline
bool
171
operator!=
(
const
SignatureInfo
& lhs,
const
SignatureInfo
& rhs)
172
{
173
return
!(lhs == rhs);
174
}
175
176
std::ostream&
177
operator<<
(std::ostream& os,
const
SignatureInfo
& info);
178
179
}
// namespace ndn
180
181
#endif // NDN_SIGNATURE_INFO_HPP
ndn::SignatureInfo::operator<<
friend std::ostream & operator<<(std::ostream &os, const SignatureInfo &info)
Definition:
signature-info.cpp:230
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::SignatureInfo::setSignatureType
void setSignatureType(tlv::SignatureTypeValue type)
Set SignatureType.
Definition:
signature-info.cpp:145
ndn::SignatureInfo::getKeyLocator
const KeyLocator & getKeyLocator() const
Get KeyLocator.
Definition:
signature-info.cpp:152
ndn::SignatureInfo
Represents a SignatureInfo TLV element.
Definition:
signature-info.hpp:33
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:274
ndn::SignatureInfo::getTypeSpecificTlv
const Block & getTypeSpecificTlv(uint32_t type) const
Get SignatureType-specific sub-element.
Definition:
signature-info.cpp:203
ndn::SignatureInfo::Error
Definition:
signature-info.hpp:36
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::SignatureInfo::wireEncode
const Block & wireEncode() const
Encode to wire format.
Definition:
signature-info.cpp:93
ndn::SignatureInfo::appendTypeSpecificTlv
void appendTypeSpecificTlv(const Block &element)
Append SignatureType-specific sub-element.
Definition:
signature-info.cpp:214
ndn::operator!=
bool operator!=(const Data &lhs, const Data &rhs)
Definition:
data.hpp:259
ndn::SignatureInfo::unsetValidityPeriod
void unsetValidityPeriod()
Unset ValidityPeriod.
Definition:
signature-info.cpp:194
ndn::SignatureInfo::setKeyLocator
void setKeyLocator(const KeyLocator &keyLocator)
Set KeyLocator.
Definition:
signature-info.cpp:161
validity-period.hpp
ndn::SignatureInfo::SignatureInfo
SignatureInfo()
Create an invalid SignatureInfo.
Definition:
signature-info.cpp:35
ndn::SignatureInfo::operator==
friend bool operator==(const SignatureInfo &lhs, const SignatureInfo &rhs)
Definition:
signature-info.cpp:221
ndn::security::ValidityPeriod
Abstraction of validity period.
Definition:
validity-period.hpp:37
ndn::SignatureInfo::Error::Error
Error(const std::string &what)
Definition:
signature-info.hpp:40
ndn::SignatureInfo::hasKeyLocator
bool hasKeyLocator() const
Check if KeyLocator exists.
Definition:
signature-info.hpp:101
ndn::SignatureInfo::getSignatureType
int32_t getSignatureType() const
Get SignatureType.
Definition:
signature-info.hpp:88
ndn::tlv::SignatureInfo
Definition:
tlv.hpp:82
ndn::SignatureInfo::unsetKeyLocator
void unsetKeyLocator()
Unset KeyLocator.
Definition:
signature-info.cpp:169
ndn::SignatureInfo::setValidityPeriod
void setValidityPeriod(const security::ValidityPeriod &validityPeriod)
Set ValidityPeriod.
Definition:
signature-info.cpp:187
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::tlv::SignatureTypeValue
SignatureTypeValue
Definition:
tlv.hpp:97
ndn::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Exclude)
ndn::KeyLocator
Definition:
key-locator.hpp:30
ndn::SignatureInfo::wireDecode
void wireDecode(const Block &wire)
Decode from wire format.
Definition:
signature-info.cpp:109
key-locator.hpp
ndn::operator==
bool operator==(const Data &lhs, const Data &rhs)
Definition:
data.cpp:265
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndn::SignatureInfo::getValidityPeriod
security::ValidityPeriod getValidityPeriod() const
Get ValidityPeriod.
Definition:
signature-info.cpp:177
ndnSIM
ndn-cxx
src
signature-info.hpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14