blob: ea5a736d7e86ee4c271fac80a2f5f9fdb0b0226b [file] [log] [blame]
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2017, Regents of the University of California.
4 *
5 * This file is part of ChronoShare, a decentralized file sharing application over NDN.
6 *
7 * ChronoShare is free software: you can redistribute it and/or modify it under the terms
8 * of the GNU General Public License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License along with
16 * ChronoShare, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * See AUTHORS.md for complete list of ChronoShare authors and contributors.
19 */
20
21#include <ndn-cxx/interest.hpp>
22#include <ndn-cxx/data.hpp>
23#include <ndn-cxx/lp/nack.hpp>
24#include <ndn-cxx/util/dummy-client-face.hpp>
25#include <ndn-cxx/security/key-chain.hpp>
26
27#ifndef NDN_CHRONOSHARE_TESTS_DUMMY_FORWARDER_HPP
28#define NDN_CHRONOSHARE_TESTS_DUMMY_FORWARDER_HPP
29
30namespace ndn {
31namespace chronoshare {
32
33/**
34 * @brief Very basic implementation of the dummy forwarder
35 *
36 * Interests expressed by any added face, will be forwarded to all other faces.
37 * Similarly, any pushed data, will be pushed to all other faces.
38 */
39class DummyForwarder
40{
41public:
42 DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
43
44 Face&
45 addFace();
46
47 Face&
48 getFace(size_t nFace)
49 {
50 return *m_faces.at(nFace);
51 }
52
53private:
54 boost::asio::io_service& m_io;
55 KeyChain& m_keyChain;
56 std::vector<shared_ptr<util::DummyClientFace>> m_faces;
57};
58
59} // namespace chronoshare
60} // namespace ndn
61
62#endif // NDN_CHRONOSHARE_TESTS_DUMMY_FORWARDER_HPP