dissect: recognize TLV elements related to Certificate and SafeBag

And drop obsolete types

Change-Id: Iadf2a323a52cd12b93981b99d68103d934d5d508
This commit is contained in:
Davide Pesavento committed 2022-11-30 19:52:35 -05:00
1 parent 6f16856fc2
commit d66fb491df
2 files changed
+33 -29

No files matched your search

+5 -1
View File
@@ -26,7 +26,11 @@ case $(uname) in
esac
export CACHE_DIR=${CACHE_DIR:-/tmp}
[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
if [[ $JOB_NAME == *"code-coverage" ]]; then
export DISABLE_ASAN=yes
export DISABLE_HEADERS_CHECK=yes
fi
for file in .jenkins.d/*; do
[[ -f $file && -x $file ]] || continue
+28 -28
View File
@@ -27,6 +27,7 @@
#include <map>
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/encoding/tlv-security.hpp>
#include <ndn-cxx/util/string-helper.hpp>
namespace ndn::dissect {
@@ -73,10 +74,21 @@ Dissector::printBranches()
}
}
// https://named-data.net/doc/NDN-packet-spec/current/types.html
static const std::map<uint32_t, std::string_view> TLV_DICT = {
{tlv::Interest , "Interest"},
{tlv::Data , "Data"},
{tlv::Name , "Name"},
// Name components
{tlv::GenericNameComponent , "GenericNameComponent"},
{tlv::ImplicitSha256DigestComponent , "ImplicitSha256DigestComponent"},
{tlv::ParametersSha256DigestComponent , "ParametersSha256DigestComponent"},
{tlv::KeywordNameComponent , "KeywordNameComponent"},
{tlv::SegmentNameComponent , "SegmentNameComponent"},
{tlv::ByteOffsetNameComponent , "ByteOffsetNameComponent"},
{tlv::VersionNameComponent , "VersionNameComponent"},
{tlv::TimestampNameComponent , "TimestampNameComponent"},
{tlv::SequenceNumNameComponent , "SequenceNumNameComponent"},
// Interest packet
{tlv::CanBePrefix , "CanBePrefix"},
{tlv::MustBeFresh , "MustBeFresh"},
@@ -95,31 +107,24 @@ static const std::map<uint32_t, std::string_view> TLV_DICT = {
{tlv::ContentType , "ContentType"},
{tlv::FreshnessPeriod , "FreshnessPeriod"},
{tlv::FinalBlockId , "FinalBlockId"},
// (Interest)SignatureInfo elements
// (Interest)SignatureInfo
{tlv::SignatureType , "SignatureType"},
{tlv::KeyLocator , "KeyLocator"},
{tlv::KeyDigest , "KeyDigest"},
{tlv::SignatureNonce , "SignatureNonce"},
{tlv::SignatureTime , "SignatureTime"},
{tlv::SignatureSeqNum , "SignatureSeqNum"},
// Name components
{tlv::GenericNameComponent , "GenericNameComponent"},
{tlv::ImplicitSha256DigestComponent , "ImplicitSha256DigestComponent"},
{tlv::ParametersSha256DigestComponent , "ParametersSha256DigestComponent"},
{tlv::KeywordNameComponent , "KeywordNameComponent"},
{tlv::SegmentNameComponent , "SegmentNameComponent"},
{tlv::ByteOffsetNameComponent , "ByteOffsetNameComponent"},
{tlv::VersionNameComponent , "VersionNameComponent"},
{tlv::TimestampNameComponent , "TimestampNameComponent"},
{tlv::SequenceNumNameComponent , "SequenceNumNameComponent"},
// Deprecated elements
{tlv::Selectors , "Selectors"},
{tlv::MinSuffixComponents , "MinSuffixComponents"},
{tlv::MaxSuffixComponents , "MaxSuffixComponents"},
{tlv::PublisherPublicKeyLocator , "PublisherPublicKeyLocator"},
{tlv::Exclude , "Exclude"},
{tlv::ChildSelector , "ChildSelector"},
{tlv::Any , "Any"},
// Certificate
{tlv::ValidityPeriod , "ValidityPeriod"},
{tlv::NotBefore , "NotBefore"},
{tlv::NotAfter , "NotAfter"},
{tlv::AdditionalDescription , "AdditionalDescription"},
{tlv::DescriptionEntry , "DescriptionEntry"},
{tlv::DescriptionKey , "DescriptionKey"},
{tlv::DescriptionValue , "DescriptionValue"},
// SafeBag
{tlv::security::SafeBag , "SafeBag"},
{tlv::security::EncryptedKey , "EncryptedKey"},
};
void
@@ -131,17 +136,12 @@ Dissector::printType(uint32_t type)
if (it != TLV_DICT.end()) {
m_out << it->second;
}
else if (type < tlv::AppPrivateBlock1) {
m_out << "RESERVED_1";
}
else if (tlv::AppPrivateBlock1 <= type && type < 253) {
m_out << "APP_TAG_1";
}
else if (253 <= type && type < tlv::AppPrivateBlock2) {
m_out << "RESERVED_3";
else if ((type >= tlv::AppPrivateBlock1 && type <= 252) ||
type >= tlv::AppPrivateBlock2) {
m_out << "UNKNOWN_APP";
}
else {
m_out << "APP_TAG_3";
m_out << "RESERVED";
}
m_out << ")";