Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Junxiao Shi | 1688ded | 2015-03-29 10:09:26 -0700 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of ndn-tools (Named Data Networking Essential Tools). |
| 12 | * See AUTHORS.md for complete list of ndn-tools authors and contributors. |
| 13 | * |
| 14 | * ndn-tools is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | /** |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 26 | * Copyright (c) 2014, Regents of the University of California, |
| 27 | * Arizona Board of Regents, |
| 28 | * Colorado State University, |
| 29 | * University Pierre & Marie Curie, Sorbonne University, |
| 30 | * Washington University in St. Louis, |
| 31 | * Beijing Institute of Technology, |
| 32 | * The University of Memphis |
| 33 | * |
| 34 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 35 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 36 | * |
| 37 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 38 | * of the GNU General Public License as published by the Free Software Foundation, |
| 39 | * either version 3 of the License, or (at your option) any later version. |
| 40 | * |
| 41 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 42 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 43 | * PURPOSE. See the GNU General Public License for more details. |
| 44 | * |
| 45 | * You should have received a copy of the GNU General Public License along with |
| 46 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 47 | * |
| 48 | * @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu> |
| 49 | */ |
| 50 | |
Junxiao Shi | 1753afb | 2015-04-17 20:59:50 -0700 | [diff] [blame] | 51 | #include "core/version.hpp" |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 52 | #include "core/common.hpp" |
| 53 | |
| 54 | #include <ndn-cxx/util/io.hpp> |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 55 | |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 56 | namespace ndn { |
| 57 | namespace peek { |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 58 | |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 59 | class NdnPeek : boost::noncopyable |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 60 | { |
| 61 | public: |
| 62 | explicit |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 63 | NdnPeek(char* programName) |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 64 | : isVerbose(false) |
| 65 | , mustBeFresh(false) |
| 66 | , wantRightmostChild(false) |
| 67 | , wantPayloadOnly(false) |
| 68 | , m_programName(programName) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 69 | , m_minSuffixComponents(-1) |
| 70 | , m_maxSuffixComponents(-1) |
| 71 | , m_interestLifetime(-1) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 72 | , m_timeout(-1) |
| 73 | , m_prefixName("") |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 74 | , m_didReceiveData(false) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 75 | { |
| 76 | } |
| 77 | |
| 78 | void |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 79 | usage(std::ostream& os ,const boost::program_options::options_description& options) const |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 80 | { |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 81 | os << "Usage: " << m_programName << " [options] ndn:/name\n" |
| 82 | " Fetch one data item matching the name prefix and write it to standard output\n" |
| 83 | "\n" |
| 84 | << options; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | void |
| 88 | setMinSuffixComponents(int minSuffixComponents) |
| 89 | { |
| 90 | if (minSuffixComponents < 0) |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 91 | throw std::out_of_range("'minSuffixComponents' must be a non-negative integer"); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 92 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 93 | m_minSuffixComponents = minSuffixComponents; |
| 94 | } |
| 95 | |
| 96 | void |
| 97 | setMaxSuffixComponents(int maxSuffixComponents) |
| 98 | { |
| 99 | if (maxSuffixComponents < 0) |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 100 | throw std::out_of_range("'maxSuffixComponents' must be a non-negative integer"); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 101 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 102 | m_maxSuffixComponents = maxSuffixComponents; |
| 103 | } |
| 104 | |
| 105 | void |
| 106 | setInterestLifetime(int interestLifetime) |
| 107 | { |
| 108 | if (interestLifetime < 0) |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 109 | throw std::out_of_range("'lifetime' must be a non-negative integer"); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 110 | |
| 111 | m_interestLifetime = time::milliseconds(interestLifetime); |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | void |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 115 | setTimeout(int timeout) |
| 116 | { |
| 117 | if (timeout < 0) |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 118 | throw std::out_of_range("'timeout' must be a non-negative integer"); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 119 | |
| 120 | m_timeout = time::milliseconds(timeout); |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 124 | setPrefixName(const std::string& prefixName) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 125 | { |
| 126 | m_prefixName = prefixName; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 129 | time::milliseconds |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 130 | getDefaultInterestLifetime() |
| 131 | { |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 132 | return time::seconds(4); |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 133 | } |
| 134 | |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 135 | Interest |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 136 | createInterestPacket() |
| 137 | { |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 138 | Name interestName(m_prefixName); |
| 139 | Interest interestPacket(interestName); |
| 140 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 141 | if (mustBeFresh) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 142 | interestPacket.setMustBeFresh(true); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 143 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 144 | if (wantRightmostChild) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 145 | interestPacket.setChildSelector(1); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 146 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 147 | if (m_minSuffixComponents >= 0) |
| 148 | interestPacket.setMinSuffixComponents(m_minSuffixComponents); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 149 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 150 | if (m_maxSuffixComponents >= 0) |
| 151 | interestPacket.setMaxSuffixComponents(m_maxSuffixComponents); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 152 | |
| 153 | if (m_interestLifetime < time::milliseconds::zero()) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 154 | interestPacket.setInterestLifetime(getDefaultInterestLifetime()); |
| 155 | else |
| 156 | interestPacket.setInterestLifetime(m_interestLifetime); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 157 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 158 | if (isVerbose) { |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 159 | std::cerr << "INTEREST: " << interestPacket << std::endl; |
| 160 | } |
| 161 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 162 | return interestPacket; |
| 163 | } |
| 164 | |
| 165 | void |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 166 | onData(const Interest& interest, Data& data) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 167 | { |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 168 | m_didReceiveData = true; |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 169 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 170 | if (isVerbose) { |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 171 | std::cerr << "DATA, RTT: " |
| 172 | << time::duration_cast<time::milliseconds>(time::steady_clock::now() - m_expressInterestTime).count() |
| 173 | << "ms" << std::endl; |
| 174 | } |
| 175 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 176 | if (wantPayloadOnly) { |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 177 | const Block& block = data.getContent(); |
| 178 | std::cout.write(reinterpret_cast<const char*>(block.value()), block.value_size()); |
| 179 | } |
| 180 | else { |
| 181 | const Block& block = data.wireEncode(); |
| 182 | std::cout.write(reinterpret_cast<const char*>(block.wire()), block.size()); |
| 183 | } |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | void |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 187 | onTimeout(const Interest& interest) |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 188 | { |
| 189 | } |
| 190 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 191 | int |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 192 | run() |
| 193 | { |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 194 | try { |
| 195 | m_face.expressInterest(createInterestPacket(), |
| 196 | bind(&NdnPeek::onData, this, _1, _2), |
| 197 | bind(&NdnPeek::onTimeout, this, _1)); |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 198 | m_expressInterestTime = time::steady_clock::now(); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 199 | if (m_timeout < time::milliseconds::zero()) { |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 200 | m_timeout = m_interestLifetime < time::milliseconds::zero() ? |
| 201 | getDefaultInterestLifetime() : m_interestLifetime; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 202 | } |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 203 | m_face.processEvents(m_timeout); |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 204 | } |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 205 | catch (const std::exception& e) { |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 206 | std::cerr << "ERROR: " << e.what() << std::endl; |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 207 | return 1; |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 208 | } |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 209 | |
| 210 | if (isVerbose && !m_didReceiveData) { |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 211 | std::cerr << "TIMEOUT" << std::endl; |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 212 | return 3; |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 213 | } |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 214 | |
| 215 | return 0; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 216 | } |
| 217 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 218 | public: |
| 219 | bool isVerbose; |
| 220 | bool mustBeFresh; |
| 221 | bool wantRightmostChild; |
| 222 | bool wantPayloadOnly; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 223 | |
| 224 | private: |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 225 | std::string m_programName; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 226 | int m_minSuffixComponents; |
| 227 | int m_maxSuffixComponents; |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 228 | time::milliseconds m_interestLifetime; |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 229 | time::milliseconds m_timeout; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 230 | std::string m_prefixName; |
Junxiao Shi | e02fb52 | 2015-10-18 08:45:09 -0700 | [diff] [blame] | 231 | time::steady_clock::TimePoint m_expressInterestTime; |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 232 | bool m_didReceiveData; |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 233 | Face m_face; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 234 | }; |
| 235 | |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 236 | int |
| 237 | main(int argc, char* argv[]) |
| 238 | { |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 239 | NdnPeek program(argv[0]); |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 240 | |
| 241 | namespace po = boost::program_options; |
| 242 | |
| 243 | po::options_description visibleOptDesc("Allowed options"); |
| 244 | visibleOptDesc.add_options() |
| 245 | ("help,h", "print help and exit") |
| 246 | ("version,V", "print version and exit") |
| 247 | ("fresh,f", po::bool_switch(&program.mustBeFresh), |
| 248 | "set MustBeFresh") |
| 249 | ("rightmost,r", po::bool_switch(&program.wantRightmostChild), |
| 250 | "set ChildSelector to rightmost") |
| 251 | ("minsuffix,m", po::value<int>()->notifier(bind(&NdnPeek::setMinSuffixComponents, &program, _1)), |
| 252 | "set MinSuffixComponents") |
| 253 | ("maxsuffix,M", po::value<int>()->notifier(bind(&NdnPeek::setMaxSuffixComponents, &program, _1)), |
| 254 | "set MaxSuffixComponents") |
| 255 | ("lifetime,l", po::value<int>()->notifier(bind(&NdnPeek::setInterestLifetime, &program, _1)), |
| 256 | "set InterestLifetime (in milliseconds)") |
| 257 | ("payload,p", po::bool_switch(&program.wantPayloadOnly), |
| 258 | "print payload only, instead of full packet") |
| 259 | ("timeout,w", po::value<int>()->notifier(bind(&NdnPeek::setTimeout, &program, _1)), |
| 260 | "set timeout (in milliseconds)") |
| 261 | ("verbose,v", po::bool_switch(&program.isVerbose), |
| 262 | "turn on verbose output") |
| 263 | ; |
| 264 | |
| 265 | po::options_description hiddenOptDesc("Hidden options"); |
| 266 | hiddenOptDesc.add_options() |
| 267 | ("prefix", po::value<std::string>(), "Interest name"); |
| 268 | |
| 269 | po::options_description optDesc("Allowed options"); |
| 270 | optDesc.add(visibleOptDesc).add(hiddenOptDesc); |
| 271 | |
| 272 | po::positional_options_description optPos; |
| 273 | optPos.add("prefix", -1); |
| 274 | |
| 275 | try { |
| 276 | po::variables_map vm; |
| 277 | po::store(po::command_line_parser(argc, argv).options(optDesc).positional(optPos).run(), vm); |
| 278 | po::notify(vm); |
| 279 | |
| 280 | if (vm.count("help") > 0) { |
| 281 | program.usage(std::cout, visibleOptDesc); |
| 282 | return 0; |
| 283 | } |
| 284 | |
| 285 | if (vm.count("version") > 0) { |
Junxiao Shi | 1753afb | 2015-04-17 20:59:50 -0700 | [diff] [blame] | 286 | std::cout << "ndnpeek " << tools::VERSION << std::endl; |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 287 | return 0; |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 288 | } |
| 289 | |
| 290 | if (vm.count("prefix") > 0) { |
| 291 | std::string prefixName = vm["prefix"].as<std::string>(); |
| 292 | program.setPrefixName(prefixName); |
| 293 | } |
| 294 | else { |
| 295 | throw std::runtime_error("Required argument 'prefix' is missing"); |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 296 | } |
| 297 | } |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 298 | catch (const std::exception& e) { |
| 299 | std::cerr << "ERROR: " << e.what() << std::endl; |
| 300 | program.usage(std::cerr, visibleOptDesc); |
| 301 | return 2; |
| 302 | } |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 303 | |
Teng Liang | d4ab87f | 2016-03-08 18:50:47 -0700 | [diff] [blame^] | 304 | return program.run(); |
Junxiao Shi | 2ac79d9 | 2015-03-23 11:16:18 -0700 | [diff] [blame] | 305 | } |
Junxiao Shi | 0c75f99 | 2015-03-24 21:39:47 -0700 | [diff] [blame] | 306 | |
| 307 | } // namespace peek |
| 308 | } // namespace ndn |
| 309 | |
| 310 | int |
| 311 | main(int argc, char** argv) |
| 312 | { |
| 313 | return ndn::peek::main(argc, argv); |
| 314 | } |