tools: delete deprecated ndn-tlv-peek and ndn-tlv-poke

Superseded by ndnpeek and ndnpoke from ndn-tools repo.

Change-Id: Ief379c53d73e0b3e8e0092dfb22b55c6de0de2b1
Refs: #2819
diff --git a/docs/conf.py b/docs/conf.py
index 8fbda38..89dc2a0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -249,8 +249,6 @@
         u'NDN auto-configuration client configuration file', None, 5),
     ('manpages/nfdc', 'nfdc',
         u'NFD utility to manipulate the forwarding table (FIB)', None, 1),
-    ('manpages/ndn-tlv-peek', 'ndn-tlv-peek', u'NFD consumer', None, 1),
-    ('manpages/ndn-tlv-poke', 'ndn-tlv-poke', u'NFD producer', None, 1),
     ('manpages/nfd-autoreg', 'nfd-autoreg', u'NFD Auto-registration Server', None, 1),
     ('manpages/nfd-status-http-server', 'nfd-status-http-server',
         u'NFD status HTTP server', None, 1),
diff --git a/docs/manpages.rst b/docs/manpages.rst
index d3d97a5..7207f34 100644
--- a/docs/manpages.rst
+++ b/docs/manpages.rst
@@ -14,6 +14,4 @@
    manpages/ndn-autoconfig-server
    misc/local-prefix-discovery
    manpages/nfd-autoreg
-   manpages/ndn-tlv-peek
-   manpages/ndn-tlv-poke
    :maxdepth: 1
diff --git a/docs/manpages/ndn-tlv-peek.rst b/docs/manpages/ndn-tlv-peek.rst
deleted file mode 100644
index b2edd2d..0000000
--- a/docs/manpages/ndn-tlv-peek.rst
+++ /dev/null
@@ -1,62 +0,0 @@
-ndn-tlv-peek
-============
-
-Deprecated
-----------
-
-ndn-tlv-peek is deprecated and will be removed in a future release of NFD.
-Please use ``ndnpeek`` program from ndn-tools repository `<https://github.com/named-data/ndn-tools>`__.
-
-Usage
------
-
-::
-
-    ndn-tlv-peek [-h] [-f] [-r] [-m min] [-M max] [-l lifetime] [-p] [-w timeout] name
-
-Description
------------
-
-``ndn-tlv-peek`` is a simple consumer program that sends one Interest and expects one Data
-packet in response.  The full Data packet (in TLV format) is written to stdout.  The
-program terminates with return code 0 if Data arrives, and with return code 1 when timeout
-occurs.
-
-``name`` is interpreted as the Interest name.
-
-Options
--------
-
-``-h``
-  Print help and exit
-
-``-f``
-  If specified, set ``MustBeFresh`` selector in the Interest packet.
-
-``-r``
-  Set ``ChildSelector=1`` (the rightmost child) selector.
-
-``-m``
-  Set ``min`` as the ``MinSuffixComponents`` selector.
-
-``-M``
-  Set ``max`` as the ``MaxSuffixComponents`` selector.
-
-``-l``
-  Set ``lifetime`` (in milliseconds) as the ``InterestLifetime``.
-
-``-p``
-  If specified, print the received payload only, not the full packet.
-
-``-w``
-  Timeout after ``timeout`` milliseconds.
-
-
-Examples
---------
-
-Send Interest for ``ndn:/app1/video`` and print the received payload only
-
-::
-
-    ndn-tlv-peek -p ndn:/app1/video
diff --git a/docs/manpages/ndn-tlv-poke.rst b/docs/manpages/ndn-tlv-poke.rst
deleted file mode 100644
index f43117d..0000000
--- a/docs/manpages/ndn-tlv-poke.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-ndn-tlv-poke
-============
-
-Deprecated
-----------
-
-ndn-tlv-poke is deprecated and will be removed in a future release of NFD.
-Please use ``ndnpoke`` program from ndn-tools repository `<https://github.com/named-data/ndn-tools>`__.
-
-Usage
------
-
-::
-
-    ndn-tlv-poke [-h] [-f] [-D] [-i identity] [-F] [-x freshness] [-w timeout] name
-
-Description
------------
-
-``ndn-tlv-poke`` is a simple producer program that reads payload from stdin and publishes it
-as a single NDN Data packet.  The Data packet is published either as a response to the
-incoming Interest for the given ``name``, or forcefully pushed to the local NDN
-forwarder's cache if ``-f`` flag is specified.
-
-The program terminates with return code 0 if Data is sent and with return code 1 when
-timeout occurs.
-
-Options
--------
-
-``-h``
-  Print usage and exit.
-
-``-f``
-  If specified, send Data without waiting for Interest.
-
-``-D``
-  If specified, use ``DigestSha256`` signature instead of default ``SignatureSha256WithRsa``.
-
-``-i``
-  Use ``identity`` to sign the created Data packet.
-
-``-F``
-  Set ``FinalBlockId`` to the last component of specified name.
-
-``-x``
-  Set ``FreshnessPeriod`` in milliseconds.
-
-``-w``
-  Wait at most ``timeout`` milliseconds for the incoming Interest.  If no Interest arrives
-  within the ``timeout``, the Data packet will not be published.
-
-
-Examples
---------
-
-Create Data packet with content ``hello`` with the name ``ndn:/app/video`` and wait at
-most 3 seconds for the incoming Interest for it::
-
-    echo "Hello" | build/bin/ndn-tlv-poke -w 3000 ndn:/app/video
diff --git a/tools/ndn-tlv-peek.cpp b/tools/ndn-tlv-peek.cpp
deleted file mode 100644
index ee37bbc..0000000
--- a/tools/ndn-tlv-peek.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "version.hpp"
-
-#include <boost/noncopyable.hpp>
-
-#include <ndn-cxx/face.hpp>
-
-namespace ndntlvpeek {
-
-class NdnTlvPeek : boost::noncopyable
-{
-public:
-  explicit
-  NdnTlvPeek(char* programName)
-    : m_programName(programName)
-    , m_mustBeFresh(false)
-    , m_isChildSelectorRightmost(false)
-    , m_minSuffixComponents(-1)
-    , m_maxSuffixComponents(-1)
-    , m_interestLifetime(-1)
-    , m_isPayloadOnlySet(false)
-    , m_timeout(-1)
-    , m_prefixName("")
-    , m_isDataReceived(false)
-  {
-  }
-
-  void
-  usage()
-  {
-    std::cout << "\n Usage:\n " << m_programName << " "
-      "[-f] [-r] [-m min] [-M max] [-l lifetime] [-p] [-w timeout] ndn:/name\n"
-      "   Get one data item matching the name prefix and write it to stdout\n"
-      "   [-f]          - set MustBeFresh\n"
-      "   [-r]          - set ChildSelector to select rightmost child\n"
-      "   [-m min]      - set MinSuffixComponents\n"
-      "   [-M max]      - set MaxSuffixComponents\n"
-      "   [-l lifetime] - set InterestLifetime in time::milliseconds\n"
-      "   [-p]          - print payload only, not full packet\n"
-      "   [-w timeout]  - set Timeout in time::milliseconds\n"
-      "   [-h]          - print help and exit\n"
-      "   [-V]          - print version and exit\n"
-      "\n";
-    exit(1);
-  }
-
-  void
-  setMustBeFresh()
-  {
-    m_mustBeFresh = true;
-  }
-
-  void
-  setRightmostChildSelector()
-  {
-    m_isChildSelectorRightmost = true;
-  }
-
-  void
-  setMinSuffixComponents(int minSuffixComponents)
-  {
-    if (minSuffixComponents < 0)
-      usage();
-    m_minSuffixComponents = minSuffixComponents;
-  }
-
-  void
-  setMaxSuffixComponents(int maxSuffixComponents)
-  {
-    if (maxSuffixComponents < 0)
-      usage();
-    m_maxSuffixComponents = maxSuffixComponents;
-  }
-
-  void
-  setInterestLifetime(int interestLifetime)
-  {
-    if (interestLifetime < 0)
-      usage();
-    m_interestLifetime = ndn::time::milliseconds(interestLifetime);
-  }
-
-  void
-  setPayloadOnly()
-  {
-    m_isPayloadOnlySet = true;
-  }
-
-  void
-  setTimeout(int timeout)
-  {
-    if (timeout < 0)
-      usage();
-    m_timeout = ndn::time::milliseconds(timeout);
-  }
-
-  void
-  setPrefixName(char* prefixName)
-  {
-    m_prefixName = prefixName;
-    if (m_prefixName.length() == 0)
-      usage();
-  }
-
-  ndn::time::milliseconds
-  getDefaultInterestLifetime()
-  {
-    return ndn::time::seconds(4);
-  }
-
-  ndn::Interest
-  createInterestPacket()
-  {
-    ndn::Name interestName(m_prefixName);
-    ndn::Interest interestPacket(interestName);
-    if (m_mustBeFresh)
-      interestPacket.setMustBeFresh(true);
-    if (m_isChildSelectorRightmost)
-      interestPacket.setChildSelector(1);
-    if (m_minSuffixComponents >= 0)
-      interestPacket.setMinSuffixComponents(m_minSuffixComponents);
-    if (m_maxSuffixComponents >= 0)
-      interestPacket.setMaxSuffixComponents(m_maxSuffixComponents);
-    if (m_interestLifetime < ndn::time::milliseconds::zero())
-      interestPacket.setInterestLifetime(getDefaultInterestLifetime());
-    else
-      interestPacket.setInterestLifetime(m_interestLifetime);
-    return interestPacket;
-  }
-
-  void
-  onData(const ndn::Interest& interest, ndn::Data& data)
-  {
-    m_isDataReceived = true;
-    if (m_isPayloadOnlySet)
-      {
-        const ndn::Block& block = data.getContent();
-        std::cout.write(reinterpret_cast<const char*>(block.value()), block.value_size());
-      }
-    else
-      {
-        const ndn::Block& block = data.wireEncode();
-        std::cout.write(reinterpret_cast<const char*>(block.wire()), block.size());
-      }
-  }
-
-  void
-  onTimeout(const ndn::Interest& interest)
-  {
-  }
-
-  void
-  run()
-  {
-    try
-      {
-        m_face.expressInterest(createInterestPacket(),
-                               bind(&NdnTlvPeek::onData, this, _1, _2),
-                               bind(&NdnTlvPeek::onTimeout, this, _1));
-        if (m_timeout < ndn::time::milliseconds::zero())
-          {
-            if (m_interestLifetime < ndn::time::milliseconds::zero())
-              m_face.processEvents(getDefaultInterestLifetime());
-            else
-              m_face.processEvents(m_interestLifetime);
-          }
-        else
-          m_face.processEvents(m_timeout);
-      }
-    catch (std::exception& e)
-      {
-        std::cerr << "ERROR: " << e.what() << "\n" << std::endl;
-        exit(1);
-      }
-  }
-
-  bool
-  isDataReceived() const
-  {
-    return m_isDataReceived;
-  }
-
-private:
-
-  std::string m_programName;
-  bool m_mustBeFresh;
-  bool m_isChildSelectorRightmost;
-  int m_minSuffixComponents;
-  int m_maxSuffixComponents;
-  ndn::time::milliseconds m_interestLifetime;
-  bool m_isPayloadOnlySet;
-  ndn::time::milliseconds m_timeout;
-  std::string m_prefixName;
-  bool m_isDataReceived;
-  ndn::Face m_face;
-};
-
-}
-
-int
-main(int argc, char* argv[])
-{
-  std::cerr << "ndn-tlv-peek is deprecated. Use ndnpeek program from ndn-tools repository.\n"
-               "See `man ndn-tlv-peek` for details." << std::endl;
-
-  ndntlvpeek::NdnTlvPeek ndnTlvPeek(argv[0]);
-  int option;
-  while ((option = getopt(argc, argv, "hfrm:M:l:pw:V")) != -1) {
-    switch (option) {
-    case 'h':
-      ndnTlvPeek.usage();
-      break;
-    case 'f':
-      ndnTlvPeek.setMustBeFresh();
-      break;
-    case 'r':
-      ndnTlvPeek.setRightmostChildSelector();
-      break;
-    case 'm':
-      ndnTlvPeek.setMinSuffixComponents(atoi(optarg));
-      break;
-    case 'M':
-      ndnTlvPeek.setMaxSuffixComponents(atoi(optarg));
-      break;
-    case 'l':
-      ndnTlvPeek.setInterestLifetime(atoi(optarg));
-      break;
-    case 'p':
-      ndnTlvPeek.setPayloadOnly();
-      break;
-    case 'w':
-      ndnTlvPeek.setTimeout(atoi(optarg));
-      break;
-    case 'V':
-      std::cout << NFD_VERSION_BUILD_STRING << std::endl;
-      return 0;
-    default:
-      ndnTlvPeek.usage();
-      break;
-    }
-  }
-
-  argc -= optind;
-  argv += optind;
-
-  if (argv[0] == 0)
-    ndnTlvPeek.usage();
-
-  ndnTlvPeek.setPrefixName(argv[0]);
-  ndnTlvPeek.run();
-
-  if (ndnTlvPeek.isDataReceived())
-    return 0;
-  else
-    return 1;
-}
diff --git a/tools/ndn-tlv-poke.cpp b/tools/ndn-tlv-poke.cpp
deleted file mode 100644
index da74c32..0000000
--- a/tools/ndn-tlv-poke.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "version.hpp"
-
-#include <boost/noncopyable.hpp>
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-
-namespace ndntlvpoke {
-
-class NdnTlvPoke : boost::noncopyable
-{
-public:
-  explicit
-  NdnTlvPoke(char* programName)
-    : m_programName(programName)
-    , m_isForceDataSet(false)
-    , m_isUseDigestSha256Set(false)
-    , m_isLastAsFinalBlockIdSet(false)
-    , m_freshnessPeriod(-1)
-    , m_timeout(-1)
-    , m_isDataSent(false)
-  {
-  }
-
-  void
-  usage()
-  {
-    std::cout << "\n Usage:\n " << m_programName << " "
-      "[-f] [-D] [-i identity] [-F] [-x freshness] [-w timeout] ndn:/name\n"
-      "   Reads payload from stdin and sends it to local NDN forwarder as a "
-      "single Data packet\n"
-      "   [-f]          - force, send Data without waiting for Interest\n"
-      "   [-D]          - use DigestSha256 signing method instead of "
-      "SignatureSha256WithRsa\n"
-      "   [-i identity] - set identity to be used for signing\n"
-      "   [-F]          - set FinalBlockId to the last component of Name\n"
-      "   [-x]          - set FreshnessPeriod in time::milliseconds\n"
-      "   [-w timeout]  - set Timeout in time::milliseconds\n"
-      "   [-h]          - print help and exit\n"
-      "   [-V]          - print version and exit\n"
-      "\n";
-    exit(1);
-  }
-
-  void
-  setForceData()
-  {
-    m_isForceDataSet = true;
-  }
-
-  void
-  setUseDigestSha256()
-  {
-    m_isUseDigestSha256Set = true;
-  }
-
-  void
-  setIdentityName(char* identityName)
-  {
-    m_identityName = ndn::make_shared<ndn::Name>(identityName);
-  }
-
-  void
-  setLastAsFinalBlockId()
-  {
-    m_isLastAsFinalBlockIdSet = true;
-  }
-
-  void
-  setFreshnessPeriod(int freshnessPeriod)
-  {
-    if (freshnessPeriod < 0)
-      usage();
-    m_freshnessPeriod = ndn::time::milliseconds(freshnessPeriod);
-  }
-
-  void
-  setTimeout(int timeout)
-  {
-    if (timeout < 0)
-      usage();
-    m_timeout = ndn::time::milliseconds(timeout);
-  }
-
-  void
-  setPrefixName(char* prefixName)
-  {
-    m_prefixName = ndn::Name(prefixName);
-  }
-
-  ndn::time::milliseconds
-  getDefaultTimeout()
-  {
-    return ndn::time::seconds(10);
-  }
-
-  ndn::Data
-  createDataPacket()
-  {
-    ndn::Data dataPacket(m_prefixName);
-    std::stringstream payloadStream;
-    payloadStream << std::cin.rdbuf();
-    std::string payload = payloadStream.str();
-    dataPacket.setContent(reinterpret_cast<const uint8_t*>(payload.c_str()), payload.length());
-    if (m_freshnessPeriod >= ndn::time::milliseconds::zero())
-      dataPacket.setFreshnessPeriod(m_freshnessPeriod);
-    if (m_isLastAsFinalBlockIdSet)
-      {
-        if (!m_prefixName.empty())
-          dataPacket.setFinalBlockId(m_prefixName.get(-1));
-        else
-          {
-            std::cerr << "Name Provided Has 0 Components" << std::endl;
-            exit(1);
-          }
-      }
-    if (m_isUseDigestSha256Set)
-      m_keyChain.signWithSha256(dataPacket);
-    else
-      {
-        if (!static_cast<bool>(m_identityName))
-          m_keyChain.sign(dataPacket);
-        else
-          m_keyChain.signByIdentity(dataPacket, *m_identityName);
-      }
-    return dataPacket;
-  }
-
-  void
-  onInterest(const ndn::Name& name,
-             const ndn::Interest& interest,
-             const ndn::Data& dataPacket)
-  {
-    m_face.put(dataPacket);
-    m_isDataSent = true;
-    m_face.shutdown();
-  }
-
-  void
-  onRegisterFailed(const ndn::Name& prefix, const std::string& reason)
-  {
-    std::cerr << "Prefix Registration Failure." << std::endl;
-    std::cerr << "Reason = " << reason << std::endl;
-  }
-
-  void
-  run()
-  {
-    try
-      {
-        ndn::Data dataPacket = createDataPacket();
-        if (m_isForceDataSet)
-          {
-            m_face.put(dataPacket);
-            m_isDataSent = true;
-          }
-        else
-          {
-            m_face.setInterestFilter(m_prefixName,
-                                     bind(&NdnTlvPoke::onInterest, this, _1, _2, dataPacket),
-                                     ndn::RegisterPrefixSuccessCallback(),
-                                     bind(&NdnTlvPoke::onRegisterFailed, this, _1, _2));
-          }
-        if (m_timeout < ndn::time::milliseconds::zero())
-          m_face.processEvents(getDefaultTimeout());
-        else
-          m_face.processEvents(m_timeout);
-      }
-    catch (std::exception& e)
-      {
-        std::cerr << "ERROR: " << e.what() << "\n" << std::endl;
-        exit(1);
-      }
-  }
-
-  bool
-  isDataSent() const
-  {
-    return m_isDataSent;
-  }
-
-private:
-
-  ndn::KeyChain m_keyChain;
-  std::string m_programName;
-  bool m_isForceDataSet;
-  bool m_isUseDigestSha256Set;
-  ndn::shared_ptr<ndn::Name> m_identityName;
-  bool m_isLastAsFinalBlockIdSet;
-  ndn::time::milliseconds m_freshnessPeriod;
-  ndn::time::milliseconds m_timeout;
-  ndn::Name m_prefixName;
-  bool m_isDataSent;
-  ndn::Face m_face;
-
-};
-
-}
-
-int
-main(int argc, char* argv[])
-{
-  std::cerr << "ndn-tlv-poke is deprecated. Use ndnpoke program from ndn-tools repository.\n"
-               "See `man ndn-tlv-poke` for details." << std::endl;
-
-  int option;
-  ndntlvpoke::NdnTlvPoke ndnTlvPoke(argv[0]);
-  while ((option = getopt(argc, argv, "hfDi:Fx:w:V")) != -1) {
-    switch (option) {
-    case 'h':
-      ndnTlvPoke.usage();
-      break;
-    case 'f':
-      ndnTlvPoke.setForceData();
-      break;
-    case 'D':
-      ndnTlvPoke.setUseDigestSha256();
-      break;
-    case 'i':
-      ndnTlvPoke.setIdentityName(optarg);
-      break;
-    case 'F':
-      ndnTlvPoke.setLastAsFinalBlockId();
-      break;
-    case 'x':
-      ndnTlvPoke.setFreshnessPeriod(atoi(optarg));
-      break;
-    case 'w':
-      ndnTlvPoke.setTimeout(atoi(optarg));
-      break;
-    case 'V':
-      std::cout << NFD_VERSION_BUILD_STRING << std::endl;
-      return 0;
-    default:
-      ndnTlvPoke.usage();
-      break;
-    }
-  }
-
-  argc -= optind;
-  argv += optind;
-
-  if (argv[0] == 0)
-    ndnTlvPoke.usage();
-
-  ndnTlvPoke.setPrefixName(argv[0]);
-  ndnTlvPoke.run();
-
-  if (ndnTlvPoke.isDataSent())
-    return 0;
-  else
-    return 1;
-}