NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
common.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2022, 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.
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/>.
24  */
25 
26 #ifndef NFD_CORE_COMMON_HPP
27 #define NFD_CORE_COMMON_HPP
28 
29 #include "core/config.hpp"
30 
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
38 #else
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
45 #endif
46 
47 #include <cstddef>
48 #include <cstdint>
49 #include <functional>
50 #include <limits>
51 #include <map>
52 #include <memory>
53 #include <set>
54 #include <stdexcept>
55 #include <string>
56 #include <unordered_map>
57 #include <unordered_set>
58 #include <utility>
59 #include <vector>
60 
61 #include <ndn-cxx/data.hpp>
62 #include <ndn-cxx/interest.hpp>
63 #include <ndn-cxx/name.hpp>
65 #include <ndn-cxx/lp/nack.hpp>
66 #include <ndn-cxx/net/face-uri.hpp>
71 #include <ndn-cxx/util/signal.hpp>
72 #include <ndn-cxx/util/span.hpp>
73 #include <ndn-cxx/util/time.hpp>
74 
75 #include <boost/asio.hpp>
76 #include <boost/assert.hpp>
77 #include <boost/core/noncopyable.hpp>
78 #include <boost/lexical_cast.hpp>
79 #include <boost/property_tree/ptree.hpp>
80 
81 namespace nfd {
82 
83 using std::size_t;
84 
85 using boost::noncopyable;
86 
87 using std::shared_ptr;
88 using std::unique_ptr;
89 using std::weak_ptr;
90 using std::make_shared;
91 using std::make_unique;
92 
93 using std::static_pointer_cast;
94 using std::dynamic_pointer_cast;
95 using std::const_pointer_cast;
96 
97 using namespace std::string_literals;
98 
99 using ndn::optional;
100 using ndn::nullopt;
101 using ndn::span;
102 using ndn::to_string;
103 
104 using ndn::Block;
105 using ndn::Data;
106 using ndn::FaceUri;
107 using ndn::Interest;
108 using ndn::Name;
109 using ndn::PartialName;
110 using ndn::Scheduler;
111 
112 // Not using a namespace alias (namespace tlv = ndn::tlv), because
113 // it doesn't allow NFD to add other members to the namespace
114 namespace tlv {
115 using namespace ndn::tlv;
116 } // namespace tlv
117 
118 namespace lp = ndn::lp;
119 namespace name = ndn::name;
120 namespace scheduler = ndn::scheduler;
121 namespace signal = ndn::util::signal;
122 namespace time = ndn::time;
123 using namespace ndn::time_literals;
124 using ndn::operator""_block;
125 
126 } // namespace nfd
127 
128 #endif // NFD_CORE_COMMON_HPP
std::string to_string(const T &val)
Definition: backports.hpp:86
span_CONFIG_SIZE_TYPE size_t
Definition: span-lite.hpp:565
Represents a TLV element of the NDN packet format.
Definition: block.hpp:44
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:39
Name PartialName
Represents an arbitrary sequence of name components.
Definition: name.hpp:36
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
Generic time-based scheduler.
Definition: scheduler.hpp:132
Namespace defining NDN Packet Format related constants and procedures.
Definition: tlv-nfd.hpp:29
const nullopt_t nullopt((nullopt_t::init()))