tlv: Another set of changes to update TLV type re-assignment
Change-Id: Ia26fb0a8b30ce98bfe0184950fb975b0029fea2d
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index 890ea84..8a2b3fc 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -25,31 +25,31 @@
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
enum {
- Name = 1,
- NameComponent = 2,
- Interest = 3,
- Data = 4,
- Selectors = 5,
- Nonce = 6,
- Scope = 7,
- InterestLifetime = 8,
- MinSuffixComponents = 9,
- MaxSuffixComponents = 10,
- PublisherPublicKeyLocator = 11,
- Exclude = 12,
- ChildSelector = 13,
- MustBeFresh = 14,
- Any = 15,
- MetaInfo = 16,
- Content = 17,
- SignatureInfo = 18,
- SignatureValue = 19,
- ContentType = 20,
- FreshnessPeriod = 21,
- SignatureType = 22,
- KeyLocator = 23,
- KeyLocatorDigest = 24,
- FinalBlockId = 25,
+ Interest = 5,
+ Data = 6,
+ Name = 7,
+ NameComponent = 8,
+ Selectors = 9,
+ Nonce = 10,
+ Scope = 11,
+ InterestLifetime = 12,
+ MinSuffixComponents = 13,
+ MaxSuffixComponents = 14,
+ PublisherPublicKeyLocator = 15,
+ Exclude = 16,
+ ChildSelector = 17,
+ MustBeFresh = 18,
+ Any = 19,
+ MetaInfo = 20,
+ Content = 21,
+ SignatureInfo = 22,
+ SignatureValue = 23,
+ ContentType = 24,
+ FreshnessPeriod = 25,
+ FinalBlockId = 26,
+ SignatureType = 27,
+ KeyLocator = 28,
+ KeyLocatorDigest = 29,
AppPrivateBlock1 = 128,
AppPrivateBlock2 = 32767
diff --git a/tests/management/test-ndnd-forwarding-entry.cpp b/tests/management/test-ndnd-forwarding-entry.cpp
index 7e2066b..1c1afb8 100644
--- a/tests/management/test-ndnd-forwarding-entry.cpp
+++ b/tests/management/test-ndnd-forwarding-entry.cpp
@@ -20,7 +20,11 @@
namespace ndn {
namespace ndnd {
-const uint8_t FORWARDING_ENTRY[] = {0x81, 0x19, 0x83, 0x07, 0x73, 0x65, 0x6c, 0x66, 0x72, 0x65, 0x67, 0x01, 0x0b, 0x02, 0x01, 0x61, 0x02, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x8a, 0x01, 0x03};
+const uint8_t FORWARDING_ENTRY[] = {0x81, 0x19, 0x83, 0x07, 0x73, 0x65, 0x6c, 0x66, 0x72, 0x65, 0x67,
+ 0x07, 0x0b,
+ 0x08, 0x01, 0x61,
+ 0x08, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
+ 0x8a, 0x01, 0x03};
BOOST_AUTO_TEST_SUITE(TestForwardingEntry)
diff --git a/tests/management/test-nfd-control.cpp b/tests/management/test-nfd-control.cpp
index 735ba18..c41844a 100644
--- a/tests/management/test-nfd-control.cpp
+++ b/tests/management/test-nfd-control.cpp
@@ -18,11 +18,14 @@
BOOST_AUTO_TEST_SUITE(TestNfdControl)
-const uint8_t TestControlResponse[] = {0x65, 0x17, 0x66, 0x02, 0x01, 0x94, 0x67, 0x11, 0x4e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64};
+const uint8_t TestControlResponse[] = {0x65, 0x17,
+ 0x66, 0x02, 0x01, 0x94, 0x67, 0x11, 0x4e, 0x6f, 0x74,
+ 0x68, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x6f, 0x74, 0x20,
+ 0x66, 0x6f, 0x75, 0x6e, 0x64};
const uint8_t TestFibManagementOptions[] = {
- 0x68, 0x1e, 0x01, 0x16, 0x02, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68,
- 0x6f, 0x73, 0x74, 0x02, 0x03, 0x72, 0x65, 0x67, 0x02, 0x04, 0x74, 0x65,
+ 0x68, 0x1e, 0x07, 0x16, 0x08, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68,
+ 0x6f, 0x73, 0x74, 0x08, 0x03, 0x72, 0x65, 0x67, 0x08, 0x04, 0x74, 0x65,
0x73, 0x74, 0x69, 0x01, 0x00, 0x6a, 0x01, 0x00
};
diff --git a/tests/test-data.cpp b/tests/test-data.cpp
index f9dc96a..695a294 100644
--- a/tests/test-data.cpp
+++ b/tests/test-data.cpp
@@ -22,35 +22,34 @@
const uint8_t Content1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
const uint8_t Data1[] = {
-0x04, 0xc5, // NDN Data
- 0x01, 0x14, // Name
- 0x02, 0x05,
+0x06, 0xc5, // NDN Data
+ 0x07, 0x14, // Name
+ 0x08, 0x05,
0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x02, 0x03,
+ 0x08, 0x03,
0x6e, 0x64, 0x6e,
- 0x02, 0x06,
+ 0x08, 0x06,
0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x10, 0x04, // MetaInfo
- 0x15, 0x02, // FreshnessPeriod
+ 0x14, 0x04, // MetaInfo
+ 0x19, 0x02, // FreshnessPeriod
0x27, 0x10,
- 0x11, 0x08, // Content
+ 0x15, 0x08, // Content
0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21,
- 0x12, 0x1b, // SignatureInfo
- 0x16, 0x01, // SignatureType
+ 0x16, 0x1b, // SignatureInfo
+ 0x1b, 0x01, // SignatureType
0x01,
- 0x17, 0x16, // KeyLocator
- 0x01, 0x14, // Name
- 0x02, 0x04,
+ 0x1c, 0x16, // KeyLocator
+ 0x07, 0x14, // Name
+ 0x08, 0x04,
0x74, 0x65, 0x73, 0x74,
- 0x02, 0x03,
+ 0x08, 0x03,
0x6b, 0x65, 0x79,
- 0x02, 0x07,
+ 0x08, 0x07,
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
- 0x13, 0x80, // SignatureValue
- 0x96, 0xa7, 0x5d, 0x91, 0xc1, 0x1c, 0xa9, 0x96, 0x93, 0x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0b, 0xcf, 0x3a, 0x9d, 0x7f, 0xca, 0xbe, 0xa1, 0x41, 0x71, 0x85, 0x7a, 0x8b, 0x5d, 0xa9, 0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8, 0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7, 0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3, 0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
};
-
const unsigned char DEFAULT_PRIVATE_KEY_DER[] = {
0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
0x05, 0x00, 0x04, 0x82, 0x02, 0x5e, 0x30, 0x82, 0x02, 0x5a, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e,
@@ -86,10 +85,10 @@
0xe9, 0x2e, 0x1e, 0xfc, 0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d, 0x0a, 0xb6
};
-const uint8_t MetaInfo1[] = {0x10, 0x04, 0x15, 0x02, 0x27, 0x10};
-const uint8_t MetaInfo2[] = {0x10, 0x14, 0x15, 0x02, 0x27, 0x10, 0x19, 0x0e, 0x02, 0x0c, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
+const uint8_t MetaInfo1[] = {0x14, 0x04, 0x19, 0x02, 0x27, 0x10};
+const uint8_t MetaInfo2[] = {0x14, 0x14, 0x19, 0x02, 0x27, 0x10, 0x1a, 0x0e, 0x08, 0x0c, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
0x2c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21};
-const uint8_t MetaInfo3[] = {0x10, 0x17, 0x14, 0x01, 0x01, 0x15, 0x02, 0x27, 0x10, 0x19, 0x0e, 0x02, 0x0c, 0x68, 0x65,
+const uint8_t MetaInfo3[] = {0x14, 0x17, 0x18, 0x01, 0x01, 0x19, 0x02, 0x27, 0x10, 0x1a, 0x0e, 0x08, 0x0c, 0x68, 0x65,
0x6c, 0x6c, 0x6f, 0x2c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21};
class TestDataFixture
diff --git a/tests/test-interest.cpp b/tests/test-interest.cpp
index 254bd48..2c8f772 100644
--- a/tests/test-interest.cpp
+++ b/tests/test-interest.cpp
@@ -13,32 +13,32 @@
BOOST_AUTO_TEST_SUITE(TestInterest)
const uint8_t Interest1[] = {
- 0x3, 0x41, // NDN Interest
- 0x1, 0x14, // Name
- 0x2, 0x5, // NameComponent
+ 0x05, 0x41, // NDN Interest
+ 0x07, 0x14, // Name
+ 0x08, 0x5, // NameComponent
0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x2, 0x3, // NameComponent
+ 0x08, 0x3, // NameComponent
0x6e, 0x64, 0x6e,
- 0x2, 0x6, // NameComponent
+ 0x08, 0x6, // NameComponent
0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x5, 0x1f, // Selectors
- 0x09, 0x1, 0x1, // MinSuffix
- 0x0a, 0x1, 0x1, // MaxSuffix
- 0x0c, 0x14, // Exclude
- 0x2, 0x4, // NameComponent
+ 0x09, 0x1f, // Selectors
+ 0x0d, 0x1, 0x1, // MinSuffix
+ 0x0e, 0x1, 0x1, // MaxSuffix
+ 0x10, 0x14, // Exclude
+ 0x08, 0x4, // NameComponent
0x61, 0x6c, 0x65, 0x78,
- 0x2, 0x4, // NameComponent
+ 0x08, 0x4, // NameComponent
0x78, 0x78, 0x78, 0x78,
- 0xf, 0x0, // Any
- 0x2, 0x4, // NameComponent
+ 0x13, 0x0, // Any
+ 0x08, 0x4, // NameComponent
0x79, 0x79, 0x79, 0x79,
- 0x0d, 0x1, // ChildSelector
+ 0x11, 0x1, // ChildSelector
0x1,
- 0x6, 0x1, // Nonce
+ 0x0a, 0x1, // Nonce
0x1,
- 0x7, 0x1, // Scope
+ 0x0b, 0x1, // Scope
0x1,
- 0x8, // InterestLifetime
+ 0x0c, // InterestLifetime
0x2, 0x3, 0xe8
};
diff --git a/tests/test-name.cpp b/tests/test-name.cpp
index 961f98e..236f8b1 100644
--- a/tests/test-name.cpp
+++ b/tests/test-name.cpp
@@ -12,15 +12,26 @@
BOOST_AUTO_TEST_SUITE(TestName)
static const uint8_t TestName[] = {
- 0x1, 0x14, // Name
- 0x2, 0x5, // NameComponent
+ 0x7, 0x14, // Name
+ 0x8, 0x5, // NameComponent
0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x2, 0x3, // NameComponent
+ 0x8, 0x3, // NameComponent
0x6e, 0x64, 0x6e,
- 0x2, 0x6, // NameComponent
+ 0x8, 0x6, // NameComponent
0x70, 0x72, 0x65, 0x66, 0x69, 0x78
};
+const uint8_t Name1[] = {0x7, 0x7, // Name
+ 0x8, 0x5, // NameComponent
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c};
+
+const uint8_t Name2[] = {0x7, 0xc, // Name
+ 0x8, 0x5, // NameComponent
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x8, 0x3, // NameComponent
+ 0x6e, 0x64, 0x6e};
+
+
BOOST_AUTO_TEST_CASE (Encode)
{
Name name("/local/ndn/prefix");
@@ -58,24 +69,14 @@
BOOST_AUTO_TEST_CASE (AppendsAndMultiEncode)
{
Name name("/local");
-
- const uint8_t name1[] = {0x1, 0x7, // Name
- 0x2, 0x5, // NameComponent
- 0x6c, 0x6f, 0x63, 0x61, 0x6c};
BOOST_CHECK_EQUAL_COLLECTIONS(name.wireEncode().begin(), name.wireEncode().end(),
- name1, name1 + sizeof(name1));
+ Name1, Name1 + sizeof(Name1));
name.append("ndn");
- const uint8_t name2[] = {0x1, 0xc, // Name
- 0x2, 0x5, // NameComponent
- 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x2, 0x3, // NameComponent
- 0x6e, 0x64, 0x6e};
-
BOOST_CHECK_EQUAL_COLLECTIONS(name.wireEncode().begin(), name.wireEncode().end(),
- name2, name2 + sizeof(name2));
+ Name2, Name2 + sizeof(Name2));
name.append("prefix");
BOOST_CHECK_EQUAL_COLLECTIONS(name.wireEncode().begin(), name.wireEncode().end(),
diff --git a/tools/tlvdump.cpp b/tools/tlvdump.cpp
index 1b94630..6aad8c5 100644
--- a/tools/tlvdump.cpp
+++ b/tools/tlvdump.cpp
@@ -11,35 +11,39 @@
#include <iomanip>
#include <fstream>
-const uint32_t TLV_DICT_SIZE = 26;
+const uint32_t TLV_DICT_SIZE = 30;
const std::string TLV_DICT[TLV_DICT_SIZE] = {
"RESERVED", // = 0
- "Name", // = 1,
- "NameComponent", // = 2,
- "Interest", // = 3,
- "Data", // = 4,
- "Selectors", // = 5,
- "Nonce", // = 6,
- "Scope", // = 7,
- "InterestLifetime", // = 8,
- "MinSuffixComponents", // = 9,
- "MaxSuffixComponents", // = 10,
- "PublisherPublicKeyLocator", // = 11,
- "Exclude", // = 12,
- "ChildSelector", // = 13,
- "MustBeFresh", // = 14,
- "Any", // = 15,
- "MetaInfo", // = 16,
- "Content", // = 17,
- "SignatureInfo", // = 18,
- "SignatureValue", // = 19,
- "ContentType", // = 20,
- "FreshnessPeriod", // = 21,
- "SignatureType", // = 22,
- "KeyLocator", // = 23,
- "KeyLocatorDigest", // = 24
- "FinalBlockId" // = 25
+ "RESERVED", // = 1
+ "RESERVED", // = 2
+ "RESERVED", // = 3
+ "RESERVED", // = 4
+ "Interest", // = 5,
+ "Data", // = 6,
+ "Name", // = 7,
+ "NameComponent", // = 8,
+ "Selectors", // = 9,
+ "Nonce", // = 10,
+ "Scope", // = 11,
+ "InterestLifetime", // = 12,
+ "MinSuffixComponents", // = 13,
+ "MaxSuffixComponents", // = 14,
+ "PublisherPublicKeyLocator", // = 15,
+ "Exclude", // = 16,
+ "ChildSelector", // = 17,
+ "MustBeFresh", // = 18,
+ "Any", // = 19,
+ "MetaInfo", // = 20,
+ "Content", // = 21,
+ "SignatureInfo", // = 22,
+ "SignatureValue", // = 23,
+ "ContentType", // = 24,
+ "FreshnessPeriod", // = 25,
+ "FinalBlockId" // = 26
+ "SignatureType", // = 27,
+ "KeyLocator", // = 28,
+ "KeyLocatorDigest", // = 29
};
void