NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
signature.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_HPP
23
#define NDN_SIGNATURE_HPP
24
25
#include "
signature-info.hpp
"
26
27
namespace
ndn
{
28
37
class
Signature
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
Signature
() =
default
;
51
52
explicit
53
Signature
(
const
Block
& info,
const
Block
& value =
Block
());
54
55
explicit
56
Signature
(
const
SignatureInfo
& info,
const
Block
& value =
Block
());
57
60
explicit
61
operator
bool()
const
62
{
63
return
m_info
.
getSignatureType
() != -1;
64
}
65
68
const
SignatureInfo
&
69
getSignatureInfo
()
const
70
{
71
return
m_info
;
72
}
73
76
const
Block
&
77
getInfo
()
const
78
{
79
return
m_info
.
wireEncode
();
80
}
81
85
void
86
setInfo
(
const
Block
& info);
87
90
void
91
setInfo
(
const
SignatureInfo
& info)
92
{
93
m_info
= info;
94
}
95
98
const
Block
&
99
getValue
()
const
100
{
101
return
m_value
;
102
}
103
107
void
108
setValue
(
const
Block
& value);
109
110
public
:
// SignatureInfo fields
114
tlv::SignatureTypeValue
115
getType
()
const
;
116
119
bool
120
hasKeyLocator
()
const
121
{
122
return
m_info
.
hasKeyLocator
();
123
}
124
128
const
KeyLocator
&
129
getKeyLocator
()
const
130
{
131
return
m_info
.
getKeyLocator
();
132
}
133
136
void
137
setKeyLocator
(
const
KeyLocator
& keyLocator)
138
{
139
m_info
.
setKeyLocator
(keyLocator);
140
}
141
147
void
148
unsetKeyLocator
()
149
{
150
m_info
.
unsetKeyLocator
();
151
}
152
153
protected
:
154
SignatureInfo
m_info
;
155
mutable
Block
m_value
;
156
};
157
158
bool
159
operator==
(
const
Signature
& lhs,
const
Signature
& rhs);
160
161
inline
bool
162
operator!=
(
const
Signature
& lhs,
const
Signature
& rhs)
163
{
164
return
!(lhs == rhs);
165
}
166
167
}
// namespace ndn
168
169
#endif // NDN_SIGNATURE_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::SignatureInfo::getKeyLocator
const KeyLocator & getKeyLocator() const
Get KeyLocator.
Definition:
signature-info.cpp:152
ndn::Signature::Signature
Signature()=default
ndn::SignatureInfo
Represents a SignatureInfo TLV element.
Definition:
signature-info.hpp:33
ndn::Signature::setInfo
void setInfo(const SignatureInfo &info)
Set SignatureInfo.
Definition:
signature.hpp:91
ndn::Signature::setKeyLocator
void setKeyLocator(const KeyLocator &keyLocator)
Set KeyLocator.
Definition:
signature.hpp:137
ndn::Signature::setInfo
void setInfo(const Block &info)
Decode SignatureInfo from wire format.
Definition:
signature.cpp:53
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::operator!=
bool operator!=(const Data &lhs, const Data &rhs)
Definition:
data.hpp:259
ndn::Signature::hasKeyLocator
bool hasKeyLocator() const
Check if KeyLocator exists in SignatureInfo.
Definition:
signature.hpp:120
ndn::Signature::unsetKeyLocator
void unsetKeyLocator()
Unset KeyLocator.
Definition:
signature.hpp:148
ndn::Signature::Error::Error
Error(const std::string &what)
Definition:
signature.hpp:44
ndn::SignatureInfo::setKeyLocator
void setKeyLocator(const KeyLocator &keyLocator)
Set KeyLocator.
Definition:
signature-info.cpp:161
ndn::Signature::getType
tlv::SignatureTypeValue getType() const
Get SignatureType.
Definition:
signature.cpp:44
ndn::SignatureInfo::wireEncode
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
Definition:
signature-info.cpp:61
ndn::SignatureInfo::hasKeyLocator
bool hasKeyLocator() const
Check if KeyLocator exists.
Definition:
signature-info.hpp:101
ndn::Signature::setValue
void setValue(const Block &value)
Set SignatureValue.
Definition:
signature.cpp:59
ndn::Signature::getInfo
const Block & getInfo() const
Get SignatureInfo as wire format.
Definition:
signature.hpp:77
ndn::SignatureInfo::getSignatureType
int32_t getSignatureType() const
Get SignatureType.
Definition:
signature-info.hpp:88
signature-info.hpp
ndn::Signature::getValue
const Block & getValue() const
Get SignatureValue.
Definition:
signature.hpp:99
ndn::SignatureInfo::unsetKeyLocator
void unsetKeyLocator()
Unset KeyLocator.
Definition:
signature-info.cpp:169
ndn::tlv::SignatureTypeValue
SignatureTypeValue
Definition:
tlv.hpp:97
ndn::KeyLocator
Definition:
key-locator.hpp:30
ndn::operator==
bool operator==(const Data &lhs, const Data &rhs)
Definition:
data.cpp:265
ndn::Signature::Error
Definition:
signature.hpp:40
ndn::Signature::getKeyLocator
const KeyLocator & getKeyLocator() const
Get KeyLocator.
Definition:
signature.hpp:129
ndn::Signature::m_info
SignatureInfo m_info
Definition:
signature.hpp:154
ndn::Signature::getSignatureInfo
const SignatureInfo & getSignatureInfo() const
Get SignatureInfo.
Definition:
signature.hpp:69
ndn::Signature::m_value
Block m_value
Definition:
signature.hpp:155
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
ndn::Signature
Holds SignatureInfo and SignatureValue in a Data packet.
Definition:
signature.hpp:37
ndnSIM
ndn-cxx
src
signature.hpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14