blob: 481d2576294cc8bf9d412eaec721508fd8a5597e [file] [log] [blame]
Yumin Xiafa2bce72017-04-09 16:20:25 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2017, Regents of the University of California,
4 * 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 NDNS (Named Data Networking Domain Name Service) and is
12 * based on the code written as part of NFD (Named Data Networking Daemon).
13 * See AUTHORS.md for complete list of NDNS authors and contributors.
14 *
15 * NDNS is free software: you can redistribute it and/or modify it under the terms
16 * of the GNU General Public License as published by the Free Software Foundation,
17 * either version 3 of the License, or (at your option) any later version.
18 *
19 * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
20 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 * PURPOSE. See the GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along with
24 * NDNS, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27#include <ndn-cxx/interest.hpp>
28#include <ndn-cxx/data.hpp>
29#include <ndn-cxx/lp/nack.hpp>
30#include <ndn-cxx/util/dummy-client-face.hpp>
31#include <ndn-cxx/security/key-chain.hpp>
32
33#ifndef NDNS_TESTS_TEST_DUMMY_FORWARDER_HPP
34#define NDNS_TESTS_TEST_DUMMY_FORWARDER_HPP
35
36namespace ndn {
37namespace ndns {
38namespace tests {
39
40/**
41 * @brief Very basic implementation of the dummy forwarder
42 *
43 * Interests expressed by any added face, will be forwarded to all other faces.
44 * Similarly, any pushed data, will be pushed to all other faces.
45 */
46class DummyForwarder
47{
48public:
49 DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
50
51 Face&
52 addFace();
53
54 Face&
55 getFace(size_t nFace)
56 {
57 return *m_faces.at(nFace);
58 }
59
60private:
61 boost::asio::io_service& m_io;
62 KeyChain& m_keyChain;
63 std::vector<shared_ptr<util::DummyClientFace>> m_faces;
64};
65
66} // namespace tests
67} // namespace ndns
68} // namespace ndn
69
70#endif // NDNS_TESTS_TEST_DUMMY_FORWARDER_HPP