core+face+tools: use asio::ip::address::from_string directly
The compatibility wrappers in ndn-cxx are no longer needed
and will be deprecated soon.
Change-Id: I394164c11dfe776f1d5a6f7c0dceffe9ce6ad85f
diff --git a/core/network.cpp b/core/network.cpp
index 7c96ed3..eafc388 100644
--- a/core/network.cpp
+++ b/core/network.cpp
@@ -25,7 +25,6 @@
#include "network.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
#include <boost/utility/value_init.hpp>
#include <algorithm>
#include <cctype>
@@ -93,8 +92,8 @@
size_t position = networkStr.find('/');
if (position == std::string::npos) {
try {
- network.m_minAddress = ndn::ip::addressFromString(networkStr);
- network.m_maxAddress = ndn::ip::addressFromString(networkStr);
+ network.m_minAddress = ip::address::from_string(networkStr);
+ network.m_maxAddress = ip::address::from_string(networkStr);
}
catch (const boost::system::system_error&) {
is.setstate(std::ios::failbit);
@@ -103,7 +102,7 @@
}
else {
boost::system::error_code ec;
- ip::address address = ndn::ip::addressFromString(networkStr.substr(0, position), ec);
+ auto address = ip::address::from_string(networkStr.substr(0, position), ec);
if (ec) {
is.setstate(std::ios::failbit);
return is;
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index 02d5f33..369af43 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.cpp
@@ -25,8 +25,6 @@
#include "tcp-factory.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
-
namespace nfd {
namespace face {
@@ -169,7 +167,7 @@
return;
}
- tcp::Endpoint endpoint(ndn::ip::addressFromString(req.remoteUri.getHost()),
+ tcp::Endpoint endpoint(ip::address::from_string(req.remoteUri.getHost()),
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
// a canonical tcp4/tcp6 FaceUri cannot have a multicast address
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 2b7b3c8..5d28bed 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -28,7 +28,6 @@
#include "multicast-udp-transport.hpp"
#include "core/global-io.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
@@ -137,7 +136,7 @@
else if (key == "mcast_group_v6") {
const std::string& valueStr = value.get_value<std::string>();
boost::system::error_code ec;
- mcastConfig.groupV6.address(ndn::ip::addressV6FromString(valueStr, ec));
+ mcastConfig.groupV6.address(ip::address_v6::from_string(valueStr, ec));
if (ec) {
BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
valueStr + "' cannot be parsed as an IPv6 address"));
@@ -253,7 +252,7 @@
return;
}
- udp::Endpoint endpoint(ndn::ip::addressFromString(req.remoteUri.getHost()),
+ udp::Endpoint endpoint(ip::address::from_string(req.remoteUri.getHost()),
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
if (endpoint.address().is_multicast()) {
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index 08e4498..5bb4b9f 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -29,8 +29,6 @@
#include "factory-test-common.hpp"
#include "tests/limited-io.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
-
namespace nfd {
namespace face {
namespace tests {
@@ -41,7 +39,7 @@
shared_ptr<TcpChannel>
createChannel(const std::string& localIp, const std::string& localPort)
{
- tcp::Endpoint endpoint(ndn::ip::addressFromString(localIp),
+ tcp::Endpoint endpoint(boost::asio::ip::address::from_string(localIp),
boost::lexical_cast<uint16_t>(localPort));
return factory.createChannel(endpoint);
}
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 75767d5..42bfe1d 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -29,7 +29,6 @@
#include "factory-test-common.hpp"
#include <boost/algorithm/string/replace.hpp>
-#include <ndn-cxx/net/address-converter.hpp>
namespace nfd {
namespace face {
@@ -41,7 +40,7 @@
shared_ptr<UdpChannel>
createChannel(const std::string& localIp, uint16_t localPort)
{
- udp::Endpoint endpoint(ndn::ip::addressFromString(localIp), localPort);
+ udp::Endpoint endpoint(boost::asio::ip::address::from_string(localIp), localPort);
return factory.createChannel(endpoint, 5_min);
}
};
@@ -74,8 +73,8 @@
shared_ptr<Face>
createMulticastFace(const std::string& localIp, const std::string& mcastIp, uint16_t mcastPort)
{
- auto localAddress = ndn::ip::addressFromString(localIp);
- udp::Endpoint mcastEndpoint(ndn::ip::addressFromString(mcastIp), mcastPort);
+ auto localAddress = boost::asio::ip::address::from_string(localIp);
+ udp::Endpoint mcastEndpoint(boost::asio::ip::address::from_string(mcastIp), mcastPort);
if (localAddress.is_v4()) {
BOOST_ASSERT(!netifsV4.empty());
@@ -128,7 +127,7 @@
static bool
isFaceOnNetif(const Face& face, const NetworkInterface& netif)
{
- auto ip = ndn::ip::addressFromString(face.getLocalUri().getHost());
+ auto ip = boost::asio::ip::address::from_string(face.getLocalUri().getHost());
return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
[ip] (const NetworkAddress& a) { return a.getIp() == ip; });
}
diff --git a/tests/daemon/face/websocket-factory.t.cpp b/tests/daemon/face/websocket-factory.t.cpp
index b1c38a6..bedef87 100644
--- a/tests/daemon/face/websocket-factory.t.cpp
+++ b/tests/daemon/face/websocket-factory.t.cpp
@@ -28,8 +28,6 @@
#include "face-system-fixture.hpp"
#include "factory-test-common.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
-
namespace nfd {
namespace face {
namespace tests {
@@ -40,7 +38,7 @@
shared_ptr<WebSocketChannel>
createChannel(const std::string& localIp, const std::string& localPort)
{
- websocket::Endpoint endpoint(ndn::ip::addressFromString(localIp),
+ websocket::Endpoint endpoint(boost::asio::ip::address::from_string(localIp),
boost::lexical_cast<uint16_t>(localPort));
return factory.createChannel(endpoint);
}
diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp
index 3499e89..007a87b 100644
--- a/tests/other/face-benchmark.cpp
+++ b/tests/other/face-benchmark.cpp
@@ -29,7 +29,6 @@
#include "face/tcp-channel.hpp"
#include "face/udp-channel.hpp"
-#include <ndn-cxx/net/address-converter.hpp>
#include <fstream>
#include <iostream>
@@ -125,7 +124,7 @@
}
// create the right face
- auto addr = ndn::ip::addressFromString(uriR.getHost());
+ auto addr = boost::asio::ip::address::from_string(uriR.getHost());
auto port = boost::lexical_cast<uint16_t>(uriR.getPort());
if (uriR.getScheme() == "tcp4") {
m_tcpChannel.connect(tcp::Endpoint(addr, port), {},
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 5d74e4d..cd3f093 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,7 +33,6 @@
#include <ndn-cxx/mgmt/nfd/controller.hpp>
#include <ndn-cxx/mgmt/nfd/face-monitor.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
-#include <ndn-cxx/net/address-converter.hpp>
#include <ndn-cxx/net/face-uri.hpp>
#include <ndn-cxx/security/key-chain.hpp>
@@ -125,7 +124,7 @@
{
if (hasAllowedSchema(uri)) {
boost::system::error_code ec;
- boost::asio::ip::address address = ndn::ip::addressFromString(uri.getHost(), ec);
+ auto address = boost::asio::ip::address::from_string(uri.getHost(), ec);
if (!address.is_multicast()) {
// register all-face prefixes