blob: e09c48101080d57dda61ad8209017b789e6e9815 [file] [log] [blame]
Eric Newberry94996d62015-05-07 13:48:46 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento5923bf82018-08-09 01:55:44 -04002/*
Davide Pesavento5748e822024-01-26 18:40:22 -05003 * Copyright (c) 2015-2024, Arizona Board of Regents.
Eric Newberry94996d62015-05-07 13:48:46 -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 * @author Eric Newberry <enewberry@email.arizona.edu>
20 */
21
22#include "tracer.hpp"
23
Davide Pesavento5748e822024-01-26 18:40:22 -050024#include <iostream>
25
Davide Pesaventob3570c62022-02-19 19:19:00 -050026namespace ndn::ping::server {
Eric Newberry94996d62015-05-07 13:48:46 -070027
28Tracer::Tracer(PingServer& pingServer, const Options& options)
29 : m_options(options)
30{
Davide Pesavento2bdda1d2018-08-09 19:35:49 -040031 if (!m_options.wantQuiet) {
Davide Pesaventof8d9a532021-07-03 16:04:12 -040032 pingServer.afterReceive.connect([this] (const Name& name) {
33 if (m_options.wantTimestamp) {
34 std::cout << time::toIsoString(time::system_clock::now()) << " - ";
35 }
36 std::cout << "interest received: seq=" << name.at(-1) << "\n";
37 });
Davide Pesavento2bdda1d2018-08-09 19:35:49 -040038 }
Eric Newberry94996d62015-05-07 13:48:46 -070039}
40
Davide Pesaventob3570c62022-02-19 19:19:00 -050041} // namespace ndn::ping::server