all: rename Tlv namespace to tlv for consistency
This commit renames the Tlv namespace defined in
tlv.hpp to tlv to be more consistent with tlv::security
and tlv::nfd. A Tlv namespace alias is provided for
backwards compatibility.
Change-Id: I21278d6a077afe7776802c3296997d4c1c44c6c6
diff --git a/src/data.cpp b/src/data.cpp
index 596e20b..d095382 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -25,7 +25,7 @@
namespace ndn {
Data::Data()
- : m_content(Tlv::Content) // empty content
+ : m_content(tlv::Content) // empty content
{
}
@@ -79,7 +79,7 @@
if (!unsignedPortion)
{
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::Data);
+ totalLength += block.prependVarNumber(tlv::Data);
}
return totalLength;
}
@@ -91,7 +91,7 @@
totalLength += encoder.appendBlock(signatureValue);
totalLength += encoder.prependVarNumber(totalLength);
- encoder.prependVarNumber(Tlv::Data);
+ encoder.prependVarNumber(tlv::Data);
const_cast<Data*>(this)->wireDecode(encoder.block());
return m_wire;
@@ -127,23 +127,23 @@
// Signature
// Name
- m_name.wireDecode(m_wire.get(Tlv::Name));
+ m_name.wireDecode(m_wire.get(tlv::Name));
// MetaInfo
- m_metaInfo.wireDecode(m_wire.get(Tlv::MetaInfo));
+ m_metaInfo.wireDecode(m_wire.get(tlv::MetaInfo));
// Content
- m_content = m_wire.get(Tlv::Content);
+ m_content = m_wire.get(tlv::Content);
///////////////
// Signature //
///////////////
// SignatureInfo
- m_signature.setInfo(m_wire.get(Tlv::SignatureInfo));
+ m_signature.setInfo(m_wire.get(tlv::SignatureInfo));
// SignatureValue
- Block::element_const_iterator val = m_wire.find(Tlv::SignatureValue);
+ Block::element_const_iterator val = m_wire.find(tlv::SignatureValue);
if (val != m_wire.elements_end())
m_signature.setValue(*val);
}
@@ -212,7 +212,7 @@
Data::getContent() const
{
if (m_content.empty())
- m_content = dataBlock(Tlv::Content, reinterpret_cast<const uint8_t*>(0), 0);
+ m_content = dataBlock(tlv::Content, reinterpret_cast<const uint8_t*>(0), 0);
if (!m_content.hasWire())
m_content.encode();
@@ -224,7 +224,7 @@
{
onChanged();
- m_content = dataBlock(Tlv::Content, content, contentLength);
+ m_content = dataBlock(tlv::Content, content, contentLength);
return *this;
}
@@ -234,7 +234,7 @@
{
onChanged();
- m_content = Block(Tlv::Content, contentValue); // not a real wire encoding yet
+ m_content = Block(tlv::Content, contentValue); // not a real wire encoding yet
return *this;
}
@@ -244,10 +244,10 @@
{
onChanged();
- if (content.type() == Tlv::Content)
+ if (content.type() == tlv::Content)
m_content = content;
else {
- m_content = Block(Tlv::Content, content);
+ m_content = Block(tlv::Content, content);
}
return *this;
diff --git a/src/data.hpp b/src/data.hpp
index 1480103..170cad2 100644
--- a/src/data.hpp
+++ b/src/data.hpp
@@ -238,11 +238,11 @@
*
* Depending on type of the supplied block, there are two cases:
*
- * - if block.type() == Tlv::Content, then block will be used directly as Data packet's
+ * - if block.type() == tlv::Content, then block will be used directly as Data packet's
* content (no extra copying)
*
- * - if block.type() != Tlv::Content, then this method will create a new Block with type
- * Tlv::Content and put block as a nested element in the content Block.
+ * - if block.type() != tlv::Content, then this method will create a new Block with type
+ * tlv::Content and put block as a nested element in the content Block.
*
* @param block The Block containing the content to assign
*
@@ -254,7 +254,7 @@
/**
* @brief Set the content from the pointer to immutable buffer
*
- * This method will create a Block with Tlv::Content and set contentValue as a payload
+ * This method will create a Block with tlv::Content and set contentValue as a payload
* for this block. Note that this method is very different from setContent(const
* Block&), since it does not require that payload should be a valid TLV element.
*
diff --git a/src/encoding/block-helpers.hpp b/src/encoding/block-helpers.hpp
index 8163d0c..0a58aa0 100644
--- a/src/encoding/block-helpers.hpp
+++ b/src/encoding/block-helpers.hpp
@@ -45,7 +45,7 @@
readNonNegativeInteger(const Block& block)
{
Buffer::const_iterator begin = block.value_begin();
- return Tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
+ return tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
}
inline Block
@@ -87,8 +87,8 @@
// ++dataSize;
// OBufferStream os;
-// Tlv::writeVarNumber(os, type);
-// Tlv::writeVarNumber(os, dataSize);
+// tlv::writeVarNumber(os, type);
+// tlv::writeVarNumber(os, dataSize);
// std::copy(first, last, std::ostream_iterator<uint8_t>(os));
// return Block(os.buf());
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index eeb0c3f..9edebc2 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -51,11 +51,11 @@
m_value_begin = m_begin;
m_value_end = m_end;
- m_type = Tlv::readType(m_value_begin, m_value_end);
- uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
+ m_type = tlv::readType(m_value_begin, m_value_end);
+ uint64_t length = tlv::readVarNumber(m_value_begin, m_value_end);
if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
{
- throw Tlv::Error("TLV length doesn't match buffer length");
+ throw tlv::Error("TLV length doesn't match buffer length");
}
}
@@ -82,12 +82,12 @@
m_value_begin = m_begin;
m_value_end = m_end;
- m_type = Tlv::readType(m_value_begin, m_value_end);
+ m_type = tlv::readType(m_value_begin, m_value_end);
- uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
+ uint64_t length = tlv::readVarNumber(m_value_begin, m_value_end);
if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
{
- throw Tlv::Error("TLV length doesn't match buffer length");
+ throw tlv::Error("TLV length doesn't match buffer length");
}
}
@@ -102,13 +102,13 @@
m_value_begin = m_begin;
m_value_end = m_end;
- m_type = Tlv::readType(m_value_begin, m_value_end);
- uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
+ m_type = tlv::readType(m_value_begin, m_value_end);
+ uint64_t length = tlv::readVarNumber(m_value_begin, m_value_end);
if (verifyLength)
{
if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
{
- throw Tlv::Error("TLV length doesn't match buffer length");
+ throw tlv::Error("TLV length doesn't match buffer length");
}
}
}
@@ -119,12 +119,12 @@
const uint8_t* tmp_begin = buffer;
const uint8_t* tmp_end = buffer + maxlength;
- m_type = Tlv::readType(tmp_begin, tmp_end);
- uint64_t length = Tlv::readVarNumber(tmp_begin, tmp_end);
+ m_type = tlv::readType(tmp_begin, tmp_end);
+ uint64_t length = tlv::readVarNumber(tmp_begin, tmp_end);
if (length > static_cast<uint64_t>(tmp_end - tmp_begin))
{
- throw Tlv::Error("Not enough data in the buffer to fully parse TLV");
+ throw tlv::Error("Not enough data in the buffer to fully parse TLV");
}
m_buffer = make_shared<Buffer>(buffer, (tmp_begin - buffer) + length);
@@ -144,12 +144,12 @@
const uint8_t* tmp_begin = buffer;
const uint8_t* tmp_end = buffer + maxlength;
- m_type = Tlv::readType(tmp_begin, tmp_end);
- uint64_t length = Tlv::readVarNumber(tmp_begin, tmp_end);
+ m_type = tlv::readType(tmp_begin, tmp_end);
+ uint64_t length = tlv::readVarNumber(tmp_begin, tmp_end);
if (length > static_cast<uint64_t>(tmp_end - tmp_begin))
{
- throw Tlv::Error("Not enough data in the buffer to fully parse TLV");
+ throw tlv::Error("Not enough data in the buffer to fully parse TLV");
}
m_buffer = make_shared<Buffer>(buffer, (tmp_begin - buffer) + length);
@@ -175,7 +175,7 @@
, m_value_begin(m_buffer->begin())
, m_value_end(m_buffer->end())
{
- m_size = Tlv::sizeOfVarNumber(m_type) + Tlv::sizeOfVarNumber(value_size()) + value_size();
+ m_size = tlv::sizeOfVarNumber(m_type) + tlv::sizeOfVarNumber(value_size()) + value_size();
}
Block::Block(uint32_t type, const Block& value)
@@ -186,7 +186,7 @@
, m_value_begin(value.begin())
, m_value_end(value.end())
{
- m_size = Tlv::sizeOfVarNumber(m_type) + Tlv::sizeOfVarNumber(value_size()) + value_size();
+ m_size = tlv::sizeOfVarNumber(m_type) + tlv::sizeOfVarNumber(value_size()) + value_size();
}
Block
@@ -195,11 +195,11 @@
std::istream_iterator<uint8_t> tmp_begin(is);
std::istream_iterator<uint8_t> tmp_end;
- uint32_t type = Tlv::readType(tmp_begin, tmp_end);
- uint64_t length = Tlv::readVarNumber(tmp_begin, tmp_end);
+ uint32_t type = tlv::readType(tmp_begin, tmp_end);
+ uint64_t length = tlv::readVarNumber(tmp_begin, tmp_end);
if (length > MAX_SIZE_OF_BLOCK_FROM_STREAM)
- throw Tlv::Error("Length of block from stream is too large");
+ throw tlv::Error("Length of block from stream is too large");
// We may still have some problem here, if some exception happens,
// we may completely lose all the bytes extracted from the stream.
@@ -209,7 +209,7 @@
is.read(buf+1, length-1);
if (length != static_cast<uint64_t>(is.gcount()) + 1) {
- throw Tlv::Error("Not enough data in the buffer to fully parse TLV");
+ throw tlv::Error("Not enough data in the buffer to fully parse TLV");
}
return dataBlock(type, buf, length);
@@ -221,12 +221,12 @@
Buffer::const_iterator tempBegin = wire->begin() + offset;
uint32_t type;
- bool isOk = Tlv::readType(tempBegin, wire->end(), type);
+ bool isOk = tlv::readType(tempBegin, wire->end(), type);
if (!isOk)
return false;
uint64_t length;
- isOk = Tlv::readVarNumber(tempBegin, wire->end(), length);
+ isOk = tlv::readVarNumber(tempBegin, wire->end(), length);
if (!isOk)
return false;
@@ -249,12 +249,12 @@
const uint8_t* tempEnd = buffer + maxSize;
uint32_t type = 0;
- bool isOk = Tlv::readType(tempBegin, tempEnd, type);
+ bool isOk = tlv::readType(tempBegin, tempEnd, type);
if (!isOk)
return false;
uint64_t length;
- isOk = Tlv::readVarNumber(tempBegin, tempEnd, length);
+ isOk = tlv::readVarNumber(tempBegin, tempEnd, length);
if (!isOk)
return false;
@@ -284,13 +284,13 @@
{
Buffer::const_iterator element_begin = begin;
- uint32_t type = Tlv::readType(begin, end);
- uint64_t length = Tlv::readVarNumber(begin, end);
+ uint32_t type = tlv::readType(begin, end);
+ uint64_t length = tlv::readVarNumber(begin, end);
if (length > static_cast<uint64_t>(end - begin))
{
m_subBlocks.clear();
- throw Tlv::Error("TLV length exceeds buffer length");
+ throw tlv::Error("TLV length exceeds buffer length");
}
Buffer::const_iterator element_end = begin + length;
@@ -311,16 +311,16 @@
return;
OBufferStream os;
- Tlv::writeVarNumber(os, type());
+ tlv::writeVarNumber(os, type());
if (hasValue())
{
- Tlv::writeVarNumber(os, value_size());
+ tlv::writeVarNumber(os, value_size());
os.write(reinterpret_cast<const char*>(value()), value_size());
}
else if (m_subBlocks.size() == 0)
{
- Tlv::writeVarNumber(os, 0);
+ tlv::writeVarNumber(os, 0);
}
else
{
@@ -329,14 +329,14 @@
valueSize += i->size();
}
- Tlv::writeVarNumber(os, valueSize);
+ tlv::writeVarNumber(os, valueSize);
for (element_const_iterator i = m_subBlocks.begin(); i != m_subBlocks.end(); ++i) {
if (i->hasWire())
os.write(reinterpret_cast<const char*>(i->wire()), i->size());
else if (i->hasValue()) {
- Tlv::writeVarNumber(os, i->type());
- Tlv::writeVarNumber(os, i->value_size());
+ tlv::writeVarNumber(os, i->type());
+ tlv::writeVarNumber(os, i->value_size());
os.write(reinterpret_cast<const char*>(i->value()), i->value_size());
}
else
@@ -354,8 +354,8 @@
m_value_begin = m_buffer->begin();
m_value_end = m_buffer->end();
- Tlv::readType(m_value_begin, m_value_end);
- Tlv::readVarNumber(m_value_begin, m_value_end);
+ tlv::readType(m_value_begin, m_value_end);
+ tlv::readVarNumber(m_value_begin, m_value_end);
}
Block
@@ -369,11 +369,11 @@
Buffer::const_iterator element_begin = begin;
- uint32_t type = Tlv::readType(begin, end);
- uint64_t length = Tlv::readVarNumber(begin, end);
+ uint32_t type = tlv::readType(begin, end);
+ uint64_t length = tlv::readVarNumber(begin, end);
if (length != static_cast<uint64_t>(end - begin))
- throw Tlv::Error("TLV length mismatches buffer length");
+ throw tlv::Error("TLV length mismatches buffer length");
return Block(m_buffer,
type,
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index 17192d8..9c2db13 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -51,12 +51,12 @@
typedef element_container::const_iterator element_const_iterator;
/// @brief Error that can be thrown from Block
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index 9d70ee6..87114eb 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -32,7 +32,7 @@
/**
* @brief Namespace defining NDN-TLV related constants and procedures
*/
-namespace Tlv {
+namespace tlv {
class Error : public std::runtime_error
{
@@ -125,7 +125,7 @@
/**
* @brief Read VAR-NUMBER in NDN-TLV encoding
*
- * @throws This call will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read
+ * @throws This call will throw ndn::tlv::Error (aka std::runtime_error) if number cannot be read
*
* Note that after call finished, begin will point to the first byte after the read VAR-NUMBER
*/
@@ -136,7 +136,7 @@
/**
* @brief Read TLV Type
*
- * @throws This call will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read
+ * @throws This call will throw ndn::tlv::Error (aka std::runtime_error) if number cannot be read
*
* This call is largely equivalent to tlv::readVarNumber, but exception will be thrown if type
* is larger than 2^32-1 (type in this library is implemented as uint32_t)
@@ -160,7 +160,7 @@
/**
* @brief Read nonNegativeInteger in NDN-TLV encoding
*
- * This call will throw ndn::Tlv::Error (aka std::runtime_error) if number cannot be read
+ * This call will throw ndn::tlv::Error (aka std::runtime_error) if number cannot be read
*
* Note that after call finished, begin will point to the first byte after the read VAR-NUMBER
*
@@ -536,7 +536,10 @@
}
-} // namespace Tlv
+} // namespace tlv
+
+/// @deprecated use namespace tlv instead
+namespace Tlv = tlv;
} // namespace ndn
diff --git a/src/exclude.hpp b/src/exclude.hpp
index 48df17e..64eb653 100644
--- a/src/exclude.hpp
+++ b/src/exclude.hpp
@@ -36,12 +36,12 @@
class Exclude
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
@@ -278,7 +278,7 @@
{
if (i->second)
{
- totalLength += prependBooleanBlock(block, Tlv::Any);
+ totalLength += prependBooleanBlock(block, tlv::Any);
}
if (!i->first.empty())
{
@@ -287,7 +287,7 @@
}
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::Exclude);
+ totalLength += block.prependVarNumber(tlv::Exclude);
return totalLength;
}
@@ -317,7 +317,7 @@
// Any ::= ANY-TYPE TLV-LENGTH(=0)
Block::element_const_iterator i = m_wire.elements_begin();
- if (i->type() == Tlv::Any)
+ if (i->type() == tlv::Any)
{
appendExclude(name::Component(), true);
++i;
@@ -325,7 +325,7 @@
while (i != m_wire.elements_end())
{
- if (i->type() != Tlv::NameComponent)
+ if (i->type() != tlv::NameComponent)
throw Error("Incorrect format of Exclude filter");
name::Component excludedComponent(i->value(), i->value_size());
@@ -333,7 +333,7 @@
if (i != m_wire.elements_end())
{
- if (i->type() == Tlv::Any)
+ if (i->type() == tlv::Any)
{
appendExclude(excludedComponent, true);
++i;
diff --git a/src/face.cpp b/src/face.cpp
index f547f45..e67b9a1 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -384,7 +384,7 @@
{
const Block& block = nfd::LocalControlHeader::getPayload(blockFromDaemon);
- if (block.type() == Tlv::Interest)
+ if (block.type() == tlv::Interest)
{
shared_ptr<Interest> interest = make_shared<Interest>();
interest->wireDecode(block);
@@ -393,7 +393,7 @@
m_impl->processInterestFilters(*interest);
}
- else if (block.type() == Tlv::Data)
+ else if (block.type() == tlv::Data)
{
shared_ptr<Data> data = make_shared<Data>();
data->wireDecode(block);
diff --git a/src/interest.cpp b/src/interest.cpp
index f5ff57b..8bf60e3 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -49,7 +49,7 @@
std::memcpy(const_cast<uint8_t*>(m_nonce.value()), &nonce, sizeof(nonce));
}
else {
- m_nonce = dataBlock(Tlv::Nonce,
+ m_nonce = dataBlock(tlv::Nonce,
reinterpret_cast<const uint8_t*>(&nonce),
sizeof(nonce));
m_wire.reset();
@@ -168,7 +168,7 @@
if (!publisherPublicKeyLocator.empty()) {
const Signature& signature = data.getSignature();
const Block& signatureInfo = signature.getInfo();
- Block::element_const_iterator it = signatureInfo.find(Tlv::KeyLocator);
+ Block::element_const_iterator it = signatureInfo.find(tlv::KeyLocator);
if (it == signatureInfo.elements_end()) {
return false;
}
@@ -200,14 +200,14 @@
getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
{
totalLength += prependNonNegativeIntegerBlock(block,
- Tlv::InterestLifetime,
+ tlv::InterestLifetime,
getInterestLifetime().count());
}
// Scope
if (getScope() >= 0)
{
- totalLength += prependNonNegativeIntegerBlock(block, Tlv::Scope, getScope());
+ totalLength += prependNonNegativeIntegerBlock(block, tlv::Scope, getScope());
}
// Nonce
@@ -224,7 +224,7 @@
totalLength += getName().wireEncode(block);
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::Interest);
+ totalLength += block.prependVarNumber(tlv::Interest);
return totalLength;
}
@@ -259,14 +259,14 @@
// Scope?
// InterestLifetime?
- if (m_wire.type() != Tlv::Interest)
- throw Tlv::Error("Unexpected TLV number when decoding Interest");
+ if (m_wire.type() != tlv::Interest)
+ throw tlv::Error("Unexpected TLV number when decoding Interest");
// Name
- m_name.wireDecode(m_wire.get(Tlv::Name));
+ m_name.wireDecode(m_wire.get(tlv::Name));
// Selectors
- Block::element_const_iterator val = m_wire.find(Tlv::Selectors);
+ Block::element_const_iterator val = m_wire.find(tlv::Selectors);
if (val != m_wire.elements_end())
{
m_selectors.wireDecode(*val);
@@ -275,10 +275,10 @@
m_selectors = Selectors();
// Nonce
- m_nonce = m_wire.get(Tlv::Nonce);
+ m_nonce = m_wire.get(tlv::Nonce);
// Scope
- val = m_wire.find(Tlv::Scope);
+ val = m_wire.find(tlv::Scope);
if (val != m_wire.elements_end())
{
m_scope = readNonNegativeInteger(*val);
@@ -287,7 +287,7 @@
m_scope = -1;
// InterestLifetime
- val = m_wire.find(Tlv::InterestLifetime);
+ val = m_wire.find(tlv::InterestLifetime);
if (val != m_wire.elements_end())
{
m_interestLifetime = time::milliseconds(readNonNegativeInteger(*val));
diff --git a/src/key-locator.hpp b/src/key-locator.hpp
index 69b458b..33e4584 100644
--- a/src/key-locator.hpp
+++ b/src/key-locator.hpp
@@ -139,7 +139,7 @@
}
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::KeyLocator);
+ totalLength += block.prependVarNumber(tlv::KeyLocator);
return totalLength;
}
@@ -162,13 +162,13 @@
inline void
KeyLocator::wireDecode(const Block& value)
{
- if (value.type() != Tlv::KeyLocator)
+ if (value.type() != tlv::KeyLocator)
throw Error("Unexpected TLV type during KeyLocator decoding");
m_wire = value;
m_wire.parse();
- if (!m_wire.elements().empty() && m_wire.elements_begin()->type() == Tlv::Name)
+ if (!m_wire.elements().empty() && m_wire.elements_begin()->type() == tlv::Name)
{
m_type = KeyLocator_Name;
m_name.wireDecode(*m_wire.elements_begin());
diff --git a/src/management/nfd-channel-status.hpp b/src/management/nfd-channel-status.hpp
index ca746d7..78a2066 100644
--- a/src/management/nfd-channel-status.hpp
+++ b/src/management/nfd-channel-status.hpp
@@ -39,12 +39,12 @@
class ChannelStatus
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
diff --git a/src/management/nfd-control-parameters.hpp b/src/management/nfd-control-parameters.hpp
index b546d5e..82c08ad 100644
--- a/src/management/nfd-control-parameters.hpp
+++ b/src/management/nfd-control-parameters.hpp
@@ -72,12 +72,12 @@
class ControlParameters
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
@@ -471,7 +471,7 @@
m_wire.parse();
Block::element_const_iterator val;
- val = m_wire.find(Tlv::Name);
+ val = m_wire.find(tlv::Name);
m_hasFields[CONTROL_PARAMETER_NAME] = val != m_wire.elements_end();
if (this->hasName()) {
m_name.wireDecode(*val);
diff --git a/src/management/nfd-control-response.hpp b/src/management/nfd-control-response.hpp
index 5b78405..29aa832 100644
--- a/src/management/nfd-control-response.hpp
+++ b/src/management/nfd-control-response.hpp
@@ -38,12 +38,12 @@
class ControlResponse
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 8d82319..3b7056e 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -45,7 +45,7 @@
try {
response.wireDecode(data.getContent().blockFromValue());
}
- catch (ndn::Tlv::Error& e) {
+ catch (ndn::tlv::Error& e) {
if (static_cast<bool>(onFailure))
onFailure(serverErrorCode, e.what());
return;
@@ -63,7 +63,7 @@
try {
parameters.wireDecode(response.getBody());
}
- catch (ndn::Tlv::Error& e) {
+ catch (ndn::tlv::Error& e) {
if (static_cast<bool>(onFailure))
onFailure(serverErrorCode, e.what());
return;
diff --git a/src/management/nfd-face-event-notification.hpp b/src/management/nfd-face-event-notification.hpp
index 7afb852..a455e57 100644
--- a/src/management/nfd-face-event-notification.hpp
+++ b/src/management/nfd-face-event-notification.hpp
@@ -48,12 +48,12 @@
class FaceEventNotification : public FaceFlagsTraits<FaceEventNotification>
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index 1b33dea..eff9c83 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.hpp
@@ -41,12 +41,12 @@
class FaceStatus : public FaceFlagsTraits<FaceStatus>
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
diff --git a/src/management/nfd-fib-entry.hpp b/src/management/nfd-fib-entry.hpp
index 77b4369..1086707 100644
--- a/src/management/nfd-fib-entry.hpp
+++ b/src/management/nfd-fib-entry.hpp
@@ -42,10 +42,10 @@
class NextHopRecord
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
- Error(const std::string& what) : Tlv::Error(what) {}
+ Error(const std::string& what) : tlv::Error(what) {}
};
NextHopRecord()
@@ -189,10 +189,10 @@
class FibEntry
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
- Error(const std::string& what) : Tlv::Error(what)
+ Error(const std::string& what) : tlv::Error(what)
{
}
};
@@ -307,7 +307,7 @@
{
throw Error("Unexpected end of FibEntry");
}
- else if (val->type() != Tlv::Name)
+ else if (val->type() != tlv::Name)
{
std::stringstream error;
error << "Expected Name, but Block is of a different type: #"
diff --git a/src/management/nfd-forwarder-status.hpp b/src/management/nfd-forwarder-status.hpp
index 7dcf2a4..9ac58c4 100644
--- a/src/management/nfd-forwarder-status.hpp
+++ b/src/management/nfd-forwarder-status.hpp
@@ -39,12 +39,12 @@
class ForwarderStatus
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
@@ -314,7 +314,7 @@
m_nfdVersion);
totalLength += encoder.prependVarNumber(totalLength);
- totalLength += encoder.prependVarNumber(Tlv::Content);
+ totalLength += encoder.prependVarNumber(tlv::Content);
return totalLength;
}
@@ -337,7 +337,7 @@
inline void
ForwarderStatus::wireDecode(const Block& block)
{
- if (block.type() != Tlv::Content) {
+ if (block.type() != tlv::Content) {
throw Error("expecting Content block for Status payload");
}
m_wire = block;
diff --git a/src/management/nfd-rib-entry.cpp b/src/management/nfd-rib-entry.cpp
index d075cc6..f97fa66 100644
--- a/src/management/nfd-rib-entry.cpp
+++ b/src/management/nfd-rib-entry.cpp
@@ -266,7 +266,7 @@
Block::element_const_iterator val = m_wire.elements_begin();
- if (val != m_wire.elements_end() && val->type() == Tlv::Name) {
+ if (val != m_wire.elements_end() && val->type() == tlv::Name) {
m_prefix.wireDecode(*val);
++val;
}
diff --git a/src/management/nfd-rib-entry.hpp b/src/management/nfd-rib-entry.hpp
index 9ea84c2..738b8f5 100644
--- a/src/management/nfd-rib-entry.hpp
+++ b/src/management/nfd-rib-entry.hpp
@@ -52,11 +52,11 @@
class Route
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
- Error(const std::string& what) : Tlv::Error(what)
+ Error(const std::string& what) : tlv::Error(what)
{
}
};
@@ -187,10 +187,10 @@
class RibEntry
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
- Error(const std::string& what) : Tlv::Error(what)
+ Error(const std::string& what) : tlv::Error(what)
{
}
};
diff --git a/src/management/nfd-strategy-choice.hpp b/src/management/nfd-strategy-choice.hpp
index 531d1d1..2d9bbd5 100644
--- a/src/management/nfd-strategy-choice.hpp
+++ b/src/management/nfd-strategy-choice.hpp
@@ -38,12 +38,12 @@
class StrategyChoice
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
@@ -145,7 +145,7 @@
m_wire.parse();
Block::element_const_iterator val = m_wire.elements_begin();
- if (val != m_wire.elements_end() && val->type() == Tlv::Name) {
+ if (val != m_wire.elements_end() && val->type() == tlv::Name) {
m_name.wireDecode(*val);
++val;
}
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index abb9208..04cded1 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -142,24 +142,24 @@
// FinalBlockId
if (!m_finalBlockId.empty())
{
- totalLength += prependNestedBlock(blk, Tlv::FinalBlockId, m_finalBlockId);
+ totalLength += prependNestedBlock(blk, tlv::FinalBlockId, m_finalBlockId);
}
// FreshnessPeriod
if (m_freshnessPeriod >= time::milliseconds::zero())
{
- totalLength += prependNonNegativeIntegerBlock(blk, Tlv::FreshnessPeriod,
+ totalLength += prependNonNegativeIntegerBlock(blk, tlv::FreshnessPeriod,
m_freshnessPeriod.count());
}
// ContentType
if (m_type != TYPE_DEFAULT)
{
- totalLength += prependNonNegativeIntegerBlock(blk, Tlv::ContentType, m_type);
+ totalLength += prependNonNegativeIntegerBlock(blk, tlv::ContentType, m_type);
}
totalLength += blk.prependVarNumber(totalLength);
- totalLength += blk.prependVarNumber(Tlv::MetaInfo);
+ totalLength += blk.prependVarNumber(tlv::MetaInfo);
return totalLength;
}
@@ -190,7 +190,7 @@
// FreshnessPeriod?
// ContentType
- Block::element_const_iterator val = m_wire.find(Tlv::ContentType);
+ Block::element_const_iterator val = m_wire.find(tlv::ContentType);
if (val != m_wire.elements().end())
{
m_type = readNonNegativeInteger(*val);
@@ -199,7 +199,7 @@
m_type = TYPE_DEFAULT;
// FreshnessPeriod
- val = m_wire.find(Tlv::FreshnessPeriod);
+ val = m_wire.find(tlv::FreshnessPeriod);
if (val != m_wire.elements().end())
{
m_freshnessPeriod = time::milliseconds(readNonNegativeInteger(*val));
@@ -208,11 +208,11 @@
m_freshnessPeriod = time::milliseconds::min();
// FinalBlockId
- val = m_wire.find(Tlv::FinalBlockId);
+ val = m_wire.find(tlv::FinalBlockId);
if (val != m_wire.elements().end())
{
m_finalBlockId = val->blockFromValue();
- if (m_finalBlockId.type() != Tlv::NameComponent)
+ if (m_finalBlockId.type() != tlv::NameComponent)
{
/// @todo May or may not throw exception later...
m_finalBlockId.reset();
diff --git a/src/name-component.hpp b/src/name-component.hpp
index 0e17580..a9be6a8 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -62,8 +62,8 @@
/**
* @brief Create name::Component from a wire block
*
- * @param wire Tlv::NameComponent Block from which to create name::Component
- * @throws Error if wire.type() is not Tlv::NameComponent
+ * @param wire tlv::NameComponent Block from which to create name::Component
+ * @throws Error if wire.type() is not tlv::NameComponent
*
* Any block can be implicitly converted to name::Component
*/
@@ -74,7 +74,7 @@
*
* @param buffer A pointer to an immutable buffer
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will not** allocate new memory for and copy the payload until
* toWire() method is called.
*/
@@ -85,7 +85,7 @@
* @brief Create a new name::Component from the buffer (data from buffer will be copied)
* @param buffer A reference to the buffer
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will** allocate new memory for and copy the payload.
*/
explicit
@@ -96,7 +96,7 @@
* @param buffer A pointer to the first byte of the buffer
* @param bufferSize Size of the buffer
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will** allocate new memory for and copy the payload.
*/
Component(const uint8_t* buffer, size_t bufferSize);
@@ -106,7 +106,7 @@
* @param begin Iterator pointing to the beginning of the buffer
* @param end Iterator pointing to the ending of the buffer
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will** allocate new memory for and copy the payload.
*/
template<class InputIterator>
@@ -118,7 +118,7 @@
* @param str Zero-ended string. Note that this string will be interpreted as is (i.e.,
* it will not be interpreted as URI)
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will** allocate new memory for and copy the payload.
*/
explicit
@@ -130,7 +130,7 @@
* @param str Const reference to STL string. Note that this string will be interpreted
* as is (i.e., it will not be interpreted as URI)
*
- * This constructor will create a new Tlv::NameComponent Block with `buffer` as a payload.
+ * This constructor will create a new tlv::NameComponent Block with `buffer` as a payload.
* Note that this method **will** allocate new memory for and copy the payload.
*/
explicit
@@ -410,7 +410,7 @@
inline
Component::Component()
- : Block(Tlv::NameComponent)
+ : Block(tlv::NameComponent)
{
}
@@ -418,44 +418,44 @@
Component::Component(const Block& wire)
: Block(wire)
{
- if (type() != Tlv::NameComponent)
+ if (type() != tlv::NameComponent)
throw Error("Constructing name component from non name component TLV wire block");
}
inline
Component::Component(const ConstBufferPtr& buffer)
- : Block(Tlv::NameComponent, buffer)
+ : Block(tlv::NameComponent, buffer)
{
}
inline
Component::Component(const Buffer& value)
- : Block(dataBlock(Tlv::NameComponent, value.buf(), value.size()))
+ : Block(dataBlock(tlv::NameComponent, value.buf(), value.size()))
{
}
inline
Component::Component(const uint8_t* value, size_t valueLen)
- : Block(dataBlock(Tlv::NameComponent, value, valueLen))
+ : Block(dataBlock(tlv::NameComponent, value, valueLen))
{
}
template<class InputIterator>
inline
Component::Component(InputIterator begin, InputIterator end)
- : Block(dataBlock(Tlv::NameComponent, begin, end))
+ : Block(dataBlock(tlv::NameComponent, begin, end))
{
}
inline
Component::Component(const char* str)
- : Block(dataBlock(Tlv::NameComponent, str, ::strlen(str)))
+ : Block(dataBlock(tlv::NameComponent, str, ::strlen(str)))
{
}
inline
Component::Component(const std::string& str)
- : Block(dataBlock(Tlv::NameComponent, str.c_str(), str.size()))
+ : Block(dataBlock(tlv::NameComponent, str.c_str(), str.size()))
{
}
@@ -528,15 +528,15 @@
inline Component
Component::fromNumber(uint64_t number)
{
- /// \todo Change to Tlv::NumberComponent
- return nonNegativeIntegerBlock(Tlv::NameComponent, number);
+ /// \todo Change to tlv::NumberComponent
+ return nonNegativeIntegerBlock(tlv::NameComponent, number);
}
inline uint64_t
Component::toNumber() const
{
- /// \todo Check if Component is of Tlv::NumberComponent type
+ /// \todo Check if Component is of tlv::NumberComponent type
return readNonNegativeInteger(static_cast<const Block&>(*this));
}
@@ -592,7 +592,7 @@
}
totalLength += encoder.prependVarNumber(totalLength);
- totalLength += encoder.prependVarNumber(Tlv::NameComponent);
+ totalLength += encoder.prependVarNumber(tlv::NameComponent);
return encoder.block();
}
@@ -606,7 +606,7 @@
if (value_size() > 0)
totalLength += block.prependByteArray(value(), value_size());
totalLength += block.prependVarNumber(value_size());
- totalLength += block.prependVarNumber(Tlv::NameComponent);
+ totalLength += block.prependVarNumber(tlv::NameComponent);
return totalLength;
}
@@ -629,7 +629,7 @@
inline void
Component::wireDecode(const Block& wire)
{
- if (wire.type() != Tlv::NameComponent)
+ if (wire.type() != tlv::NameComponent)
throw Error("wireDecode name component from non name component TLV wire block");
*this = wire;
diff --git a/src/name.hpp b/src/name.hpp
index 7522a19..0e8c840 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -77,7 +77,7 @@
* Create a new Name with no components.
*/
Name()
- : m_nameBlock(Tlv::Name)
+ : m_nameBlock(tlv::Name)
{
}
@@ -198,10 +198,10 @@
Name&
append(const Block& value)
{
- if (value.type() == Tlv::NameComponent)
+ if (value.type() == tlv::NameComponent)
m_nameBlock.push_back(value);
else
- m_nameBlock.push_back(Block(Tlv::NameComponent, value));
+ m_nameBlock.push_back(Block(tlv::NameComponent, value));
return *this;
}
@@ -220,7 +220,7 @@
void
clear()
{
- m_nameBlock = Block(Tlv::Name);
+ m_nameBlock = Block(tlv::Name);
}
/**
@@ -752,7 +752,7 @@
}
totalLength += blk.prependVarNumber(totalLength);
- totalLength += blk.prependVarNumber(Tlv::Name);
+ totalLength += blk.prependVarNumber(tlv::Name);
return totalLength;
}
@@ -777,8 +777,8 @@
inline void
Name::wireDecode(const Block& wire)
{
- if (wire.type() != Tlv::Name)
- throw Tlv::Error("Unexpected TLV type when decoding Name");
+ if (wire.type() != tlv::Name)
+ throw tlv::Error("Unexpected TLV type when decoding Name");
m_nameBlock = wire;
m_nameBlock.parse();
diff --git a/src/security/conf/checker.hpp b/src/security/conf/checker.hpp
index 9284191..040d343 100644
--- a/src/security/conf/checker.hpp
+++ b/src/security/conf/checker.hpp
@@ -99,15 +99,15 @@
{
switch (sigType)
{
- case Tlv::SignatureSha256WithRsa:
- case Tlv::SignatureSha256WithEcdsa:
+ case tlv::SignatureSha256WithRsa:
+ case tlv::SignatureSha256WithEcdsa:
{
if (!static_cast<bool>(m_keyLocatorChecker))
throw Error("Strong signature requires KeyLocatorChecker");
return;
}
- case Tlv::DigestSha256:
+ case tlv::DigestSha256:
return;
default:
throw Error("Unsupported signature type");
@@ -139,7 +139,7 @@
onValidationFailed(interest.shared_from_this(), "Invalid signature");
return -1;
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
onValidationFailed(interest.shared_from_this(), "Cannot decode signature related TLVs");
return -1;
@@ -163,15 +163,15 @@
return -1;
}
- if (signature.getType() == Tlv::DigestSha256)
+ if (signature.getType() == tlv::DigestSha256)
return 0;
try
{
switch (signature.getType())
{
- case Tlv::SignatureSha256WithRsa:
- case Tlv::SignatureSha256WithEcdsa:
+ case tlv::SignatureSha256WithRsa:
+ case tlv::SignatureSha256WithEcdsa:
{
if (!signature.hasKeyLocator()) {
onValidationFailed(packet.shared_from_this(),
@@ -188,7 +188,7 @@
}
}
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
onValidationFailed(packet.shared_from_this(),
"Cannot decode signature");
@@ -241,8 +241,8 @@
it != signers.end(); it++)
m_signers[(*it)->getName().getPrefix(-1)] = (*it);
- if (sigType != Tlv::SignatureSha256WithRsa &&
- sigType != Tlv::SignatureSha256WithEcdsa)
+ if (sigType != tlv::SignatureSha256WithRsa &&
+ sigType != tlv::SignatureSha256WithEcdsa)
{
throw Error("FixedSigner is only meaningful for strong signature type");
}
@@ -274,7 +274,7 @@
onValidationFailed(interest.shared_from_this(), "Invalid signature");
return -1;
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
onValidationFailed(interest.shared_from_this(), "Cannot decode signature related TLVs");
return -1;
@@ -298,7 +298,7 @@
return -1;
}
- if (signature.getType() == Tlv::DigestSha256)
+ if (signature.getType() == tlv::DigestSha256)
{
onValidationFailed(packet.shared_from_this(),
"FixedSigner does not allow Sha256 signature type");
@@ -309,8 +309,8 @@
{
switch (signature.getType())
{
- case Tlv::SignatureSha256WithRsa:
- case Tlv::SignatureSha256WithEcdsa:
+ case tlv::SignatureSha256WithRsa:
+ case tlv::SignatureSha256WithEcdsa:
{
if (!signature.hasKeyLocator()) {
onValidationFailed(packet.shared_from_this(),
@@ -356,7 +356,7 @@
"KeyLocator does not have name");
return -1;
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
onValidationFailed(packet.shared_from_this(),
"Cannot decode signature");
@@ -546,11 +546,11 @@
getSigType(const std::string& sigType)
{
if (boost::iequals(sigType, "rsa-sha256"))
- return Tlv::SignatureSha256WithRsa;
+ return tlv::SignatureSha256WithRsa;
else if (boost::iequals(sigType, "ecdsa-sha256"))
- return Tlv::SignatureSha256WithEcdsa;
+ return tlv::SignatureSha256WithEcdsa;
else if (boost::iequals(sigType, "sha256"))
- return Tlv::DigestSha256;
+ return tlv::DigestSha256;
else
throw Error("Unsupported signature type");
}
diff --git a/src/security/digest-sha256.cpp b/src/security/digest-sha256.cpp
index 6d450a2..3af551a 100644
--- a/src/security/digest-sha256.cpp
+++ b/src/security/digest-sha256.cpp
@@ -24,14 +24,14 @@
namespace ndn {
DigestSha256::DigestSha256()
- : Signature(SignatureInfo(Tlv::DigestSha256))
+ : Signature(SignatureInfo(tlv::DigestSha256))
{
}
DigestSha256::DigestSha256(const Signature& signature)
: Signature(signature)
{
- if (getType() != Tlv::DigestSha256)
+ if (getType() != tlv::DigestSha256)
throw Error("Incorrect signature type");
}
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 180d37d..1809079 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -550,7 +550,7 @@
DigestSha256 sig;
data.setSignature(sig);
- Block sigValue(Tlv::SignatureValue,
+ Block sigValue(tlv::SignatureValue,
crypto::sha256(data.wireEncode().value(),
data.wireEncode().value_size() -
data.getSignature().getValue().size()));
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 774dfb3..0c70d02 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -485,7 +485,7 @@
std::string signerName = certificate.getSignature().getKeyLocator().getName().toUri();
sqlite3_bind_text(statement, 2, signerName, SQLITE_TRANSIENT);
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return;
}
diff --git a/src/security/sec-rule-relative.cpp b/src/security/sec-rule-relative.cpp
index 42272bc..958eb66 100644
--- a/src/security/sec-rule-relative.cpp
+++ b/src/security/sec-rule-relative.cpp
@@ -69,7 +69,7 @@
const Name& signerName = keyLocator.getName();
return satisfy(dataName, signerName);
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return false;
}
@@ -120,7 +120,7 @@
const Name& signerName = keyLocator.getName();
return m_signerNameRegex.match(signerName);
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return false;
}
diff --git a/src/security/sec-rule-specific.cpp b/src/security/sec-rule-specific.cpp
index af89e91..cb7adf4 100644
--- a/src/security/sec-rule-specific.cpp
+++ b/src/security/sec-rule-specific.cpp
@@ -76,7 +76,7 @@
const Name& signerName = keyLocator.getName();
return m_signerRegex->match(signerName);
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return false;
}
diff --git a/src/security/sec-tpm-file.cpp b/src/security/sec-tpm-file.cpp
index 03ce634..7d0748d 100644
--- a/src/security/sec-tpm-file.cpp
+++ b/src/security/sec-tpm-file.cpp
@@ -332,7 +332,7 @@
true,
new SignerFilter(rng, signer, new FileSink(os)));
- return Block(Tlv::SignatureValue, os.buf());
+ return Block(tlv::SignatureValue, os.buf());
}
default:
throw Error("Unsupported digest algorithm!");
@@ -368,7 +368,7 @@
shared_ptr<Buffer> sigBuffer = make_shared<Buffer>(buf, bufSize);
- return Block(Tlv::SignatureValue, sigBuffer);
+ return Block(tlv::SignatureValue, sigBuffer);
}
default:
throw Error("Unsupported digest algorithm!");
diff --git a/src/security/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
index 3064d84..9f722fd 100644
--- a/src/security/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -868,7 +868,7 @@
if (signature.get() == 0)
throw Error("Signature is NULL!\n");
- return Block(Tlv::SignatureValue,
+ return Block(tlv::SignatureValue,
make_shared<Buffer>(CFDataGetBytePtr(signature.get()),
CFDataGetLength(signature.get())));
}
diff --git a/src/security/signature-sha256-with-ecdsa.cpp b/src/security/signature-sha256-with-ecdsa.cpp
index 91b4a29..642912b 100644
--- a/src/security/signature-sha256-with-ecdsa.cpp
+++ b/src/security/signature-sha256-with-ecdsa.cpp
@@ -24,14 +24,14 @@
namespace ndn {
SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(const KeyLocator& keyLocator)
- : Signature(SignatureInfo(Tlv::SignatureSha256WithEcdsa, keyLocator))
+ : Signature(SignatureInfo(tlv::SignatureSha256WithEcdsa, keyLocator))
{
}
SignatureSha256WithEcdsa::SignatureSha256WithEcdsa(const Signature& signature)
: Signature(signature)
{
- if (getType() != Tlv::SignatureSha256WithEcdsa)
+ if (getType() != tlv::SignatureSha256WithEcdsa)
throw Error("Incorrect signature type");
if (!hasKeyLocator()) {
diff --git a/src/security/signature-sha256-with-rsa.cpp b/src/security/signature-sha256-with-rsa.cpp
index 3c84b54..cda06e6 100644
--- a/src/security/signature-sha256-with-rsa.cpp
+++ b/src/security/signature-sha256-with-rsa.cpp
@@ -24,14 +24,14 @@
namespace ndn {
SignatureSha256WithRsa::SignatureSha256WithRsa(const KeyLocator& keyLocator)
- : Signature(SignatureInfo(Tlv::SignatureSha256WithRsa, keyLocator))
+ : Signature(SignatureInfo(tlv::SignatureSha256WithRsa, keyLocator))
{
}
SignatureSha256WithRsa::SignatureSha256WithRsa(const Signature& signature)
: Signature(signature)
{
- if (getType() != Tlv::SignatureSha256WithRsa)
+ if (getType() != tlv::SignatureSha256WithRsa)
throw Error("Incorrect signature type");
if (!hasKeyLocator()) {
diff --git a/src/security/validator-config.cpp b/src/security/validator-config.cpp
index 387cfe0..83b7a62 100644
--- a/src/security/validator-config.cpp
+++ b/src/security/validator-config.cpp
@@ -537,7 +537,7 @@
return onValidationFailed(interest.shared_from_this(),
"No valid signature");
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return onValidationFailed(interest.shared_from_this(),
"Cannot decode signature");
@@ -569,7 +569,7 @@
time::fromUnixTimestamp(
time::milliseconds(interestName.get(-signed_interest::MIN_LENGTH).toNumber()));
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return onValidationFailed(interest,
"Cannot decode signature related TLVs");
diff --git a/src/security/validator-config.hpp b/src/security/validator-config.hpp
index d3e4be4..69f626d 100644
--- a/src/security/validator-config.hpp
+++ b/src/security/validator-config.hpp
@@ -293,7 +293,7 @@
const OnFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
- if (signature.getType() == Tlv::DigestSha256)
+ if (signature.getType() == tlv::DigestSha256)
{
DigestSha256 sigSha256(signature);
@@ -306,8 +306,8 @@
try {
switch (signature.getType()) {
- case Tlv::SignatureSha256WithRsa:
- case Tlv::SignatureSha256WithEcdsa:
+ case tlv::SignatureSha256WithRsa:
+ case tlv::SignatureSha256WithEcdsa:
{
if (!signature.hasKeyLocator()) {
return onValidationFailed(packet.shared_from_this(),
@@ -320,7 +320,7 @@
"Unsupported signature type");
}
}
- catch (Tlv::Error& e) {
+ catch (tlv::Error& e) {
return onValidationFailed(packet.shared_from_this(),
"Cannot decode public key signature");
}
diff --git a/src/security/validator-regex.cpp b/src/security/validator-regex.cpp
index 97f796c..194aaf1 100644
--- a/src/security/validator-regex.cpp
+++ b/src/security/validator-regex.cpp
@@ -161,7 +161,7 @@
return;
}
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return onValidationFailed(data.shared_from_this(),
"Cannot decode signature");
diff --git a/src/security/validator.cpp b/src/security/validator.cpp
index 2bc9364..de8c311 100644
--- a/src/security/validator.cpp
+++ b/src/security/validator.cpp
@@ -170,7 +170,7 @@
switch (sig.getType())
{
- case Tlv::SignatureSha256WithRsa:
+ case tlv::SignatureSha256WithRsa:
{
if (key.getKeyType() != KEY_TYPE_RSA)
return false;
@@ -185,7 +185,7 @@
return verifier.VerifyMessage(buf, size,
sig.getValue().value(), sig.getValue().value_size());
}
- case Tlv::SignatureSha256WithEcdsa:
+ case tlv::SignatureSha256WithEcdsa:
{
if (key.getKeyType() != KEY_TYPE_ECDSA)
return false;
diff --git a/src/selectors.hpp b/src/selectors.hpp
index b180309..e09acea 100644
--- a/src/selectors.hpp
+++ b/src/selectors.hpp
@@ -241,13 +241,13 @@
// MustBeFresh
if (getMustBeFresh())
{
- totalLength += prependBooleanBlock(block, Tlv::MustBeFresh);
+ totalLength += prependBooleanBlock(block, tlv::MustBeFresh);
}
// ChildSelector
if (getChildSelector() >= 0)
{
- totalLength += prependNonNegativeIntegerBlock(block, Tlv::ChildSelector, getChildSelector());
+ totalLength += prependNonNegativeIntegerBlock(block, tlv::ChildSelector, getChildSelector());
}
// Exclude
@@ -265,19 +265,19 @@
// MaxSuffixComponents
if (getMaxSuffixComponents() >= 0)
{
- totalLength += prependNonNegativeIntegerBlock(block, Tlv::MaxSuffixComponents,
+ totalLength += prependNonNegativeIntegerBlock(block, tlv::MaxSuffixComponents,
getMaxSuffixComponents());
}
// MinSuffixComponents
if (getMinSuffixComponents() >= 0)
{
- totalLength += prependNonNegativeIntegerBlock(block, Tlv::MinSuffixComponents,
+ totalLength += prependNonNegativeIntegerBlock(block, tlv::MinSuffixComponents,
getMinSuffixComponents());
}
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::Selectors);
+ totalLength += block.prependVarNumber(tlv::Selectors);
return totalLength;
}
@@ -300,8 +300,8 @@
inline void
Selectors::wireDecode(const Block& wire)
{
- if (wire.type() != Tlv::Selectors)
- throw Tlv::Error("Unexpected TLV type when decoding Selectors");
+ if (wire.type() != tlv::Selectors)
+ throw tlv::Error("Unexpected TLV type when decoding Selectors");
*this = Selectors();
@@ -309,42 +309,42 @@
m_wire.parse();
// MinSuffixComponents
- Block::element_const_iterator val = m_wire.find(Tlv::MinSuffixComponents);
+ Block::element_const_iterator val = m_wire.find(tlv::MinSuffixComponents);
if (val != m_wire.elements_end())
{
m_minSuffixComponents = readNonNegativeInteger(*val);
}
// MaxSuffixComponents
- val = m_wire.find(Tlv::MaxSuffixComponents);
+ val = m_wire.find(tlv::MaxSuffixComponents);
if (val != m_wire.elements_end())
{
m_maxSuffixComponents = readNonNegativeInteger(*val);
}
// PublisherPublicKeyLocator
- val = m_wire.find(Tlv::KeyLocator);
+ val = m_wire.find(tlv::KeyLocator);
if (val != m_wire.elements_end())
{
m_publisherPublicKeyLocator.wireDecode(*val);
}
// Exclude
- val = m_wire.find(Tlv::Exclude);
+ val = m_wire.find(tlv::Exclude);
if (val != m_wire.elements_end())
{
m_exclude.wireDecode(*val);
}
// ChildSelector
- val = m_wire.find(Tlv::ChildSelector);
+ val = m_wire.find(tlv::ChildSelector);
if (val != m_wire.elements_end())
{
m_childSelector = readNonNegativeInteger(*val);
}
//MustBeFresh aka AnswerOriginKind
- val = m_wire.find(Tlv::MustBeFresh);
+ val = m_wire.find(tlv::MustBeFresh);
if (val != m_wire.elements_end())
{
m_mustBeFresh = true;
diff --git a/src/signature-info.cpp b/src/signature-info.cpp
index 20e013f..469bdee 100644
--- a/src/signature-info.cpp
+++ b/src/signature-info.cpp
@@ -30,13 +30,13 @@
{
}
-SignatureInfo::SignatureInfo(Tlv::SignatureTypeValue type)
+SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type)
: m_type(type)
, m_hasKeyLocator(false)
{
}
-SignatureInfo::SignatureInfo(Tlv::SignatureTypeValue type, const KeyLocator& keyLocator)
+SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, const KeyLocator& keyLocator)
: m_type(type)
, m_hasKeyLocator(true)
, m_keyLocator(keyLocator)
@@ -49,7 +49,7 @@
}
void
-SignatureInfo::setSignatureType(Tlv::SignatureTypeValue type)
+SignatureInfo::setSignatureType(tlv::SignatureTypeValue type)
{
m_wire.reset();
m_type = type;
@@ -114,10 +114,10 @@
if (m_hasKeyLocator)
totalLength += m_keyLocator.wireEncode(block);
- totalLength += prependNonNegativeIntegerBlock(block, Tlv::SignatureType, m_type);
+ totalLength += prependNonNegativeIntegerBlock(block, tlv::SignatureType, m_type);
totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(Tlv::SignatureInfo);
+ totalLength += block.prependVarNumber(tlv::SignatureInfo);
return totalLength;
}
@@ -156,13 +156,13 @@
m_wire = wire;
m_wire.parse();
- if (m_wire.type() != Tlv::SignatureInfo)
- throw Tlv::Error("Unexpected TLV type when decoding Name");
+ if (m_wire.type() != tlv::SignatureInfo)
+ throw tlv::Error("Unexpected TLV type when decoding Name");
Block::element_const_iterator it = m_wire.elements_begin();
// the first block must be SignatureType
- if (it != m_wire.elements_end() && it->type() == Tlv::SignatureType) {
+ if (it != m_wire.elements_end() && it->type() == tlv::SignatureType) {
m_type = readNonNegativeInteger(*it);
it++;
}
@@ -170,7 +170,7 @@
throw Error("SignatureInfo does not have sub-TLV or the first sub-TLV is not SignatureType");
// the second block could be KeyLocator
- if (it != m_wire.elements_end() && it->type() == Tlv::KeyLocator) {
+ if (it != m_wire.elements_end() && it->type() == tlv::KeyLocator) {
m_keyLocator.wireDecode(*it);
m_hasKeyLocator = true;
it++;
diff --git a/src/signature-info.hpp b/src/signature-info.hpp
index 4ef60fc..5dcdcff 100644
--- a/src/signature-info.hpp
+++ b/src/signature-info.hpp
@@ -31,12 +31,12 @@
class SignatureInfo
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
@@ -44,21 +44,21 @@
SignatureInfo();
explicit
- SignatureInfo(Tlv::SignatureTypeValue type);
+ SignatureInfo(tlv::SignatureTypeValue type);
- SignatureInfo(Tlv::SignatureTypeValue type, const KeyLocator& keyLocator);
+ SignatureInfo(tlv::SignatureTypeValue type, const KeyLocator& keyLocator);
/**
* @brief Generate SignatureInfo from a block
*
- * @throws Tlv::Error if supplied block is not formatted correctly
+ * @throws tlv::Error if supplied block is not formatted correctly
*/
explicit
SignatureInfo(const Block& block);
/// @brief Set SignatureType
void
- setSignatureType(Tlv::SignatureTypeValue type);
+ setSignatureType(tlv::SignatureTypeValue type);
/// @brief Get SignatureType
int32_t
diff --git a/src/signature.hpp b/src/signature.hpp
index c2cb8c2..9d7749b 100644
--- a/src/signature.hpp
+++ b/src/signature.hpp
@@ -33,21 +33,21 @@
class Signature
{
public:
- class Error : public Tlv::Error
+ class Error : public tlv::Error
{
public:
explicit
Error(const std::string& what)
- : Tlv::Error(what)
+ : tlv::Error(what)
{
}
};
- /// @deprecated use Tlv::SignatureTypeValue instead.
+ /// @deprecated use tlv::SignatureTypeValue instead.
enum {
- Sha256 = Tlv::DigestSha256,
- Sha256WithRsa = Tlv::SignatureSha256WithRsa,
- Sha256WithEcdsa = Tlv::SignatureSha256WithEcdsa
+ Sha256 = tlv::DigestSha256,
+ Sha256WithRsa = tlv::SignatureSha256WithRsa,
+ Sha256WithEcdsa = tlv::SignatureSha256WithEcdsa
};
Signature()
@@ -75,7 +75,7 @@
/**
* @brief Set SignatureInfo from a block
*
- * @throws Tlv::Error if supplied block is not formatted correctly
+ * @throws tlv::Error if supplied block is not formatted correctly
*/
void
setInfo(const Block& info);
diff --git a/src/util/command-interest-validator.hpp b/src/util/command-interest-validator.hpp
index d132231..689b450 100644
--- a/src/util/command-interest-validator.hpp
+++ b/src/util/command-interest-validator.hpp
@@ -177,7 +177,7 @@
Signature signature(interestName[POS_SIG_INFO].blockFromValue(),
interestName[POS_SIG_VALUE].blockFromValue());
- if (signature.getType() != Tlv::SignatureSha256WithRsa)
+ if (signature.getType() != tlv::SignatureSha256WithRsa)
return onValidationFailed(interest.shared_from_this(),
"Require SignatureSha256WithRsa");
@@ -265,7 +265,7 @@
return onValidationFailed(interest.shared_from_this(),
"Cannot locate the signing key");
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return onValidationFailed(interest.shared_from_this(),
"Cannot decode signature related TLVs");
diff --git a/src/util/io.hpp b/src/util/io.hpp
index 8e81aca..09ed90c 100644
--- a/src/util/io.hpp
+++ b/src/util/io.hpp
@@ -93,7 +93,7 @@
{
return shared_ptr<T>();
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
return shared_ptr<T>();
}
@@ -151,7 +151,7 @@
{
throw Error(e.what());
}
- catch (Tlv::Error& e)
+ catch (tlv::Error& e)
{
throw Error(e.what());
}
diff --git a/tests/unit-tests/security/test-conf-checker.cpp b/tests/unit-tests/security/test-conf-checker.cpp
index 9135a50..23df0cd 100644
--- a/tests/unit-tests/security/test-conf-checker.cpp
+++ b/tests/unit-tests/security/test-conf-checker.cpp
@@ -115,7 +115,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerEqual1 =
make_shared<RelationKeyLocatorNameChecker>(certName.getPrefix(-1),
KeyLocatorChecker::RELATION_EQUAL);
- CustomizedChecker checker1(Tlv::SignatureSha256WithRsa, keyLocatorCheckerEqual1);
+ CustomizedChecker checker1(tlv::SignatureSha256WithRsa, keyLocatorCheckerEqual1);
result = checker1.check(*data1,
bind(dataChecked, _1),
@@ -141,7 +141,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerEqual2 =
make_shared<RelationKeyLocatorNameChecker>(identity,
KeyLocatorChecker::RELATION_EQUAL);
- CustomizedChecker checker2(Tlv::SignatureSha256WithRsa, keyLocatorCheckerEqual2);
+ CustomizedChecker checker2(tlv::SignatureSha256WithRsa, keyLocatorCheckerEqual2);
result = checker2.check(*data1,
bind(dataCheckedFalse, _1),
@@ -157,7 +157,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerPrefix1 =
make_shared<RelationKeyLocatorNameChecker>(certName.getPrefix(-1),
KeyLocatorChecker::RELATION_IS_PREFIX_OF);
- CustomizedChecker checker3(Tlv::SignatureSha256WithRsa, keyLocatorCheckerPrefix1);
+ CustomizedChecker checker3(tlv::SignatureSha256WithRsa, keyLocatorCheckerPrefix1);
result = checker3.check(*data1,
bind(dataChecked, _1),
@@ -173,7 +173,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerPrefix2 =
make_shared<RelationKeyLocatorNameChecker>(identity,
KeyLocatorChecker::RELATION_IS_PREFIX_OF);
- CustomizedChecker checker4(Tlv::SignatureSha256WithRsa, keyLocatorCheckerPrefix2);
+ CustomizedChecker checker4(tlv::SignatureSha256WithRsa, keyLocatorCheckerPrefix2);
result = checker4.check(*data1,
bind(dataChecked, _1),
@@ -189,7 +189,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerStrict1 =
make_shared<RelationKeyLocatorNameChecker>(certName.getPrefix(-1),
KeyLocatorChecker::RELATION_IS_STRICT_PREFIX_OF);
- CustomizedChecker checker5(Tlv::SignatureSha256WithRsa, keyLocatorCheckerStrict1);
+ CustomizedChecker checker5(tlv::SignatureSha256WithRsa, keyLocatorCheckerStrict1);
result = checker5.check(*data1,
bind(dataCheckedFalse, _1),
@@ -204,7 +204,7 @@
shared_ptr<RelationKeyLocatorNameChecker> keyLocatorCheckerStrict2 =
make_shared<RelationKeyLocatorNameChecker>(identity,
KeyLocatorChecker::RELATION_IS_STRICT_PREFIX_OF);
- CustomizedChecker checker6(Tlv::SignatureSha256WithRsa, keyLocatorCheckerStrict2);
+ CustomizedChecker checker6(tlv::SignatureSha256WithRsa, keyLocatorCheckerStrict2);
result = checker6.check(*data1,
bind(dataCheckedFalse, _1),
@@ -254,7 +254,7 @@
shared_ptr<RegexKeyLocatorNameChecker> keyLocatorCheckerRegex1 =
make_shared<RegexKeyLocatorNameChecker>(
Regex("^<SecurityTestConfChecker><CustomizedCheckerTest2>"));
- CustomizedChecker checker1(Tlv::SignatureSha256WithRsa, keyLocatorCheckerRegex1);
+ CustomizedChecker checker1(tlv::SignatureSha256WithRsa, keyLocatorCheckerRegex1);
result = checker1.check(*data1,
bind(dataChecked, _1),
@@ -315,7 +315,7 @@
shared_ptr<RegexKeyLocatorNameChecker> keyLocatorCheckerRegex1 =
make_shared<RegexKeyLocatorNameChecker>(
Regex("^<SecurityTestConfChecker><CustomizedCheckerTest3>"));
- CustomizedChecker checker1(Tlv::SignatureSha256WithEcdsa, keyLocatorCheckerRegex1);
+ CustomizedChecker checker1(tlv::SignatureSha256WithEcdsa, keyLocatorCheckerRegex1);
result = checker1.check(*data1,
bind(dataChecked, _1),
@@ -338,7 +338,7 @@
BOOST_CHECK_EQUAL(result, -1);
- CustomizedChecker checker2(Tlv::SignatureSha256WithRsa, keyLocatorCheckerRegex1);
+ CustomizedChecker checker2(tlv::SignatureSha256WithRsa, keyLocatorCheckerRegex1);
result = checker2.check(*data1,
bind(dataCheckedFalse, _1),
@@ -388,7 +388,7 @@
int8_t result = 0;
- HierarchicalChecker checker1(Tlv::SignatureSha256WithEcdsa);
+ HierarchicalChecker checker1(tlv::SignatureSha256WithEcdsa);
result = checker1.check(*data1,
bind(dataChecked, _1),
@@ -421,7 +421,7 @@
BOOST_CHECK_EQUAL(result, -1);
- HierarchicalChecker checker2(Tlv::SignatureSha256WithRsa);
+ HierarchicalChecker checker2(tlv::SignatureSha256WithRsa);
result = checker2.check(*data1,
bind(dataCheckedFalse, _1),
@@ -491,7 +491,7 @@
int8_t result = 0;
- FixedSignerChecker checker1(Tlv::SignatureSha256WithEcdsa, certSet1);
+ FixedSignerChecker checker1(tlv::SignatureSha256WithEcdsa, certSet1);
result = checker1.check(*data1,
bind(dataChecked, _1),
@@ -504,7 +504,7 @@
BOOST_CHECK_EQUAL(result, -1);
- FixedSignerChecker checker2(Tlv::SignatureSha256WithRsa, certSet1);
+ FixedSignerChecker checker2(tlv::SignatureSha256WithRsa, certSet1);
result = checker2.check(*data1,
bind(dataCheckedFalse, _1),
@@ -517,7 +517,7 @@
BOOST_CHECK_EQUAL(result, -1);
- FixedSignerChecker checker3(Tlv::SignatureSha256WithEcdsa, certSet2);
+ FixedSignerChecker checker3(tlv::SignatureSha256WithEcdsa, certSet2);
result = checker3.check(*data1,
bind(dataCheckedFalse, _1),
@@ -530,7 +530,7 @@
BOOST_CHECK_EQUAL(result, -1);
- FixedSignerChecker checker4(Tlv::SignatureSha256WithRsa, certSet2);
+ FixedSignerChecker checker4(tlv::SignatureSha256WithRsa, certSet2);
result = checker4.check(*data1,
bind(dataCheckedFalse, _1),
diff --git a/tests/unit-tests/test-block.cpp b/tests/unit-tests/test-block.cpp
index c653177..cc860b7 100644
--- a/tests/unit-tests/test-block.cpp
+++ b/tests/unit-tests/test-block.cpp
@@ -40,7 +40,7 @@
0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 // == 4294967296LL
};
- using namespace Tlv;
+ using namespace tlv;
const uint8_t* begin;
uint64_t value;
@@ -117,7 +117,7 @@
0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 // == 4294967296LL
};
- using namespace Tlv;
+ using namespace tlv;
typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
typedef std::istream_iterator<uint8_t> Iterator;
@@ -257,7 +257,7 @@
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};
- using namespace Tlv;
+ using namespace tlv;
const uint8_t* begin;
uint64_t value;
@@ -292,7 +292,7 @@
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};
- using namespace Tlv;
+ using namespace tlv;
typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
typedef std::istream_iterator<uint8_t> Iterator;
@@ -579,7 +579,7 @@
BOOST_CHECK_EQUAL(*testBlock.wire(), 0x01);
BOOST_CHECK_EQUAL(*testBlock.value(), 0xfb);
- BOOST_CHECK_THROW(Block::fromStream(stream), Tlv::Error);
+ BOOST_CHECK_THROW(Block::fromStream(stream), tlv::Error);
}
BOOST_AUTO_TEST_CASE(Equality)
diff --git a/tests/unit-tests/test-data.cpp b/tests/unit-tests/test-data.cpp
index 5ce434e..8de7a42 100644
--- a/tests/unit-tests/test-data.cpp
+++ b/tests/unit-tests/test-data.cpp
@@ -223,7 +223,7 @@
b = SignatureSha256WithRsa();
static const uint8_t someData[256] = {};
- Block signatureValue = dataBlock(Tlv::SignatureValue, someData, sizeof(someData));
+ Block signatureValue = dataBlock(tlv::SignatureValue, someData, sizeof(someData));
b.setValue(signatureValue);
BOOST_CHECK_EQUAL(a == b, false);
BOOST_CHECK_EQUAL(a != b, true);
@@ -277,7 +277,7 @@
ndn::Block block = d.getSignature().getInfo();
block.parse();
KeyLocator keyLocator;
- BOOST_REQUIRE_NO_THROW(keyLocator.wireDecode(block.get(Tlv::KeyLocator)));
+ BOOST_REQUIRE_NO_THROW(keyLocator.wireDecode(block.get(tlv::KeyLocator)));
BOOST_REQUIRE_EQUAL(keyLocator.getName().toUri(), "/test/key/locator");
@@ -301,11 +301,11 @@
d.setContent(Content1, sizeof(Content1));
- Block signatureInfo(Tlv::SignatureInfo);
+ Block signatureInfo(tlv::SignatureInfo);
// SignatureType
{
signatureInfo.push_back
- (nonNegativeIntegerBlock(Tlv::SignatureType, Signature::Sha256WithRsa));
+ (nonNegativeIntegerBlock(tlv::SignatureType, Signature::Sha256WithRsa));
}
// KeyLocator
{
@@ -318,7 +318,7 @@
// SignatureValue
OBufferStream os;
- Tlv::writeVarNumber(os, Tlv::SignatureValue);
+ tlv::writeVarNumber(os, tlv::SignatureValue);
using namespace CryptoPP;
@@ -334,7 +334,7 @@
SecByteBlock buf(length);
signer.Sign(rng_, hash, buf);
- Tlv::writeVarNumber(os, buf.size());
+ tlv::writeVarNumber(os, buf.size());
os.write(reinterpret_cast<const char *>(buf.BytePtr()), buf.size());
ndn::Block signatureValue(Block(os.buf()));
diff --git a/tests/unit-tests/test-interest.cpp b/tests/unit-tests/test-interest.cpp
index 82bf8bd..5430bbd 100644
--- a/tests/unit-tests/test-interest.cpp
+++ b/tests/unit-tests/test-interest.cpp
@@ -425,7 +425,7 @@
const Block& payload = nfd::LocalControlHeader::getPayload(wireBlock);
BOOST_REQUIRE_NE(&payload, &wireBlock);
- BOOST_CHECK_EQUAL(payload.type(), static_cast<uint32_t>(Tlv::Interest));
+ BOOST_CHECK_EQUAL(payload.type(), static_cast<uint32_t>(tlv::Interest));
BOOST_CHECK_EQUAL(wireBlock.type(), static_cast<uint32_t>(tlv::nfd::LocalControlHeader));
Interest interest(payload);
diff --git a/tests/unit-tests/test-signature-info.cpp b/tests/unit-tests/test-signature-info.cpp
index ad7d8f9..fc2cb52 100644
--- a/tests/unit-tests/test-signature-info.cpp
+++ b/tests/unit-tests/test-signature-info.cpp
@@ -48,14 +48,14 @@
BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
BOOST_CHECK_THROW(info.getKeyLocator(), SignatureInfo::Error);
- SignatureInfo sha256Info(Tlv::DigestSha256);
- BOOST_CHECK_EQUAL(sha256Info.getSignatureType(), Tlv::DigestSha256);
+ SignatureInfo sha256Info(tlv::DigestSha256);
+ BOOST_CHECK_EQUAL(sha256Info.getSignatureType(), tlv::DigestSha256);
BOOST_CHECK_EQUAL(sha256Info.hasKeyLocator(), false);
BOOST_CHECK_THROW(sha256Info.getKeyLocator(), SignatureInfo::Error);
KeyLocator keyLocator("/test/key/locator");
- SignatureInfo sha256RsaInfo(Tlv::SignatureSha256WithRsa, keyLocator);
- BOOST_CHECK_EQUAL(sha256RsaInfo.getSignatureType(), Tlv::SignatureSha256WithRsa);
+ SignatureInfo sha256RsaInfo(tlv::SignatureSha256WithRsa, keyLocator);
+ BOOST_CHECK_EQUAL(sha256RsaInfo.getSignatureType(), tlv::SignatureSha256WithRsa);
BOOST_CHECK_EQUAL(sha256RsaInfo.hasKeyLocator(), true);
BOOST_CHECK_NO_THROW(sha256RsaInfo.getKeyLocator());
BOOST_CHECK_EQUAL(sha256RsaInfo.getKeyLocator().getName(), Name("/test/key/locator"));
@@ -69,7 +69,7 @@
encoded.wire() + encoded.size());
sha256RsaInfo = SignatureInfo(sigInfoBlock);
- BOOST_CHECK_EQUAL(sha256RsaInfo.getSignatureType(), Tlv::SignatureSha256WithRsa);
+ BOOST_CHECK_EQUAL(sha256RsaInfo.getSignatureType(), tlv::SignatureSha256WithRsa);
BOOST_CHECK_EQUAL(sha256RsaInfo.hasKeyLocator(), true);
BOOST_CHECK_NO_THROW(sha256RsaInfo.getKeyLocator());
BOOST_CHECK_EQUAL(sha256RsaInfo.getKeyLocator().getName(), Name("/test/key/locator"));
@@ -91,14 +91,14 @@
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72
};
Block errorBlock1(error1, sizeof(error1));
- BOOST_CHECK_THROW(SignatureInfo info(errorBlock1), Tlv::Error);
+ BOOST_CHECK_THROW(SignatureInfo info(errorBlock1), tlv::Error);
const uint8_t error2[] = {
0x16, 0x01, // SignatureInfo
0x01 // Wrong SignatureInfo value
};
Block errorBlock2(error2, sizeof(error2));
- BOOST_CHECK_THROW(SignatureInfo info(errorBlock2), Tlv::Error);
+ BOOST_CHECK_THROW(SignatureInfo info(errorBlock2), tlv::Error);
const uint8_t error3[] = {
0x16, 0x01, // SignatureInfo
@@ -114,13 +114,13 @@
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72
};
Block errorBlock3(error3, sizeof(error3));
- BOOST_CHECK_THROW(SignatureInfo info(errorBlock3), Tlv::Error);
+ BOOST_CHECK_THROW(SignatureInfo info(errorBlock3), tlv::Error);
const uint8_t error4[] = {
0x16, 0x00 // Empty SignatureInfo
};
Block errorBlock4(error4, sizeof(error4));
- BOOST_CHECK_THROW(SignatureInfo info(errorBlock4), Tlv::Error);
+ BOOST_CHECK_THROW(SignatureInfo info(errorBlock4), tlv::Error);
}
@@ -131,8 +131,8 @@
BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
BOOST_CHECK_THROW(info.getKeyLocator(), SignatureInfo::Error);
- info.setSignatureType(Tlv::SignatureSha256WithRsa);
- BOOST_CHECK_EQUAL(info.getSignatureType(), Tlv::SignatureSha256WithRsa);
+ info.setSignatureType(tlv::SignatureSha256WithRsa);
+ BOOST_CHECK_EQUAL(info.getSignatureType(), tlv::SignatureSha256WithRsa);
BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
KeyLocator keyLocator("/test/key/locator");
diff --git a/tests/unit-tests/transport/dummy-face.hpp b/tests/unit-tests/transport/dummy-face.hpp
index fd724b0..faeae55 100644
--- a/tests/unit-tests/transport/dummy-face.hpp
+++ b/tests/unit-tests/transport/dummy-face.hpp
@@ -54,10 +54,10 @@
virtual void
send(const Block& wire)
{
- if (wire.type() == Tlv::Interest) {
+ if (wire.type() == tlv::Interest) {
m_sentInterests->push_back(Interest(wire));
}
- else if (wire.type() == Tlv::Data) {
+ else if (wire.type() == tlv::Data) {
m_sentDatas->push_back(Data(wire));
}
}
diff --git a/tools/tlvdump.cpp b/tools/tlvdump.cpp
index e66482b..0273861 100644
--- a/tools/tlvdump.cpp
+++ b/tools/tlvdump.cpp
@@ -94,10 +94,10 @@
std::cout << " (size: " << block.value_size() << ")";
try {
- // if (block.type() != ndn::Tlv::Content && block.type() != ndn::Tlv::SignatureValue)
+ // if (block.type() != ndn::tlv::Content && block.type() != ndn::tlv::SignatureValue)
block.parse();
}
- catch (ndn::Tlv::Error& e) {
+ catch (ndn::tlv::Error& e) {
// pass (e.g., leaf block reached)
// @todo: Figure how to deterministically figure out that value is not recursive TLV block