net: move network-related files to src/net
Some namespaces are changed:
* ndn::util::FaceUri is now ndn::FaceUri
* ndn::util::ethernet is now ndn::ethernet
* ndn::util::NetworkMonitor and related classes are now in ndn::net
refs #3940
Change-Id: Ia4754caef9726efc73f5a303cec46fc95c744d70
diff --git a/src/face.cpp b/src/face.cpp
index c77d3e0..1521788 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -23,10 +23,10 @@
#include "detail/face-impl.hpp"
#include "encoding/tlv.hpp"
+#include "net/face-uri.hpp"
#include "security/signing-helpers.hpp"
#include "util/time.hpp"
#include "util/random.hpp"
-#include "util/face-uri.hpp"
// A callback scheduled through io.post and io.dispatch may be invoked after the face
// is destructed. To prevent this situation, these macros captures Face::m_impl as weak_ptr,
@@ -117,7 +117,7 @@
std::string protocol;
try {
- util::FaceUri uri(transportUri);
+ FaceUri uri(transportUri);
protocol = uri.getScheme();
if (protocol == "unix") {
@@ -133,7 +133,7 @@
catch (const Transport::Error& error) {
BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
}
- catch (const util::FaceUri::Error& error) {
+ catch (const FaceUri::Error& error) {
BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
}
}
diff --git a/src/util/detail/link-type-helper-osx.mm b/src/net/detail/link-type-helper-osx.mm
similarity index 97%
rename from src/util/detail/link-type-helper-osx.mm
rename to src/net/detail/link-type-helper-osx.mm
index 200adff..c45fa04 100644
--- a/src/util/detail/link-type-helper-osx.mm
+++ b/src/net/detail/link-type-helper-osx.mm
@@ -31,7 +31,7 @@
#import <CoreWLAN/CWWiFiClient.h>
namespace ndn {
-namespace util {
+namespace net {
namespace detail {
ndn::nfd::LinkType
@@ -61,5 +61,5 @@
}
} // namespace detail
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/detail/link-type-helper.cpp b/src/net/detail/link-type-helper.cpp
similarity index 97%
rename from src/util/detail/link-type-helper.cpp
rename to src/net/detail/link-type-helper.cpp
index a25fd27..36d51de 100644
--- a/src/util/detail/link-type-helper.cpp
+++ b/src/net/detail/link-type-helper.cpp
@@ -27,7 +27,7 @@
#else
namespace ndn {
-namespace util {
+namespace net {
namespace detail {
ndn::nfd::LinkType
@@ -37,7 +37,7 @@
}
} // namespace detail
-} // namespace util
+} // namespace net
} // namespace ndn
#endif // NDN_CXX_HAVE_OSX_FRAMEWORKS
diff --git a/src/util/detail/link-type-helper.hpp b/src/net/detail/link-type-helper.hpp
similarity index 87%
rename from src/util/detail/link-type-helper.hpp
rename to src/net/detail/link-type-helper.hpp
index c6e402f..9512f31 100644
--- a/src/util/detail/link-type-helper.hpp
+++ b/src/net/detail/link-type-helper.hpp
@@ -19,13 +19,13 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
-#define NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
+#ifndef NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
+#define NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
#include "../../encoding/nfd-constants.hpp"
namespace ndn {
-namespace util {
+namespace net {
namespace detail {
/**
@@ -35,7 +35,7 @@
getLinkType(const std::string& ifName);
} // namespace detail
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
+#endif // NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
diff --git a/src/util/detail/linux-if-constants.cpp b/src/net/detail/linux-if-constants.cpp
similarity index 97%
rename from src/util/detail/linux-if-constants.cpp
rename to src/net/detail/linux-if-constants.cpp
index c50fa50..dbcf54b 100644
--- a/src/util/detail/linux-if-constants.cpp
+++ b/src/net/detail/linux-if-constants.cpp
@@ -29,7 +29,7 @@
#include <linux/if.h>
namespace ndn {
-namespace util {
+namespace net {
namespace linux_if {
const uint32_t FLAG_LOWER_UP = IFF_LOWER_UP;
@@ -45,7 +45,7 @@
const uint8_t OPER_STATE_UP = IF_OPER_UP;
} // namespace linux_if
-} // namespace util
+} // namespace net
} // namespace ndn
#endif // __linux__
diff --git a/src/util/detail/linux-if-constants.hpp b/src/net/detail/linux-if-constants.hpp
similarity index 92%
rename from src/util/detail/linux-if-constants.hpp
rename to src/net/detail/linux-if-constants.hpp
index 29e7115..0670e70 100644
--- a/src/util/detail/linux-if-constants.hpp
+++ b/src/net/detail/linux-if-constants.hpp
@@ -21,14 +21,14 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_LINUX_IF_CONSTANTS_HPP
-#define NDN_UTIL_LINUX_IF_CONSTANTS_HPP
+#ifndef NDN_NET_LINUX_IF_CONSTANTS_HPP
+#define NDN_NET_LINUX_IF_CONSTANTS_HPP
#ifdef __linux__
#include <cstdint>
namespace ndn {
-namespace util {
+namespace net {
namespace linux_if {
// linux/if.h and net/if.h cannot be (directly or indirectly) included in the
@@ -51,8 +51,8 @@
extern const uint8_t OPER_STATE_UP;
} // namespace linux_if
-} // namespace util
+} // namespace net
} // namespace ndn
#endif // __linux__
-#endif // NDN_UTIL_LINUX_IF_CONSTANTS_HPP
+#endif // NDN_NET_LINUX_IF_CONSTANTS_HPP
diff --git a/src/util/detail/network-monitor-impl-noop.hpp b/src/net/detail/network-monitor-impl-noop.hpp
similarity index 89%
rename from src/util/detail/network-monitor-impl-noop.hpp
rename to src/net/detail/network-monitor-impl-noop.hpp
index 944e219..f0c5fb0 100644
--- a/src/util/detail/network-monitor-impl-noop.hpp
+++ b/src/net/detail/network-monitor-impl-noop.hpp
@@ -21,13 +21,13 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
#include "../network-monitor.hpp"
namespace ndn {
-namespace util {
+namespace net {
class NetworkMonitor::Impl
{
@@ -55,7 +55,7 @@
}
};
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
diff --git a/src/util/detail/network-monitor-impl-osx.cpp b/src/net/detail/network-monitor-impl-osx.cpp
similarity index 99%
rename from src/util/detail/network-monitor-impl-osx.cpp
rename to src/net/detail/network-monitor-impl-osx.cpp
index 4824bab..97f3e7c 100644
--- a/src/util/detail/network-monitor-impl-osx.cpp
+++ b/src/net/detail/network-monitor-impl-osx.cpp
@@ -54,7 +54,7 @@
#include "network-monitor-impl-osx.hpp"
#include "../../name.hpp"
-#include "../logger.hpp"
+#include "../../util/logger.hpp"
#include "../network-address.hpp"
#include <ifaddrs.h> // for getifaddrs()
@@ -66,7 +66,7 @@
#include <boost/asio.hpp>
namespace ndn {
-namespace util {
+namespace net {
NDN_LOG_INIT(ndn.NetworkMonitor);
@@ -449,5 +449,5 @@
}
}
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/detail/network-monitor-impl-osx.hpp b/src/net/detail/network-monitor-impl-osx.hpp
similarity index 89%
rename from src/util/detail/network-monitor-impl-osx.hpp
rename to src/net/detail/network-monitor-impl-osx.hpp
index 52c3468..3aac23f 100644
--- a/src/util/detail/network-monitor-impl-osx.hpp
+++ b/src/net/detail/network-monitor-impl-osx.hpp
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
#include "ndn-cxx-config.hpp"
#include "../network-monitor.hpp"
@@ -30,9 +30,9 @@
#endif
#include "../network-interface.hpp"
-#include "../scheduler.hpp"
-#include "../scheduler-scoped-event-id.hpp"
#include "../../security/tpm/helper-osx.hpp"
+#include "../../util/scheduler.hpp"
+#include "../../util/scheduler-scoped-event-id.hpp"
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SystemConfiguration.h>
@@ -40,7 +40,7 @@
#include <boost/asio/ip/udp.hpp>
namespace ndn {
-namespace util {
+namespace net {
class NetworkMonitor::Impl
{
@@ -104,8 +104,8 @@
NetworkMonitor& m_nm;
std::map<std::string /*ifname*/, shared_ptr<NetworkInterface>> m_interfaces; ///< interface map
- Scheduler m_scheduler;
- scheduler::ScopedEventId m_cfLoopEvent;
+ util::Scheduler m_scheduler;
+ util::scheduler::ScopedEventId m_cfLoopEvent;
SCDynamicStoreContext m_context;
CFReleaser<SCDynamicStoreRef> m_scStore;
@@ -114,7 +114,7 @@
boost::asio::ip::udp::socket m_nullUdpSocket;
};
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
diff --git a/src/util/detail/network-monitor-impl-rtnl.cpp b/src/net/detail/network-monitor-impl-rtnl.cpp
similarity index 99%
rename from src/util/detail/network-monitor-impl-rtnl.cpp
rename to src/net/detail/network-monitor-impl-rtnl.cpp
index 587bc90..1a05986 100644
--- a/src/util/detail/network-monitor-impl-rtnl.cpp
+++ b/src/net/detail/network-monitor-impl-rtnl.cpp
@@ -23,10 +23,10 @@
#include "network-monitor-impl-rtnl.hpp"
#include "linux-if-constants.hpp"
-#include "../logger.hpp"
#include "../network-address.hpp"
#include "../network-interface.hpp"
-#include "../time.hpp"
+#include "../../util/logger.hpp"
+#include "../../util/time.hpp"
#include <boost/asio/write.hpp>
@@ -38,7 +38,7 @@
NDN_LOG_INIT(ndn.NetworkMonitor);
namespace ndn {
-namespace util {
+namespace net {
NetworkMonitor::Impl::Impl(NetworkMonitor& nm, boost::asio::io_service& io)
: m_nm(nm)
@@ -506,5 +506,5 @@
}
}
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/detail/network-monitor-impl-rtnl.hpp b/src/net/detail/network-monitor-impl-rtnl.hpp
similarity index 94%
rename from src/util/detail/network-monitor-impl-rtnl.hpp
rename to src/net/detail/network-monitor-impl-rtnl.hpp
index db31f61..d43abce 100644
--- a/src/util/detail/network-monitor-impl-rtnl.hpp
+++ b/src/net/detail/network-monitor-impl-rtnl.hpp
@@ -21,8 +21,8 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
#include "ndn-cxx-config.hpp"
#include "../network-monitor.hpp"
@@ -42,7 +42,7 @@
#include <linux/if_link.h>
namespace ndn {
-namespace util {
+namespace net {
class NetworkMonitor::Impl
{
@@ -120,7 +120,7 @@
bool m_isEnumeratingAddresses; ///< true if a dump of all addresses is in progress
};
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
diff --git a/src/util/dns.cpp b/src/net/dns.cpp
similarity index 97%
rename from src/util/dns.cpp
rename to src/net/dns.cpp
index 73fd8b1..0043ec9 100644
--- a/src/util/dns.cpp
+++ b/src/net/dns.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,7 +20,7 @@
*/
#include "dns.hpp"
-#include "scheduler.hpp"
+#include "../util/scheduler.hpp"
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/udp.hpp>
diff --git a/src/util/dns.hpp b/src/net/dns.hpp
similarity index 95%
rename from src/util/dns.hpp
rename to src/net/dns.hpp
index fec923b..79d9a10 100644
--- a/src/util/dns.hpp
+++ b/src/net/dns.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_DNS_HPP
-#define NDN_UTIL_DNS_HPP
+#ifndef NDN_NET_DNS_HPP
+#define NDN_NET_DNS_HPP
#include "../util/time.hpp"
@@ -121,4 +121,4 @@
} // namespace dns
} // namespace ndn
-#endif // NDN_UTIL_DNS_HPP
+#endif // NDN_NET_DNS_HPP
diff --git a/src/util/ethernet.cpp b/src/net/ethernet.cpp
similarity index 96%
rename from src/util/ethernet.cpp
rename to src/net/ethernet.cpp
index e9160d9..0efdd58 100644
--- a/src/util/ethernet.cpp
+++ b/src/net/ethernet.cpp
@@ -33,7 +33,6 @@
#include <ostream>
namespace ndn {
-namespace util {
namespace ethernet {
Address::Address()
@@ -139,11 +138,10 @@
}
} // namespace ethernet
-} // namespace util
} // namespace ndn
std::size_t
-std::hash<ndn::util::ethernet::Address>::operator()(const ndn::util::ethernet::Address& a) const noexcept
+std::hash<ndn::ethernet::Address>::operator()(const ndn::ethernet::Address& a) const noexcept
{
return boost::hash_range(a.cbegin(), a.cend());
}
diff --git a/src/util/ethernet.hpp b/src/net/ethernet.hpp
similarity index 84%
rename from src/util/ethernet.hpp
rename to src/net/ethernet.hpp
index 30a2b8d..d4b8f47 100644
--- a/src/util/ethernet.hpp
+++ b/src/net/ethernet.hpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
+ * Copyright (c) 2014-2017 Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_ETHERNET_HPP
-#define NDN_UTIL_ETHERNET_HPP
+#ifndef NDN_NET_ETHERNET_HPP
+#define NDN_NET_ETHERNET_HPP
#include <array>
#include <cstdint>
@@ -34,7 +34,6 @@
#include <string>
namespace ndn {
-namespace util {
namespace ethernet {
const uint16_t ETHERTYPE_NDN = 0x8624;
@@ -109,19 +108,18 @@
operator<<(std::ostream& o, const Address& a);
} // namespace ethernet
-} // namespace util
} // namespace ndn
namespace std {
// specialize std::hash<> for ethernet::Address
template<>
-struct hash<ndn::util::ethernet::Address>
+struct hash<ndn::ethernet::Address>
{
size_t
- operator()(const ndn::util::ethernet::Address& a) const noexcept;
+ operator()(const ndn::ethernet::Address& a) const noexcept;
};
} // namespace std
-#endif // NDN_UTIL_ETHERNET_HPP
+#endif // NDN_NET_ETHERNET_HPP
diff --git a/src/util/face-uri.cpp b/src/net/face-uri.cpp
similarity index 99%
rename from src/util/face-uri.cpp
rename to src/net/face-uri.cpp
index d1a26df..d550fd5 100644
--- a/src/util/face-uri.cpp
+++ b/src/net/face-uri.cpp
@@ -27,7 +27,6 @@
#include "face-uri.hpp"
#include "dns.hpp"
-#include "ethernet.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/mpl/vector.hpp>
@@ -36,7 +35,6 @@
#include <set>
namespace ndn {
-namespace util {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
@@ -621,5 +619,4 @@
io, timeout);
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/face-uri.hpp b/src/net/face-uri.hpp
similarity index 95%
rename from src/util/face-uri.hpp
rename to src/net/face-uri.hpp
index 09c8aaf..12276cd 100644
--- a/src/util/face-uri.hpp
+++ b/src/net/face-uri.hpp
@@ -25,22 +25,17 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_FACE_URI_HPP
-#define NDN_UTIL_FACE_URI_HPP
+#ifndef NDN_NET_FACE_URI_HPP
+#define NDN_NET_FACE_URI_HPP
-#include "../common.hpp"
-#include "time.hpp"
+#include "ethernet.hpp"
+#include "../util/time.hpp"
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/local/stream_protocol.hpp>
namespace ndn {
-namespace util {
-
-namespace ethernet {
-class Address;
-} // namespace ethernet
/** \brief represents the underlying protocol and address used by a Face
* \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#FaceUri
@@ -197,7 +192,6 @@
std::ostream&
operator<<(std::ostream& os, const FaceUri& uri);
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_FACE_URI_HPP
+#endif // NDN_NET_FACE_URI_HPP
diff --git a/src/util/network-address.cpp b/src/net/network-address.cpp
similarity index 97%
rename from src/util/network-address.cpp
rename to src/net/network-address.cpp
index 5744aba..148c3ec 100644
--- a/src/util/network-address.cpp
+++ b/src/net/network-address.cpp
@@ -24,7 +24,7 @@
#include "network-address.hpp"
namespace ndn {
-namespace util {
+namespace net {
std::ostream&
operator<<(std::ostream& os, AddressScope scope)
@@ -56,5 +56,5 @@
return os << addr.getIp() << '/' << static_cast<unsigned int>(addr.getPrefixLength());
}
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/network-address.hpp b/src/net/network-address.hpp
similarity index 94%
rename from src/util/network-address.hpp
rename to src/net/network-address.hpp
index fd39782..632a30f 100644
--- a/src/util/network-address.hpp
+++ b/src/net/network-address.hpp
@@ -21,15 +21,15 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_NETWORK_ADDRESS_HPP
-#define NDN_UTIL_NETWORK_ADDRESS_HPP
+#ifndef NDN_NET_NETWORK_ADDRESS_HPP
+#define NDN_NET_NETWORK_ADDRESS_HPP
#include "network-monitor.hpp"
#include <boost/asio/ip/address.hpp>
namespace ndn {
-namespace util {
+namespace net {
enum class AddressFamily {
UNSPECIFIED,
@@ -124,7 +124,7 @@
std::ostream&
operator<<(std::ostream& os, const NetworkAddress& address);
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_ADDRESS_HPP
+#endif // NDN_NET_NETWORK_ADDRESS_HPP
diff --git a/src/util/network-interface.cpp b/src/net/network-interface.cpp
similarity index 97%
rename from src/util/network-interface.cpp
rename to src/net/network-interface.cpp
index e192947..a03d850 100644
--- a/src/util/network-interface.cpp
+++ b/src/net/network-interface.cpp
@@ -23,15 +23,15 @@
#include "network-interface.hpp"
#include "detail/linux-if-constants.hpp"
-#include "logger.hpp"
-#include "string-helper.hpp"
+#include "../util/logger.hpp"
+#include "../util/string-helper.hpp"
#include <net/if.h>
NDN_LOG_INIT(ndn.NetworkMonitor);
namespace ndn {
-namespace util {
+namespace net {
NetworkInterface::NetworkInterface()
: m_index(0)
@@ -236,5 +236,5 @@
return os;
}
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/network-interface.hpp b/src/net/network-interface.hpp
similarity index 91%
rename from src/util/network-interface.hpp
rename to src/net/network-interface.hpp
index 4b53a1d..f5fff7e 100644
--- a/src/util/network-interface.hpp
+++ b/src/net/network-interface.hpp
@@ -21,18 +21,18 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_NETWORK_INTERFACE_HPP
-#define NDN_UTIL_NETWORK_INTERFACE_HPP
+#ifndef NDN_NET_NETWORK_INTERFACE_HPP
+#define NDN_NET_NETWORK_INTERFACE_HPP
#include "ethernet.hpp"
#include "network-address.hpp"
#include "network-monitor.hpp"
-#include "signal.hpp"
+#include "../util/signal.hpp"
#include <set>
namespace ndn {
-namespace util {
+namespace net {
/** @brief Indicates the hardware type of a network interface
*/
@@ -72,19 +72,19 @@
public: // signals
/** @brief Fires when interface state changes
*/
- Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
+ util::Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
/** @brief Fires when interface mtu changes
*/
- Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
+ util::Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
/** @brief Fires when a network-layer address is added to the interface
*/
- Signal<NetworkInterface, NetworkAddress> onAddressAdded;
+ util::Signal<NetworkInterface, NetworkAddress> onAddressAdded;
/** @brief Fires when a network-layer address is removed from the interface
*/
- Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
+ util::Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
public: // getters
/** @brief Returns an opaque ID that uniquely identifies the interface on the system
@@ -250,7 +250,7 @@
std::ostream&
operator<<(std::ostream& os, const NetworkInterface& interface);
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_INTERFACE_HPP
+#endif // NDN_NET_NETWORK_INTERFACE_HPP
diff --git a/src/util/network-monitor.cpp b/src/net/network-monitor.cpp
similarity index 97%
rename from src/util/network-monitor.cpp
rename to src/net/network-monitor.cpp
index 0cbc8c4..c4a2e2e 100644
--- a/src/util/network-monitor.cpp
+++ b/src/net/network-monitor.cpp
@@ -34,7 +34,7 @@
#endif
namespace ndn {
-namespace util {
+namespace net {
NetworkMonitor::NetworkMonitor(boost::asio::io_service& io)
: m_impl(make_unique<Impl>(*this, io))
@@ -61,5 +61,5 @@
return m_impl->listNetworkInterfaces();
}
-} // namespace util
+} // namespace net
} // namespace ndn
diff --git a/src/util/network-monitor.hpp b/src/net/network-monitor.hpp
similarity index 89%
rename from src/util/network-monitor.hpp
rename to src/net/network-monitor.hpp
index 629a80e..f3326b7 100644
--- a/src/util/network-monitor.hpp
+++ b/src/net/network-monitor.hpp
@@ -22,10 +22,10 @@
* @author Davide Pesavento <davide.pesavento@lip6.fr>
*/
-#ifndef NDN_UTIL_NETWORK_MONITOR_HPP
-#define NDN_UTIL_NETWORK_MONITOR_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_HPP
+#define NDN_NET_NETWORK_MONITOR_HPP
-#include "signal.hpp"
+#include "../util/signal.hpp"
#include <vector>
@@ -37,7 +37,7 @@
} // namespace boost
namespace ndn {
-namespace util {
+namespace net {
class NetworkInterface;
@@ -109,27 +109,27 @@
public: // signals
/** @brief Fires when network interfaces enumeration is complete
*/
- Signal<NetworkMonitor> onEnumerationCompleted;
+ util::Signal<NetworkMonitor> onEnumerationCompleted;
/** @brief Fires when a new interface is added
*/
- Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceAdded;
+ util::Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceAdded;
/**
* @brief Fires when an interface is removed
* @note The NetworkInterface object is no longer present in the network
* interfaces map when the signal is emitted
*/
- Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceRemoved;
+ util::Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceRemoved;
// only for backward compatibility
- Signal<NetworkMonitor> onNetworkStateChanged;
+ util::Signal<NetworkMonitor> onNetworkStateChanged;
private:
const unique_ptr<Impl> m_impl;
};
-} // namespace util
+} // namespace net
} // namespace ndn
-#endif // NDN_UTIL_NETWORK_MONITOR_HPP
+#endif // NDN_NET_NETWORK_MONITOR_HPP
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index 343ddd2..7fb6341 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,7 +21,7 @@
#include "tcp-transport.hpp"
#include "stream-transport-with-resolver-impl.hpp"
-#include "util/face-uri.hpp"
+#include "net/face-uri.hpp"
namespace ndn {
@@ -51,7 +51,7 @@
}
try {
- const util::FaceUri uri(uriString);
+ const FaceUri uri(uriString);
const std::string scheme = uri.getScheme();
if (scheme != "tcp" && scheme != "tcp4" && scheme != "tcp6") {
@@ -66,7 +66,7 @@
port = uri.getPort();
}
}
- catch (const util::FaceUri::Error& error) {
+ catch (const FaceUri::Error& error) {
BOOST_THROW_EXCEPTION(Error(error.what()));
}
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index f2e44aa..be5536e 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,7 +23,7 @@
#include "stream-transport-impl.hpp"
#include "../face.hpp"
-#include "util/face-uri.hpp"
+#include "net/face-uri.hpp"
namespace ndn {
@@ -47,7 +47,7 @@
}
try {
- const util::FaceUri uri(uriString);
+ const FaceUri uri(uriString);
if (uri.getScheme() != "unix") {
BOOST_THROW_EXCEPTION(Error("Cannot create UnixTransport from \"" +
@@ -58,7 +58,7 @@
path = uri.getPath();
}
}
- catch (const util::FaceUri::Error& error) {
+ catch (const FaceUri::Error& error) {
BOOST_THROW_EXCEPTION(Error(error.what()));
}