blob: 697447cf31a1e54e0302d12f26fefb18eff75ed1 [file] [log] [blame]
Jiewen Tan99135962014-09-20 02:18:53 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014 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 *
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.
25 **/
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
34namespace ndn {
35namespace util {
36
37inline shared_ptr<Interest>
38makeInterest(const Name& name)
39{
40 return make_shared<Interest>(name);
41}
42
43inline shared_ptr<Data>
44signData(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
55inline shared_ptr<Data>
56makeData(const Name& name)
57{
58 shared_ptr<Data> data = make_shared<Data>(name);
59
60 return signData(data);
61}
62
63} // namespace util
64
65} // namespace ndn
66
67#endif // NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP