Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-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, |
| 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 | |
| 26 | #ifndef NFD_COMMON_HPP |
| 27 | #define NFD_COMMON_HPP |
| 28 | |
Junxiao Shi | 61c5ef3 | 2014-01-24 20:59:30 -0700 | [diff] [blame] | 29 | #include "config.hpp" |
| 30 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 31 | #ifdef WITH_TESTS |
| 32 | #define VIRTUAL_WITH_TESTS virtual |
| 33 | #define PUBLIC_WITH_TESTS_ELSE_PROTECTED public |
| 34 | #define PUBLIC_WITH_TESTS_ELSE_PRIVATE public |
| 35 | #define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected |
| 36 | #else |
| 37 | #define VIRTUAL_WITH_TESTS |
| 38 | #define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected |
| 39 | #define PUBLIC_WITH_TESTS_ELSE_PRIVATE private |
| 40 | #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private |
| 41 | #endif |
| 42 | |
Junxiao Shi | 1c93cae | 2014-12-09 22:52:17 -0700 | [diff] [blame] | 43 | /** \def DECL_OVERRIDE |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame^] | 44 | * \brief expands to 'override' if compiler supports 'override' specifier, |
| 45 | * otherwise expands to nothing |
Junxiao Shi | 1c93cae | 2014-12-09 22:52:17 -0700 | [diff] [blame] | 46 | */ |
| 47 | #ifdef HAVE_CXX_OVERRIDE |
| 48 | #define DECL_OVERRIDE override |
| 49 | #else |
| 50 | #define DECL_OVERRIDE |
| 51 | #endif |
| 52 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame^] | 53 | /** \def DECL_FINAL |
| 54 | * \brief expands to 'final' if compiler supports 'final' specifier on method, |
| 55 | * otherwise expands to nothing |
| 56 | */ |
| 57 | #ifdef HAVE_CXX_FINAL |
| 58 | #define DECL_FINAL final |
| 59 | #else |
| 60 | #define DECL_FINAL |
| 61 | #endif |
| 62 | |
| 63 | /** \def DECL_CLASS_FINAL |
| 64 | * \brief expands to 'final' if compiler supports 'final' specifier on class, |
| 65 | * otherwise expands to nothing |
| 66 | */ |
| 67 | #ifdef HAVE_CXX_CLASS_FINAL |
| 68 | #define DECL_CLASS_FINAL final |
| 69 | #else |
| 70 | #define DECL_CLASS_FINAL |
| 71 | #endif |
| 72 | |
Junxiao Shi | 5dd26c3 | 2014-07-20 23:15:14 -0700 | [diff] [blame] | 73 | #include <cstddef> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 74 | #include <cstdint> |
| 75 | #include <functional> |
| 76 | #include <limits> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 77 | #include <list> |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 78 | #include <map> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 79 | #include <memory> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 80 | #include <set> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 81 | #include <string> |
Junxiao Shi | a37405d | 2015-01-26 10:50:58 -0700 | [diff] [blame] | 82 | #include <unordered_map> |
| 83 | #include <unordered_set> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 84 | #include <utility> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 85 | #include <vector> |
| 86 | |
Alexander Afanasyev | 4a77136 | 2014-04-24 21:29:33 -0700 | [diff] [blame] | 87 | #include <ndn-cxx/interest.hpp> |
| 88 | #include <ndn-cxx/data.hpp> |
Davide Pesavento | d2856a4 | 2015-09-19 21:29:50 +0200 | [diff] [blame] | 89 | #include <ndn-cxx/name.hpp> |
| 90 | #include <ndn-cxx/encoding/block.hpp> |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame^] | 91 | #include <ndn-cxx/lp/nack.hpp> |
Davide Pesavento | 01f8dba | 2015-09-19 21:11:45 +0200 | [diff] [blame] | 92 | #include <ndn-cxx/util/backports.hpp> |
Davide Pesavento | 9427941 | 2015-02-27 01:29:32 +0100 | [diff] [blame] | 93 | #include <ndn-cxx/util/face-uri.hpp> |
Junxiao Shi | 1e06417 | 2014-12-14 19:37:46 -0700 | [diff] [blame] | 94 | #include <ndn-cxx/util/signal.hpp> |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 95 | |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 96 | #include <boost/algorithm/string.hpp> |
| 97 | #include <boost/asio.hpp> |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 98 | #include <boost/assert.hpp> |
Steve DiBenedetto | bf6a93d | 2014-03-21 14:03:02 -0600 | [diff] [blame] | 99 | #include <boost/lexical_cast.hpp> |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 100 | #include <boost/noncopyable.hpp> |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame] | 101 | #include <boost/property_tree/ptree.hpp> |
Spyridon Mastorakis | 149e02c | 2015-07-27 13:22:22 -0700 | [diff] [blame] | 102 | #include <boost/throw_exception.hpp> |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 103 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 104 | namespace nfd { |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 105 | |
Junxiao Shi | 5dd26c3 | 2014-07-20 23:15:14 -0700 | [diff] [blame] | 106 | using std::size_t; |
| 107 | |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 108 | using boost::noncopyable; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 109 | |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 110 | using std::shared_ptr; |
| 111 | using std::unique_ptr; |
| 112 | using std::weak_ptr; |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 113 | using std::make_shared; |
Davide Pesavento | 01f8dba | 2015-09-19 21:11:45 +0200 | [diff] [blame] | 114 | using ndn::make_unique; |
Davide Pesavento | ab1e8f2 | 2014-10-21 22:45:33 +0200 | [diff] [blame] | 115 | using std::enable_shared_from_this; |
| 116 | |
| 117 | using std::static_pointer_cast; |
| 118 | using std::dynamic_pointer_cast; |
| 119 | using std::const_pointer_cast; |
| 120 | |
| 121 | using std::function; |
| 122 | using std::bind; |
| 123 | using std::ref; |
| 124 | using std::cref; |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 125 | |
Davide Pesavento | ec2a698 | 2015-09-18 23:59:17 +0200 | [diff] [blame] | 126 | using ndn::to_string; |
| 127 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 128 | using ndn::Interest; |
| 129 | using ndn::Data; |
| 130 | using ndn::Name; |
Yanbiao Li | 698f4fe | 2015-08-19 16:30:16 -0700 | [diff] [blame] | 131 | using ndn::PartialName; |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 132 | using ndn::Exclude; |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 133 | using ndn::Link; |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 134 | using ndn::Block; |
Davide Pesavento | 9427941 | 2015-02-27 01:29:32 +0100 | [diff] [blame] | 135 | using ndn::util::FaceUri; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 136 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 137 | namespace tlv { |
Junxiao Shi | 67f11ac | 2014-10-19 09:29:13 -0700 | [diff] [blame] | 138 | // Don't write "namespace tlv = ndn::tlv", because NFD can add other members into this namespace. |
| 139 | using namespace ndn::tlv; |
| 140 | } // namespace tlv |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 141 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame^] | 142 | namespace lp = ndn::lp; |
Davide Pesavento | 52a18f9 | 2014-04-10 00:55:01 +0200 | [diff] [blame] | 143 | namespace name = ndn::name; |
Alexander Afanasyev | eb3197f | 2014-03-17 19:28:18 -0700 | [diff] [blame] | 144 | namespace time = ndn::time; |
Junxiao Shi | 1e06417 | 2014-12-14 19:37:46 -0700 | [diff] [blame] | 145 | namespace signal = ndn::util::signal; |
Alexander Afanasyev | eb3197f | 2014-03-17 19:28:18 -0700 | [diff] [blame] | 146 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 147 | } // namespace nfd |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 148 | |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 149 | #endif // NFD_COMMON_HPP |