blob: f62b9b865bfef31f801952300318d0d9df80f4bf [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 /**
Alexander Afanasyev1e7a7b22015-08-26 15:35:26 -070046 * @brief Prints ping results when response received
47 *
Eric Newberry4164b8e2015-04-23 17:29:18 -070048 * @param seq ping sequence number
49 * @param rtt round trip time
50 */
51 void
52 onResponse(uint64_t seq, Rtt rtt);
53
54 /**
Alexander Afanasyev1e7a7b22015-08-26 15:35:26 -070055 * @brief Prints ping results when timed out
56 *
Eric Newberry4164b8e2015-04-23 17:29:18 -070057 * @param seq ping sequence number
58 */
59 void
60 onTimeout(uint64_t seq);
61
62 /**
Alexander Afanasyev1e7a7b22015-08-26 15:35:26 -070063 * @brief Outputs ping errors to cerr
Eric Newberry4164b8e2015-04-23 17:29:18 -070064 */
65 void
66 onError(std::string msg);
67
68private:
69 const Options& m_options;
70};
71
72} // namespace client
73} // namespace ping
74} // namespace ndn
75
76#endif // NDN_TOOLS_PING_CLIENT_TRACER_HPP