Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 2 | /* |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 3 | * Copyright (c) 2014-2023, The University of Memphis, |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 4 | * Regents of the University of California, |
| 5 | * Arizona Board of Regents. |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 6 | * |
| 7 | * This file is part of NLSR (Named-data Link State Routing). |
| 8 | * See AUTHORS.md for complete list of NLSR authors and contributors. |
| 9 | * |
| 10 | * NLSR is free software: you can redistribute it and/or modify it under the terms |
| 11 | * of the GNU General Public License as published by the Free Software Foundation, |
| 12 | * either version 3 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE. See the GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along with |
| 19 | * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Alexander Afanasyev | 67758b1 | 2018-03-06 18:36:44 -0500 | [diff] [blame] | 20 | */ |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 21 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 22 | #ifndef NLSR_TESTS_TEST_COMMON_HPP |
| 23 | #define NLSR_TESTS_TEST_COMMON_HPP |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 24 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 25 | #include "conf-parameter.hpp" |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 26 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 27 | #include "tests/boost-test.hpp" |
Davide Pesavento | cb065f1 | 2019-12-27 01:03:34 -0500 | [diff] [blame] | 28 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 29 | #include <ndn-cxx/data.hpp> |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 30 | #include <ndn-cxx/util/dummy-client-face.hpp> |
| 31 | |
Davide Pesavento | c1d0e8e | 2022-06-15 14:26:02 -0400 | [diff] [blame] | 32 | namespace nlsr::test { |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 33 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 34 | /** |
| 35 | * \brief Create a Data with a null (i.e., empty) signature |
| 36 | * |
| 37 | * If a "real" signature is desired, use KeyChainFixture and sign again with `m_keyChain`. |
| 38 | */ |
| 39 | std::shared_ptr<ndn::Data> |
| 40 | makeData(const ndn::Name& name); |
| 41 | |
| 42 | /** |
| 43 | * \brief Add a null signature to \p data |
| 44 | */ |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 45 | ndn::Data& |
| 46 | signData(ndn::Data& data); |
| 47 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 48 | /** |
| 49 | * \brief Add a null signature to \p data |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 50 | */ |
Davide Pesavento | d90338d | 2021-01-07 17:50:05 -0500 | [diff] [blame] | 51 | inline std::shared_ptr<ndn::Data> |
| 52 | signData(std::shared_ptr<ndn::Data> data) |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 53 | { |
| 54 | signData(*data); |
| 55 | return data; |
| 56 | } |
| 57 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 58 | void |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 59 | checkPrefixRegistered(const ndn::DummyClientFace& face, const ndn::Name& prefix); |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 60 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 61 | class DummyConfFileProcessor |
| 62 | { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 63 | public: |
| 64 | DummyConfFileProcessor(ConfParameter& conf, |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame] | 65 | SyncProtocol protocol = SyncProtocol::PSYNC, |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 66 | HyperbolicState hyperbolicState = HYPERBOLIC_STATE_OFF, |
| 67 | const ndn::Name& networkName = "/ndn", |
| 68 | const ndn::Name& siteName = "/site", |
| 69 | const ndn::Name& routerName = "/%C1.Router/this-router") |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 70 | { |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 71 | conf.setNetwork(networkName); |
| 72 | conf.setSiteName(siteName); |
| 73 | conf.setRouterName(routerName); |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 74 | conf.buildRouterAndSyncUserPrefix(); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 75 | conf.setSyncProtocol(protocol); |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 76 | conf.setHyperbolicState(hyperbolicState); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 77 | } |
| 78 | }; |
| 79 | |
Davide Pesavento | c1d0e8e | 2022-06-15 14:26:02 -0400 | [diff] [blame] | 80 | } // namespace nlsr::test |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 81 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 82 | #endif // NLSR_TESTS_TEST_COMMON_HPP |