Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Spyridon Mastorakis | 429634f | 2015-02-19 17:35:33 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2013-2015 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 |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 9 | * |
| 10 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 11 | * |
| 12 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 13 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 14 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 17 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 18 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 21 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 22 | * <http://www.gnu.org/licenses/>. |
| 23 | * |
| 24 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
Spyridon Mastorakis | 429634f | 2015-02-19 17:35:33 -0800 | [diff] [blame^] | 25 | */ |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 26 | |
| 27 | #ifndef NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP |
| 28 | #define NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP |
| 29 | |
| 30 | #include "boost-test.hpp" |
| 31 | |
| 32 | #include "security/key-chain.hpp" |
| 33 | |
| 34 | namespace ndn { |
| 35 | namespace util { |
| 36 | |
| 37 | inline shared_ptr<Interest> |
| 38 | makeInterest(const Name& name) |
| 39 | { |
| 40 | return make_shared<Interest>(name); |
| 41 | } |
| 42 | |
| 43 | inline shared_ptr<Data> |
| 44 | signData(const shared_ptr<Data>& data) |
| 45 | { |
| 46 | ndn::SignatureSha256WithRsa fakeSignature; |
| 47 | fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, |
| 48 | reinterpret_cast<const uint8_t*>(0), 0)); |
| 49 | data->setSignature(fakeSignature); |
| 50 | data->wireEncode(); |
| 51 | |
| 52 | return data; |
| 53 | } |
| 54 | |
| 55 | inline shared_ptr<Data> |
| 56 | makeData(const Name& name) |
| 57 | { |
| 58 | shared_ptr<Data> data = make_shared<Data>(name); |
| 59 | |
| 60 | return signData(data); |
| 61 | } |
| 62 | |
| 63 | } // namespace util |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 64 | } // namespace ndn |
| 65 | |
| 66 | #endif // NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP |