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/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;