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-2019, 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 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 #define OVERRIDE_WITH_TESTS_ELSE_FINAL override
37 #define FINAL_UNLESS_WITH_TESTS
38 #else
39 #define VIRTUAL_WITH_TESTS
40 #define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
41 #define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
42 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
43 #define OVERRIDE_WITH_TESTS_ELSE_FINAL final
44 #define 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/delegation.hpp>
64 #include <ndn-cxx/interest.hpp>
65 #include <ndn-cxx/name.hpp>
67 #include <ndn-cxx/lp/nack.hpp>
68 #include <ndn-cxx/net/face-uri.hpp>
72 #include <ndn-cxx/util/signal.hpp>
73 #include <ndn-cxx/util/time.hpp>
74 
75 #include <boost/asio.hpp>
76 #include <boost/assert.hpp>
77 #include <boost/lexical_cast.hpp>
78 #include <boost/noncopyable.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 std::bind;
98 
99 using namespace std::string_literals;
100 
101 using ndn::optional;
102 using ndn::nullopt;
103 using ndn::to_string;
104 
105 using ndn::Block;
106 using ndn::Data;
107 using ndn::Delegation;
108 using ndn::DelegationList;
109 using ndn::FaceUri;
110 using ndn::Interest;
111 using ndn::Name;
112 using ndn::PartialName;
113 using ndn::Scheduler;
114 
115 // Not using a namespace alias (namespace tlv = ndn::tlv), because
116 // it doesn't allow NFD to add other members to the namespace
117 namespace tlv {
118 using namespace ndn::tlv;
119 } // namespace tlv
120 
121 namespace lp = ndn::lp;
122 namespace name = ndn::name;
123 namespace scheduler = ndn::scheduler;
124 namespace signal = ndn::util::signal;
125 namespace time = ndn::time;
126 using namespace ndn::time_literals;
127 using ndn::operator""_block;
128 
129 } // namespace nfd
130 
131 #endif // NFD_CORE_COMMON_HPP
ndn::tlv::Interest
@ Interest
Definition: tlv.hpp:65
signal.hpp
ndn::FaceUri
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:45
ndn::PartialName
Name PartialName
Represents an arbitrary sequence of name components.
Definition: name.hpp:39
block.hpp
name.hpp
scheduler.hpp
ndn::util::signal
Definition: connection.cpp:26
face-uri.hpp
ndn::Delegation
Represents a Delegation.
Definition: delegation.hpp:33
ns3::ndn::Name
Name
Definition: ndn-common.cpp:25
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ndn::time
Definition: time-custom-clock.hpp:28
nonstd::optional_lite::nullopt
const nullopt_t nullopt((nullopt_t::init()))
nack.hpp
ndn::DelegationList
represents a list of Delegations
Definition: delegation-list.hpp:38
interest.hpp
ndn::tlv::Data
@ Data
Definition: tlv.hpp:66
data.hpp
ndn::scheduler
Definition: scheduler.cpp:27
exception.hpp
backports.hpp
ndn::Block
Represents a TLV element of NDN packet format.
Definition: block.hpp:43
ndn::scheduler::Scheduler
Generic time-based scheduler.
Definition: scheduler.hpp:133
ndn::to_string
std::string to_string(const T &val)
Definition: backports.hpp:102
ndn::name
Definition: name-component-types.hpp:33
ndn::tlv
Namespace defining NDN Packet Format related constants and procedures.
Definition: tlv-nfd.hpp:29
ndn::lp
Definition: cache-policy.cpp:28
time.hpp
delegation-list.hpp
delegation.hpp