Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Davide Pesavento | 48dbab6 | 2023-08-12 16:06:52 -0400 | [diff] [blame^] | 3 | * Copyright (c) 2012-2023 University of California, Los Angeles |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 4 | * |
| 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 Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 20 | #include <ndn-cxx/data.hpp> |
Davide Pesavento | 48dbab6 | 2023-08-12 16:06:52 -0400 | [diff] [blame^] | 21 | #include <ndn-cxx/interest.hpp> |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 22 | #include <ndn-cxx/lp/nack.hpp> |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 23 | #include <ndn-cxx/security/key-chain.hpp> |
Davide Pesavento | 48dbab6 | 2023-08-12 16:06:52 -0400 | [diff] [blame^] | 24 | #include <ndn-cxx/util/dummy-client-face.hpp> |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 25 | |
| 26 | #ifndef NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP |
| 27 | #define NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP |
| 28 | |
| 29 | namespace ndn { |
| 30 | namespace 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 | */ |
| 38 | class DummyForwarder |
| 39 | { |
| 40 | public: |
| 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 Gordon | 0b3beab | 2018-03-02 13:03:28 -0600 | [diff] [blame] | 52 | void |
| 53 | removeFaces(); |
| 54 | |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 55 | private: |
| 56 | boost::asio::io_service& m_io; |
| 57 | KeyChain& m_keyChain; |
Davide Pesavento | 48dbab6 | 2023-08-12 16:06:52 -0400 | [diff] [blame^] | 58 | std::vector<std::shared_ptr<DummyClientFace>> m_faces; |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace chronosync |
| 62 | } // namespace ndn |
| 63 | |
| 64 | #endif // NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP |