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; |
Alexander Afanasyev | d5c48e0 | 2015-06-24 11:58:14 -0700 | [diff] [blame^] | 47 | fakeSignature.setValue(makeEmptyBlock(tlv::SignatureValue)); |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 48 | data->setSignature(fakeSignature); |
| 49 | data->wireEncode(); |
| 50 | |
| 51 | return data; |
| 52 | } |
| 53 | |
| 54 | inline shared_ptr<Data> |
| 55 | makeData(const Name& name) |
| 56 | { |
| 57 | shared_ptr<Data> data = make_shared<Data>(name); |
| 58 | |
| 59 | return signData(data); |
| 60 | } |
| 61 | |
| 62 | } // namespace util |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 63 | } // namespace ndn |
| 64 | |
| 65 | #endif // NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP |