NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
key-locator.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_KEY_LOCATOR_HPP
23
#define NDN_KEY_LOCATOR_HPP
24
25
#include "
ndn-cxx/name.hpp
"
26
#include "
ndn-cxx/encoding/encoding-buffer.hpp
"
27
28
namespace
ndn
{
29
30
class
KeyLocator
31
{
32
public
:
33
class
Error
:
public
tlv::Error
34
{
35
public
:
36
using
tlv::Error::Error;
37
};
38
39
enum
Type
{
42
KeyLocator_None
= 65535,
45
KeyLocator_Name
= 0,
48
KeyLocator_KeyDigest
= 1,
51
KeyLocator_Unknown
= 255
52
};
53
54
public
:
// constructors
57
KeyLocator
();
58
61
explicit
62
KeyLocator
(
const
Block
& wire);
63
67
KeyLocator
(
const
Name
&
name
);
68
69
public
:
// encode and decode
73
template
<encoding::Tag TAG>
74
size_t
75
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
76
79
const
Block
&
80
wireEncode
()
const
;
81
86
void
87
wireDecode
(
const
Block
& wire);
88
89
public
:
// attributes
90
bool
91
empty
()
const
92
{
93
return
m_type ==
KeyLocator_None
;
94
}
95
96
Type
97
getType
()
const
98
{
99
return
m_type;
100
}
101
106
KeyLocator
&
107
clear
();
108
112
const
Name
&
113
getName
()
const
;
114
119
KeyLocator
&
120
setName
(
const
Name
&
name
);
121
125
const
Block
&
126
getKeyDigest
()
const
;
127
133
KeyLocator
&
134
setKeyDigest
(
const
Block
& keyDigest);
135
140
KeyLocator
&
141
setKeyDigest
(
const
ConstBufferPtr
& keyDigest);
142
143
public
:
// EqualityComparable concept
144
bool
145
operator==
(
const
KeyLocator
& other)
const
;
146
147
bool
148
operator!=
(
const
KeyLocator
& other)
const
149
{
150
return
!this->
operator==
(other);
151
}
152
153
private
:
154
Type
m_type;
155
Name
m_name;
156
Block
m_keyDigest;
157
158
mutable
Block
m_wire;
159
};
160
161
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
KeyLocator
);
162
163
std::ostream&
164
operator<<
(std::ostream& os,
const
KeyLocator
& keyLocator);
165
166
}
// namespace ndn
167
168
#endif // NDN_KEY_LOCATOR_HPP
ndn::KeyLocator::Type
Type
Definition:
key-locator.hpp:39
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::KeyLocator::getKeyDigest
const Block & getKeyDigest() const
get KeyDigest element
Definition:
key-locator.cpp:153
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:322
ndn::KeyLocator::setName
KeyLocator & setName(const Name &name)
set Name element
Definition:
key-locator.cpp:144
ndn::KeyLocator::getName
const Name & getName() const
get Name element
Definition:
key-locator.cpp:135
ndn::KeyLocator::wireDecode
void wireDecode(const Block &wire)
decode from wire encoding
Definition:
key-locator.cpp:96
ndn::KeyLocator::setKeyDigest
KeyLocator & setKeyDigest(const Block &keyDigest)
set KeyDigest element
Definition:
key-locator.cpp:162
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:42
ndn::KeyLocator::KeyLocator
KeyLocator()
construct an empty KeyLocator
Definition:
key-locator.cpp:35
ndn::KeyLocator::KeyLocator_Name
indicates KeyLocator contains a Name
Definition:
key-locator.hpp:45
ndn::KeyLocator::wireEncode
const Block & wireEncode() const
Definition:
key-locator.cpp:80
ndn::KeyLocator::empty
bool empty() const
Definition:
key-locator.hpp:91
ndn::KeyLocator::KeyLocator_None
indicates KeyLocator is empty (internal use only)
Definition:
key-locator.hpp:42
ndn::KeyLocator::operator!=
bool operator!=(const KeyLocator &other) const
Definition:
key-locator.hpp:148
ndn::Name
Represents an absolute name.
Definition:
name.hpp:43
ndn::KeyLocator::Error
Definition:
key-locator.hpp:33
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::KeyLocator::KeyLocator_Unknown
indicates KeyLocator contains an unknown element
Definition:
key-locator.hpp:51
ndn::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Exclude)
ndn::KeyLocator::clear
KeyLocator & clear()
clear KeyLocator
Definition:
key-locator.cpp:125
ndn::KeyLocator
Definition:
key-locator.hpp:30
ndn::KeyLocator::KeyLocator_KeyDigest
indicates KeyLocator contains a KeyDigest
Definition:
key-locator.hpp:48
ndn::KeyLocator::getType
Type getType() const
Definition:
key-locator.hpp:97
name.hpp
ndn::tlv::KeyLocator
Definition:
tlv.hpp:83
ndn::KeyLocator::operator==
bool operator==(const KeyLocator &other) const
Definition:
key-locator.cpp:184
ndn::name
Definition:
name-component-types.hpp:33
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:52
encoding-buffer.hpp
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:126
ndnSIM
ndn-cxx
ndn-cxx
key-locator.hpp
Generated on Sun Feb 24 2019 22:16:05 for ndnSIM by
1.8.15