blob: 3e7d9b3c932f29812727321f0590c0108d2a3674 [file] [log] [blame]
Ashlesh Gawande08784d42017-09-06 23:40:21 -05001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012-2017 University of California, Los Angeles
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
20#include <ndn-cxx/interest.hpp>
21#include <ndn-cxx/data.hpp>
22#include <ndn-cxx/lp/nack.hpp>
23#include <ndn-cxx/util/dummy-client-face.hpp>
24#include <ndn-cxx/security/key-chain.hpp>
25
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
52private:
53 boost::asio::io_service& m_io;
54 KeyChain& m_keyChain;
55 std::vector<shared_ptr<util::DummyClientFace>> m_faces;
56};
57
58} // namespace chronosync
59} // namespace ndn
60
61#endif // NDN_CHRONOSYNC_UNIT_TESTS_DUMMY_FORWARDER_HPP