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-2018 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 "
ndn-cxx/signature-info.hpp
"
26
27
namespace
ndn
{
28
37
class
Signature
38
{
39
public
:
40
class
Error
:
public
tlv::Error
41
{
42
public
:
43
using
tlv::Error::Error;
44
};
45
46
Signature
() =
default
;
47
48
explicit
49
Signature
(
const
Block
& info,
const
Block
& value =
Block
());
50
51
explicit
52
Signature
(
const
SignatureInfo
& info,
const
Block
& value =
Block
());
53
56
explicit
57
operator
bool()
const
58
{
59
return
m_info
.
getSignatureType
() != -1;
60
}
61
64
const
SignatureInfo
&
65
getSignatureInfo
()
const
66
{
67
return
m_info
;
68
}
69
72
const
Block
&
73
getInfo
()
const
74
{
75
return
m_info
.
wireEncode
();
76
}
77
81
void
82
setInfo
(
const
Block
& info);
83
86
void
87
setInfo
(
const
SignatureInfo
& info)
88
{
89
m_info
= info;
90
}
91
94
const
Block
&
95
getValue
()
const
96
{
97
return
m_value
;
98
}
99
103
void
104
setValue
(
const
Block
& value);
105
106
public
:
// SignatureInfo fields
110
tlv::SignatureTypeValue
111
getType
()
const
;
112
115
bool
116
hasKeyLocator
()
const
117
{
118
return
m_info
.
hasKeyLocator
();
119
}
120
124
const
KeyLocator
&
125
getKeyLocator
()
const
126
{
127
return
m_info
.
getKeyLocator
();
128
}
129
132
void
133
setKeyLocator
(
const
KeyLocator
& keyLocator)
134
{
135
m_info
.
setKeyLocator
(keyLocator);
136
}
137
143
void
144
unsetKeyLocator
()
145
{
146
m_info
.
unsetKeyLocator
();
147
}
148
149
protected
:
150
SignatureInfo
m_info
;
151
mutable
Block
m_value
;
152
};
153
154
bool
155
operator==
(
const
Signature
& lhs,
const
Signature
& rhs);
156
157
inline
bool
158
operator!=
(
const
Signature
& lhs,
const
Signature
& rhs)
159
{
160
return
!(lhs == rhs);
161
}
162
163
}
// namespace ndn
164
165
#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:34
ndn::Signature::setInfo
void setInfo(const SignatureInfo &info)
Set SignatureInfo.
Definition:
signature.hpp:87
ndn::Signature::setKeyLocator
void setKeyLocator(const KeyLocator &keyLocator)
Set KeyLocator.
Definition:
signature.hpp:133
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:262
ndn::Signature::hasKeyLocator
bool hasKeyLocator() const
Check if KeyLocator exists in SignatureInfo.
Definition:
signature.hpp:116
ndn::Signature::unsetKeyLocator
void unsetKeyLocator()
Unset KeyLocator.
Definition:
signature.hpp:144
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:98
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:73
ndn::SignatureInfo::getSignatureType
int32_t getSignatureType() const
Get SignatureType.
Definition:
signature-info.hpp:85
signature-info.hpp
ndn::Signature::getValue
const Block & getValue() const
Get SignatureValue.
Definition:
signature.hpp:95
ndn::SignatureInfo::unsetKeyLocator
void unsetKeyLocator()
Unset KeyLocator.
Definition:
signature-info.cpp:169
ndn::tlv::SignatureTypeValue
SignatureTypeValue
SignatureType values.
Definition:
tlv.hpp:126
ndn::KeyLocator
Definition:
key-locator.hpp:30
ndn::operator==
bool operator==(const Data &lhs, const Data &rhs)
Definition:
data.cpp:313
ndn::Signature::Error
Definition:
signature.hpp:40
ndn::Signature::getKeyLocator
const KeyLocator & getKeyLocator() const
Get KeyLocator.
Definition:
signature.hpp:125
ndn::Signature::m_info
SignatureInfo m_info
Definition:
signature.hpp:150
ndn::Signature::getSignatureInfo
const SignatureInfo & getSignatureInfo() const
Get SignatureInfo.
Definition:
signature.hpp:65
ndn::Signature::m_value
Block m_value
Definition:
signature.hpp:151
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
ndn::Signature
Holds SignatureInfo and SignatureValue in a Data packet.
Definition:
signature.hpp:37
ndnSIM
ndn-cxx
ndn-cxx
signature.hpp
Generated on Sun Feb 24 2019 22:16:06 for ndnSIM by
1.8.15