blob: 5b33784575a86b9cc1cd2cd61cc27c6141656c22 [file] [log] [blame]
Yukai Tu2d6d5632015-10-26 11:06:02 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento2d83a862019-03-16 19:27:16 -04002/*
Davide Pesaventoe422f9e2022-06-03 01:30:23 -04003 * Copyright (c) 2014-2022, Regents of the University of California,
Yukai Tu2d6d5632015-10-26 11:06:02 -07004 * 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 NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD 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 * NFD 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 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
Davide Pesaventoa8098582019-03-31 15:48:02 -040026#include "dummy-link-service.hpp"
Yukai Tu2d6d5632015-10-26 11:06:02 -070027
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040028namespace nfd::tests {
Yukai Tu2d6d5632015-10-26 11:06:02 -070029
Davide Pesaventoa8098582019-03-31 15:48:02 -040030void
Teng Liangf3bc3ae2020-06-08 10:19:25 -070031DummyLinkService::doSendInterest(const Interest& interest)
Yukai Tu2d6d5632015-10-26 11:06:02 -070032{
Davide Pesaventoa8098582019-03-31 15:48:02 -040033 if (m_loggingFlags & LogSentInterests)
34 sentInterests.push_back(interest);
Yukai Tu2d6d5632015-10-26 11:06:02 -070035
Davide Pesaventoa8098582019-03-31 15:48:02 -040036 afterSend(tlv::Interest);
37}
Yukai Tu2d6d5632015-10-26 11:06:02 -070038
Davide Pesaventoa8098582019-03-31 15:48:02 -040039void
Teng Liangf3bc3ae2020-06-08 10:19:25 -070040DummyLinkService::doSendData(const Data& data)
Davide Pesaventoa8098582019-03-31 15:48:02 -040041{
42 if (m_loggingFlags & LogSentData)
43 sentData.push_back(data);
Yukai Tu2d6d5632015-10-26 11:06:02 -070044
Davide Pesaventoa8098582019-03-31 15:48:02 -040045 afterSend(tlv::Data);
46}
47
48void
Teng Liangf3bc3ae2020-06-08 10:19:25 -070049DummyLinkService::doSendNack(const lp::Nack& nack)
Davide Pesaventoa8098582019-03-31 15:48:02 -040050{
51 if (m_loggingFlags & LogSentNacks)
52 sentNacks.push_back(nack);
53
54 afterSend(lp::tlv::Nack);
55}
56
57void
Davide Pesaventob3a23ca2019-05-04 20:40:21 -040058DummyLinkService::doReceivePacket(const Block& packet, const EndpointId& endpoint)
Davide Pesaventoa8098582019-03-31 15:48:02 -040059{
60 if (m_loggingFlags & LogReceivedPackets)
Davide Pesaventob3a23ca2019-05-04 20:40:21 -040061 receivedPackets.push_back({packet, endpoint});
Davide Pesaventoa8098582019-03-31 15:48:02 -040062}
Yukai Tu2d6d5632015-10-26 11:06:02 -070063
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040064} // namespace nfd::tests