blob: 60e6904a552363a66a9ac7eecdcefe1aea01a0f3 [file] [log] [blame]
Ashlesh Gawande08784d42017-09-06 23:40:21 -05001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Davide Pesavento48dbab62023-08-12 16:06:52 -04003 * Copyright (c) 2012-2023 University of California, Los Angeles
Ashlesh Gawande08784d42017-09-06 23:40:21 -05004 *
5 * This file is part of ChronoSync, synchronization library for distributed realtime
6 * applications for NDN.
7 *
8 * ChronoSync 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, either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * ChronoSync 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 * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
Ashlesh Gawande08784d42017-09-06 23:40:21 -050020#include <ndn-cxx/data.hpp>
Davide Pesavento48dbab62023-08-12 16:06:52 -040021#include <ndn-cxx/interest.hpp>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050022#include <ndn-cxx/lp/nack.hpp>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050023#include <ndn-cxx/security/key-chain.hpp>
Davide Pesavento48dbab62023-08-12 16:06:52 -040024#include <ndn-cxx/util/dummy-client-face.hpp>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050025
26#ifndef NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
27#define NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP
28
29namespace ndn {
30namespace chronosync {
31
32/**
33 * @brief Very basic implementation of the dummy forwarder
34 *
35 * Interests expressed by any added face, will be forwarded to all other faces.
36 * Similarly, any pushed data, will be pushed to all other faces.
37 */
38class DummyForwarder
39{
40public:
41 DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
42
43 Face&
44 addFace();
45
46 Face&
47 getFace(size_t nFace)
48 {
49 return *m_faces.at(nFace);
50 }
51
Nick Gordon0b3beab2018-03-02 13:03:28 -060052 void
53 removeFaces();
54
Ashlesh Gawande08784d42017-09-06 23:40:21 -050055private:
56 boost::asio::io_service& m_io;
57 KeyChain& m_keyChain;
Davide Pesavento48dbab62023-08-12 16:06:52 -040058 std::vector<std::shared_ptr<DummyClientFace>> m_faces;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050059};
60
61} // namespace chronosync
62} // namespace ndn
63
64#endif // NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP