Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | fc2e13d | 2017-07-25 02:08:48 +0000 | [diff] [blame] | 2 | /* |
Junxiao Shi | 727b610 | 2022-01-11 18:40:04 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2022, Regents of the University of California, |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 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. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Junxiao Shi | 5dd26c3 | 2014-07-20 23:15:14 -0700 | [diff] [blame] | 24 | */ |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 25 | |
Junxiao Shi | 9f5b01d | 2016-08-05 03:54:28 +0000 | [diff] [blame] | 26 | #ifndef NFD_CORE_COMMON_HPP |
| 27 | #define NFD_CORE_COMMON_HPP |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 28 | |
Junxiao Shi | 9f5b01d | 2016-08-05 03:54:28 +0000 | [diff] [blame] | 29 | #include "core/config.hpp" |
Junxiao Shi | 61c5ef3 | 2014-01-24 20:59:30 -0700 | [diff] [blame] | 30 | |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame] | 31 | #ifdef NFD_WITH_TESTS |
| 32 | #define NFD_VIRTUAL_WITH_TESTS virtual |
| 33 | #define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED public |
| 34 | #define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE public |
| 35 | #define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected |
| 36 | #define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL override |
| 37 | #define NFD_FINAL_UNLESS_WITH_TESTS |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 38 | #else |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame] | 39 | #define NFD_VIRTUAL_WITH_TESTS |
| 40 | #define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected |
| 41 | #define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE private |
| 42 | #define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE private |
| 43 | #define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL final |
| 44 | #define NFD_FINAL_UNLESS_WITH_TESTS final |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 45 | #endif |
| 46 | |
Junxiao Shi | 5dd26c3 | 2014-07-20 23:15:14 -0700 | [diff] [blame] | 47 | #include <cstddef> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 48 | #include <cstdint> |
| 49 | #include <functional> |
| 50 | #include <limits> |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 51 | #include <map> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 52 | #include <memory> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 53 | #include <set> |
Davide Pesavento | c0822fa | 2018-05-10 21:54:10 -0400 | [diff] [blame] | 54 | #include <stdexcept> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 55 | #include <string> |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 56 | #include <unordered_map> |
| 57 | #include <unordered_set> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 58 | #include <utility> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 59 | #include <vector> |
| 60 | |
Alexander Afanasyev | 4a77136 | 2014-04-24 21:29:33 -0700 | [diff] [blame] | 61 | #include <ndn-cxx/data.hpp> |
Junxiao Shi | 83be1da | 2017-06-30 13:37:37 +0000 | [diff] [blame] | 62 | #include <ndn-cxx/interest.hpp> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 63 | #include <ndn-cxx/name.hpp> |
| 64 | #include <ndn-cxx/encoding/block.hpp> |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 65 | #include <ndn-cxx/lp/nack.hpp> |
Junxiao Shi | 83be1da | 2017-06-30 13:37:37 +0000 | [diff] [blame] | 66 | #include <ndn-cxx/net/face-uri.hpp> |
Davide Pesavento | 01f8dba | 2015-09-19 21:11:45 +0200 | [diff] [blame] | 67 | #include <ndn-cxx/util/backports.hpp> |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 68 | #include <ndn-cxx/util/exception.hpp> |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 69 | #include <ndn-cxx/util/optional.hpp> |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 70 | #include <ndn-cxx/util/scheduler.hpp> |
Junxiao Shi | 1e06417 | 2014-12-14 19:37:46 -0700 | [diff] [blame] | 71 | #include <ndn-cxx/util/signal.hpp> |
Junxiao Shi | 727b610 | 2022-01-11 18:40:04 +0000 | [diff] [blame] | 72 | #include <ndn-cxx/util/span.hpp> |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 73 | #include <ndn-cxx/util/time.hpp> |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 74 | |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 75 | #include <boost/asio.hpp> |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 76 | #include <boost/assert.hpp> |
Davide Pesavento | 1752159 | 2020-05-14 19:01:32 -0400 | [diff] [blame] | 77 | #include <boost/core/noncopyable.hpp> |
Steve DiBenedetto | bf6a93d | 2014-03-21 14:03:02 -0600 | [diff] [blame] | 78 | #include <boost/lexical_cast.hpp> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 79 | #include <boost/property_tree/ptree.hpp> |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 80 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 81 | namespace nfd { |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 82 | |
Junxiao Shi | 5dd26c3 | 2014-07-20 23:15:14 -0700 | [diff] [blame] | 83 | using std::size_t; |
| 84 | |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 85 | using boost::noncopyable; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 86 | |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 87 | using std::shared_ptr; |
| 88 | using std::unique_ptr; |
| 89 | using std::weak_ptr; |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 90 | using std::make_shared; |
Davide Pesavento | c0822fa | 2018-05-10 21:54:10 -0400 | [diff] [blame] | 91 | using std::make_unique; |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 92 | |
| 93 | using std::static_pointer_cast; |
| 94 | using std::dynamic_pointer_cast; |
| 95 | using std::const_pointer_cast; |
| 96 | |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 97 | using namespace std::string_literals; |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 98 | |
Davide Pesavento | 87fc0f8 | 2018-04-11 23:43:51 -0400 | [diff] [blame] | 99 | using ndn::optional; |
| 100 | using ndn::nullopt; |
Junxiao Shi | 727b610 | 2022-01-11 18:40:04 +0000 | [diff] [blame] | 101 | using ndn::span; |
Davide Pesavento | ec2a698 | 2015-09-18 23:59:17 +0200 | [diff] [blame] | 102 | using ndn::to_string; |
| 103 | |
Junxiao Shi | 83be1da | 2017-06-30 13:37:37 +0000 | [diff] [blame] | 104 | using ndn::Block; |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 105 | using ndn::Data; |
Junxiao Shi | 83be1da | 2017-06-30 13:37:37 +0000 | [diff] [blame] | 106 | using ndn::FaceUri; |
| 107 | using ndn::Interest; |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 108 | using ndn::Name; |
Yanbiao Li | 698f4fe | 2015-08-19 16:30:16 -0700 | [diff] [blame] | 109 | using ndn::PartialName; |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 110 | using ndn::Scheduler; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 111 | |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 112 | // Not using a namespace alias (namespace tlv = ndn::tlv), because |
| 113 | // it doesn't allow NFD to add other members to the namespace |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 114 | namespace tlv { |
Junxiao Shi | 67f11ac | 2014-10-19 09:29:13 -0700 | [diff] [blame] | 115 | using namespace ndn::tlv; |
| 116 | } // namespace tlv |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 117 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 118 | namespace lp = ndn::lp; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 119 | namespace name = ndn::name; |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 120 | namespace scheduler = ndn::scheduler; |
Junxiao Shi | 1e06417 | 2014-12-14 19:37:46 -0700 | [diff] [blame] | 121 | namespace signal = ndn::util::signal; |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 122 | namespace time = ndn::time; |
| 123 | using namespace ndn::time_literals; |
Junxiao Shi | 606d5dd | 2019-09-23 12:47:44 -0600 | [diff] [blame] | 124 | using ndn::operator""_block; |
Alexander Afanasyev | eb3197f | 2014-03-17 19:28:18 -0700 | [diff] [blame] | 125 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 126 | } // namespace nfd |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 127 | |
Junxiao Shi | 9f5b01d | 2016-08-05 03:54:28 +0000 | [diff] [blame] | 128 | #endif // NFD_CORE_COMMON_HPP |