blob: 5a8cd352ccddec0b37c00091d2d83de3968c3503 [file] [log] [blame]
Eric Newberry4164b8e2015-04-23 17:29:18 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2015, Arizona Board of Regents.
4 *
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 * @author: Eric Newberry <enewberry@email.arizona.edu>
20 */
21
22#ifndef NDN_TOOLS_PING_CLIENT_TRACER_HPP
23#define NDN_TOOLS_PING_CLIENT_TRACER_HPP
24
25#include "core/common.hpp"
26
27#include "ping.hpp"
28
29namespace ndn {
30namespace ping {
31namespace client {
32
33/**
34 * @brief prints ping responses and timeouts
35 */
36class Tracer : noncopyable
37{
38public:
39 /**
40 * @param ping NDN ping client
41 * @param options ping client options
42 */
43 Tracer(Ping& ping, const Options& options);
44
45 /**
46 * Prints ping results when response received
47 * @param seq ping sequence number
48 * @param rtt round trip time
49 */
50 void
51 onResponse(uint64_t seq, Rtt rtt);
52
53 /**
54 * Prints ping results when timed out
55 * @param seq ping sequence number
56 */
57 void
58 onTimeout(uint64_t seq);
59
60 /**
61 * Outputs ping errors to cerr
62 */
63 void
64 onError(std::string msg);
65
66private:
67 const Options& m_options;
68};
69
70} // namespace client
71} // namespace ping
72} // namespace ndn
73
74#endif // NDN_TOOLS_PING_CLIENT_TRACER_HPP