blob: 29c5e6a60f971984cb4e8756b035567ee87f68b4 [file] [log] [blame]
Junxiao Shi78c78cc2015-06-19 15:53:53 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento7ef5cf72021-01-29 00:20:24 -05002/*
3 * Copyright (c) 2014-2021, Regents of the University of California.
Junxiao Shi78c78cc2015-06-19 15:53:53 -07004 *
5 * This file is part of ndn-tools (Named Data Networking Essential Tools).
6 * See AUTHORS.md for complete list of ndn-tools authors and contributors.
7 *
8 * ndn-tools is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
Davide Pesaventoc0702702017-08-24 22:04:00 -040020#ifndef NDN_TOOLS_DISSECT_NDN_DISSECT_HPP
21#define NDN_TOOLS_DISSECT_NDN_DISSECT_HPP
22
23#include "core/common.hpp"
24
Junxiao Shi78c78cc2015-06-19 15:53:53 -070025#include <ndn-cxx/encoding/block.hpp>
Junxiao Shi78c78cc2015-06-19 15:53:53 -070026
27namespace ndn {
28namespace dissect {
29
30class NdnDissect : noncopyable
31{
32public:
Davide Pesavento7ef5cf72021-01-29 00:20:24 -050033 NdnDissect(std::istream& input, std::ostream& output);
34
Junxiao Shi78c78cc2015-06-19 15:53:53 -070035 void
Davide Pesavento7ef5cf72021-01-29 00:20:24 -050036 dissect();
Junxiao Shi78c78cc2015-06-19 15:53:53 -070037
38private:
39 void
Davide Pesavento7ef5cf72021-01-29 00:20:24 -050040 printBranches();
Junxiao Shi78c78cc2015-06-19 15:53:53 -070041
42 void
Davide Pesavento7ef5cf72021-01-29 00:20:24 -050043 printType(uint32_t type);
44
45 void
46 printBlock(const Block& block);
47
48private:
49 std::istream& m_in;
50 std::ostream& m_out;
51
52 // m_branches[i] is true iff the i-th level of the tree has more branches after the current one
53 std::vector<bool> m_branches;
Junxiao Shi78c78cc2015-06-19 15:53:53 -070054};
55
56} // namespace dissect
57} // namespace ndn
Davide Pesaventoc0702702017-08-24 22:04:00 -040058
59#endif // NDN_TOOLS_DISSECT_NDN_DISSECT_HPP