NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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; -*- */
22
#ifndef NDN_KEY_LOCATOR_HPP
23
#define NDN_KEY_LOCATOR_HPP
24
25
#include "
encoding/encoding-buffer.hpp
"
26
#include "
name.hpp
"
27
28
namespace
ndn
{
29
30
class
KeyLocator
31
{
32
public
:
33
class
Error
:
public
tlv::Error
34
{
35
public
:
36
explicit
37
Error
(
const
std::string& what)
38
: tlv::
Error
(what)
39
{
40
}
41
};
42
43
enum
Type
{
46
KeyLocator_None
= 65535,
49
KeyLocator_Name
= 0,
52
KeyLocator_KeyDigest
= 1,
55
KeyLocator_Unknown
= 255
56
};
57
58
public
:
// constructors
61
KeyLocator
();
62
65
explicit
66
KeyLocator
(
const
Block
& wire);
67
71
KeyLocator
(
const
Name
&
name
);
72
73
public
:
// encode and decode
77
template
<encoding::Tag TAG>
78
size_t
79
wireEncode
(
EncodingImpl<TAG>
& encoder)
const
;
80
83
const
Block
&
84
wireEncode
()
const
;
85
90
void
91
wireDecode
(
const
Block
& wire);
92
93
public
:
// attributes
94
bool
95
empty
()
const
96
{
97
return
m_type ==
KeyLocator_None
;
98
}
99
100
Type
101
getType
()
const
102
{
103
return
m_type;
104
}
105
110
KeyLocator
&
111
clear
();
112
116
const
Name
&
117
getName
()
const
;
118
123
KeyLocator
&
124
setName
(
const
Name
&
name
);
125
129
const
Block
&
130
getKeyDigest
()
const
;
131
137
KeyLocator
&
138
setKeyDigest
(
const
Block
& keyDigest);
139
144
KeyLocator
&
145
setKeyDigest
(
const
ConstBufferPtr
& keyDigest);
146
147
public
:
// EqualityComparable concept
148
bool
149
operator==
(
const
KeyLocator
& other)
const
;
150
151
bool
152
operator!=
(
const
KeyLocator
& other)
const
153
{
154
return
!this->
operator==
(other);
155
}
156
157
private
:
158
Type
m_type;
159
Name
m_name;
160
Block
m_keyDigest;
161
162
mutable
Block
m_wire;
163
};
164
165
}
// namespace ndn
166
167
#endif // NDN_KEY_LOCATOR_HPP
ndn::KeyLocator::Type
Type
Definition:
key-locator.hpp:43
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:156
ndn::KeyLocator::setName
KeyLocator & setName(const Name &name)
set Name element
Definition:
key-locator.cpp:147
ndn::KeyLocator::getName
const Name & getName() const
get Name element
Definition:
key-locator.cpp:138
ndn::KeyLocator::wireDecode
void wireDecode(const Block &wire)
decode from wire encoding
Definition:
key-locator.cpp:99
ndn::KeyLocator::setKeyDigest
KeyLocator & setKeyDigest(const Block &keyDigest)
set KeyDigest element
Definition:
key-locator.cpp:165
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::KeyLocator::KeyLocator
KeyLocator()
construct an empty KeyLocator
Definition:
key-locator.cpp:34
ndn::KeyLocator::KeyLocator_Name
indicates KeyLocator contains a Name
Definition:
key-locator.hpp:49
ndn::KeyLocator::wireEncode
const Block & wireEncode() const
Definition:
key-locator.cpp:83
ndn::KeyLocator::Error::Error
Error(const std::string &what)
Definition:
key-locator.hpp:37
ndn::KeyLocator::empty
bool empty() const
Definition:
key-locator.hpp:95
ndn::KeyLocator::KeyLocator_None
indicates KeyLocator is empty (internal use only)
Definition:
key-locator.hpp:46
ndn::KeyLocator::operator!=
bool operator!=(const KeyLocator &other) const
Definition:
key-locator.hpp:152
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
ndn::KeyLocator::Error
Definition:
key-locator.hpp:33
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:45
ndn::KeyLocator::KeyLocator_Unknown
indicates KeyLocator contains an unknown element
Definition:
key-locator.hpp:55
ndn::KeyLocator::clear
KeyLocator & clear()
clear KeyLocator
Definition:
key-locator.cpp:128
ndn::KeyLocator
Definition:
key-locator.hpp:30
ndn::KeyLocator::KeyLocator_KeyDigest
indicates KeyLocator contains a KeyDigest
Definition:
key-locator.hpp:52
ndn::KeyLocator::getType
Type getType() const
Definition:
key-locator.hpp:101
name.hpp
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:33
ndn::KeyLocator::operator==
bool operator==(const KeyLocator &other) const
Definition:
key-locator.cpp:187
ndn::name
Definition:
name-component.cpp:36
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:50
encoding-buffer.hpp
ndnSIM
ndn-cxx
src
key-locator.hpp
Generated on Wed Jan 11 2017 18:17:13 for ndnSIM by
1.8.13