blob: b4da8a73e384c9da799ad6a90421b27e2f5f5125 [file] [log] [blame]
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shifc2e13d2017-07-25 02:08:48 +00002/*
Junxiao Shi83be1da2017-06-30 13:37:37 +00003 * Copyright (c) 2014-2017, Regents of the University of California,
Junxiao Shia37405d2015-01-26 10:50:58 -07004 * 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 Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
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 Shi5dd26c32014-07-20 23:15:14 -070024 */
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080025
Junxiao Shi9f5b01d2016-08-05 03:54:28 +000026#ifndef NFD_CORE_COMMON_HPP
27#define NFD_CORE_COMMON_HPP
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080028
Junxiao Shi9f5b01d2016-08-05 03:54:28 +000029#include "core/config.hpp"
Junxiao Shi61c5ef32014-01-24 20:59:30 -070030
Junxiao Shi88884492014-02-15 15:57:43 -070031#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
Weiwei Liudcdf6212016-08-31 14:34:22 -070036#define FINAL_UNLESS_WITH_TESTS
Junxiao Shi88884492014-02-15 15:57:43 -070037#else
38#define VIRTUAL_WITH_TESTS
39#define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
40#define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
41#define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
Weiwei Liudcdf6212016-08-31 14:34:22 -070042#define FINAL_UNLESS_WITH_TESTS final
Junxiao Shi88884492014-02-15 15:57:43 -070043#endif
44
Junxiao Shi5dd26c32014-07-20 23:15:14 -070045#include <cstddef>
Davide Pesaventod2856a42015-09-19 21:29:50 +020046#include <cstdint>
47#include <functional>
48#include <limits>
Alexander Afanasyev8552a382014-05-15 20:13:42 -070049#include <list>
Junxiao Shia37405d2015-01-26 10:50:58 -070050#include <map>
Davide Pesaventod2856a42015-09-19 21:29:50 +020051#include <memory>
Alexander Afanasyev8552a382014-05-15 20:13:42 -070052#include <set>
Davide Pesaventod2856a42015-09-19 21:29:50 +020053#include <string>
Junxiao Shia37405d2015-01-26 10:50:58 -070054#include <unordered_map>
55#include <unordered_set>
Davide Pesaventod2856a42015-09-19 21:29:50 +020056#include <utility>
Alexander Afanasyev8552a382014-05-15 20:13:42 -070057#include <vector>
58
Alexander Afanasyev4a771362014-04-24 21:29:33 -070059#include <ndn-cxx/data.hpp>
Junxiao Shifc2e13d2017-07-25 02:08:48 +000060#include <ndn-cxx/delegation.hpp>
61#include <ndn-cxx/delegation-list.hpp>
Junxiao Shi83be1da2017-06-30 13:37:37 +000062#include <ndn-cxx/exclude.hpp>
63#include <ndn-cxx/interest.hpp>
Davide Pesaventod2856a42015-09-19 21:29:50 +020064#include <ndn-cxx/name.hpp>
65#include <ndn-cxx/encoding/block.hpp>
Eric Newberrya98bf932015-09-21 00:58:47 -070066#include <ndn-cxx/lp/nack.hpp>
Junxiao Shi83be1da2017-06-30 13:37:37 +000067#include <ndn-cxx/net/face-uri.hpp>
Davide Pesavento01f8dba2015-09-19 21:11:45 +020068#include <ndn-cxx/util/backports.hpp>
Junxiao Shi1e064172014-12-14 19:37:46 -070069#include <ndn-cxx/util/signal.hpp>
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080070
Alexander Afanasyev8552a382014-05-15 20:13:42 -070071#include <boost/asio.hpp>
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080072#include <boost/assert.hpp>
Steve DiBenedettobf6a93d2014-03-21 14:03:02 -060073#include <boost/lexical_cast.hpp>
Davide Pesavento52a18f92014-04-10 00:55:01 +020074#include <boost/noncopyable.hpp>
Alexander Afanasyev8552a382014-05-15 20:13:42 -070075#include <boost/property_tree/ptree.hpp>
Spyridon Mastorakis149e02c2015-07-27 13:22:22 -070076#include <boost/throw_exception.hpp>
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080077
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080078namespace nfd {
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080079
Junxiao Shi5dd26c32014-07-20 23:15:14 -070080using std::size_t;
81
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080082using boost::noncopyable;
Davide Pesavento52a18f92014-04-10 00:55:01 +020083
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020084using std::shared_ptr;
85using std::unique_ptr;
86using std::weak_ptr;
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020087using std::make_shared;
Davide Pesavento01f8dba2015-09-19 21:11:45 +020088using ndn::make_unique;
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020089using std::enable_shared_from_this;
90
91using std::static_pointer_cast;
92using std::dynamic_pointer_cast;
93using std::const_pointer_cast;
94
95using std::function;
96using std::bind;
97using std::ref;
98using std::cref;
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080099
Davide Pesaventoec2a6982015-09-18 23:59:17 +0200100using ndn::to_string;
101
Junxiao Shi83be1da2017-06-30 13:37:37 +0000102using ndn::Block;
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800103using ndn::Data;
Junxiao Shifc2e13d2017-07-25 02:08:48 +0000104using ndn::Delegation;
105using ndn::DelegationList;
Junxiao Shi83be1da2017-06-30 13:37:37 +0000106using ndn::Exclude;
107using ndn::FaceUri;
108using ndn::Interest;
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800109using ndn::Name;
Yanbiao Li698f4fe2015-08-19 16:30:16 -0700110using ndn::PartialName;
Davide Pesavento52a18f92014-04-10 00:55:01 +0200111
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800112namespace tlv {
Junxiao Shi67f11ac2014-10-19 09:29:13 -0700113// Don't write "namespace tlv = ndn::tlv", because NFD can add other members into this namespace.
114using namespace ndn::tlv;
115} // namespace tlv
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800116
Eric Newberrya98bf932015-09-21 00:58:47 -0700117namespace lp = ndn::lp;
Davide Pesavento52a18f92014-04-10 00:55:01 +0200118namespace name = ndn::name;
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700119namespace time = ndn::time;
Junxiao Shi1e064172014-12-14 19:37:46 -0700120namespace signal = ndn::util::signal;
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700121
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800122} // namespace nfd
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -0800123
Junxiao Shi9f5b01d2016-08-05 03:54:28 +0000124#endif // NFD_CORE_COMMON_HPP