tools: delete deprecated tlvdump
Superseded by ndn-dissect from ndn-tools repo.
Change-Id: I9e6a5e0c9bdcf36416ca3fc0557a4f4cf7ac4cc2
Refs: #2819
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index a4f422d..bfc57a0 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -176,8 +176,6 @@
configured properly (or ``<LIBPATH>/pkgconfig`` is a default path),
``pkgconfig --libs --clflags libndn-cxx`` will return all necessary
compile and link flags for the library.
-- ``<BINPATH>/tlvdump``: a simple tool to dump contents of
- TLV-formatted data
- ``<BINPATH>/ndncatchunks3``: a simplified equivalent to ndncatchunks2
in NDNx package
- ``<BINPATH>/ndnputchunks3``: a simplified equivalent to ndnputchunks2
diff --git a/docs/conf.py b/docs/conf.py
index 7e419dd..d0d0818 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -254,7 +254,6 @@
('manpages/ndnsec-unlock-tpm', 'ndnsec-unlock-tpm', 'part of NDN security tools', None, 1),
('tutorials/security-validator-config', 'ndnsec-validator.conf',
'NDN trust validator configuration file', None, 5),
- ('manpages/tlvdump', 'tlvdump', 'Decode structure of TLV encoded buffer', None, 1),
('manpages/ndn-client.conf', 'ndn-client.conf', 'Configuration file for NDN platform', None, 5),
]
diff --git a/docs/manpages.rst b/docs/manpages.rst
index d7fb610..450d20d 100644
--- a/docs/manpages.rst
+++ b/docs/manpages.rst
@@ -19,7 +19,6 @@
ndnsec-import <manpages/ndnsec-import>
ndnsec-unlock-tpm <manpages/ndnsec-unlock-tpm>
ndnsec-set-acl <manpages/ndnsec-set-acl>
- manpages/tlvdump
:maxdepth: 1
..
diff --git a/docs/manpages/tlvdump.rst b/docs/manpages/tlvdump.rst
deleted file mode 100644
index 92c7225..0000000
--- a/docs/manpages/tlvdump.rst
+++ /dev/null
@@ -1,52 +0,0 @@
-tlvdump
-=======
-
-``tlvdump`` is a simple application allowing to decode structure of TLV-encoded packet.
-
-Deprecated
-----------
-
-tlvdump is deprecated and will be removed in a future release of ndn-cxx.
-Please use ``ndn-dissect`` program from ndn-tools repository `<https://github.com/named-data/ndn-tools>`__.
-
-Usage
------
-
-::
-
- tlvdump [filename]
-
-Description
------------
-
-If filename is specified, ``tlvdump`` will attempt to read and decode content of the file,
-otherwise data will be read from standard input.
-
-Example
--------
-
-::
-
- $ tlvdump interest.tlv
- 5 (Interest) (size: 89)
- 7 (Name) (size: 20)
- 8 (NameComponent) (size: 5) [[local]]
- 8 (NameComponent) (size: 3) [[ndn]]
- 8 (NameComponent) (size: 6) [[prefix]]
- 9 (Selectors) (size: 55)
- 13 (MinSuffixComponents) (size: 1) [[%01]]
- 14 (MaxSuffixComponents) (size: 1) [[%01]]
- 28 (KeyLocatorDigest) (size: 22)
- 7 (Name) (size: 20)
- 8 (NameComponent) (size: 4) [[test]]
- 8 (NameComponent) (size: 3) [[key]]
- 8 (NameComponent) (size: 7) [[locator]]
- 16 (Exclude) (size: 20)
- 8 (NameComponent) (size: 4) [[alex]]
- 8 (NameComponent) (size: 4) [[xxxx]]
- 19 (Any) (size: 0) [[...]]
- 8 (NameComponent) (size: 4) [[yyyy]]
- 17 (ChildSelector) (size: 1) [[%01]]
- 10 (Nonce) (size: 1) [[%01]]
- 11 (Scope) (size: 1) [[%01]]
- 12 (InterestLifetime) (size: 2) [[%03%E8]]
diff --git a/tools/tlvdump.cpp b/tools/tlvdump.cpp
deleted file mode 100644
index ee5088c..0000000
--- a/tools/tlvdump.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
- */
-
-#include "face.hpp"
-#include "encoding/block.hpp"
-
-#include <iomanip>
-#include <fstream>
-#include <map>
-
-namespace ndn {
-
-std::map<uint32_t, std::string> TLV_DICT = {
- {tlv::Interest , "Interest"},
- {tlv::Data , "Data"},
- {tlv::Name , "Name"},
- {tlv::NameComponent , "NameComponent"},
- {tlv::ImplicitSha256DigestComponent, "ImplicitSha256DigestComponent"},
- {tlv::Selectors , "Selectors"},
- {tlv::Nonce , "Nonce"},
- {tlv::InterestLifetime , "InterestLifetime"},
- {tlv::MinSuffixComponents , "MinSuffixComponents"},
- {tlv::MaxSuffixComponents , "MaxSuffixComponents"},
- {tlv::PublisherPublicKeyLocator , "PublisherPublicKeyLocator"},
- {tlv::Exclude , "Exclude"},
- {tlv::ChildSelector , "ChildSelector"},
- {tlv::MustBeFresh , "MustBeFresh"},
- {tlv::Any , "Any"},
- {tlv::MetaInfo , "MetaInfo"},
- {tlv::Content , "Content"},
- {tlv::SignatureInfo , "SignatureInfo"},
- {tlv::SignatureValue , "SignatureValue"},
- {tlv::ContentType , "ContentType"},
- {tlv::FreshnessPeriod , "FreshnessPeriod"},
- {tlv::FinalBlockId , "FinalBlockId"},
- {tlv::SignatureType , "SignatureType"},
- {tlv::KeyLocator , "KeyLocator"},
- {tlv::KeyDigest , "KeyDigest"},
-};
-
-void
-printTypeInfo(uint32_t type)
-{
- std::cout << type << " (";
-
- if (TLV_DICT.count(type) != 0) {
- std::cout << TLV_DICT[type];
- }
- else if (type < tlv::AppPrivateBlock1) {
- std::cout << "RESERVED_1";
- }
- else if (tlv::AppPrivateBlock1 <= type && type < 253) {
- std::cout << "APP_TAG_1";
- }
- else if (253 <= type && type < tlv::AppPrivateBlock2) {
- std::cout << "RESERVED_3";
- }
- else {
- std::cout << "APP_TAG_3";
- }
- std::cout << ")";
-}
-
-
-void
-BlockPrinter(const Block& block, const std::string& indent = "")
-{
- std::cout << indent;
- printTypeInfo(block.type());
- std::cout << " (size: " << block.value_size() << ")";
-
- try {
- // if (block.type() != tlv::Content && block.type() != tlv::SignatureValue)
- block.parse();
- }
- catch (tlv::Error& e) {
- // pass (e.g., leaf block reached)
-
- // @todo: Figure how to deterministically figure out that value is not recursive TLV block
- }
-
- if (block.elements().empty())
- {
- std::cout << " [[";
- name::Component(block.value(), block.value_size()).toUri(std::cout);
- std::cout<< "]]";
- }
- std::cout << std::endl;
-
- for (Block::element_const_iterator i = block.elements_begin();
- i != block.elements_end();
- ++i)
- {
- BlockPrinter(*i, indent+" ");
- }
-}
-
-void
-HexPrinter(const Block& block, const std::string& indent = "")
-{
- std::cout << indent;
- for (Buffer::const_iterator i = block.begin (); i != block.value_begin(); ++i)
- {
- std::cout << "0x";
- std::cout << std::noshowbase << std::hex << std::setw(2) <<
- std::setfill('0') << static_cast<int>(*i);
- std::cout << ", ";
- }
- std::cout << "\n";
-
- if (block.elements_size() == 0 && block.value_size() > 0)
- {
- std::cout << indent << " ";
- for (Buffer::const_iterator i = block.value_begin (); i != block.value_end(); ++i)
- {
- std::cout << "0x";
- std::cout << std::noshowbase << std::hex << std::setw(2) <<
- std::setfill('0') << static_cast<int>(*i);
- std::cout << ", ";
- }
- std::cout << "\n";
- }
- else
- {
- for (Block::element_const_iterator i = block.elements_begin();
- i != block.elements_end();
- ++i)
- {
- HexPrinter(*i, indent+" ");
- }
- }
-}
-
-void
-parseBlocksFromStream(std::istream& is)
-{
- while (is.peek() != std::char_traits<char>::eof()) {
- try {
- Block block = Block::fromStream(is);
- BlockPrinter(block, "");
- // HexPrinter(block, "");
- }
- catch (std::exception& e) {
- std::cerr << "ERROR: " << e.what() << std::endl;
- }
- }
-
-}
-
-} // namespace ndn
-
-int main(int argc, const char *argv[])
-{
- std::cerr << "tlvdump is deprecated. Use ndn-dissect program from ndn-tools repository.\n"
- "See `man tlvdump` for details." << std::endl;
-
- if (argc == 1 ||
- (argc == 2 && std::string(argv[1]) == "-"))
- {
- ndn::parseBlocksFromStream(std::cin);
- }
- else
- {
- std::ifstream file(argv[1]);
- ndn::parseBlocksFromStream(file);
- }
-
- return 0;
-}