face: construct EthernetTransport with NetworkInterface
EthernetTransport and EthernetChannel constructors now accept
ndn::net::NetworkInterface instead of NetworkInterfaceInfo,
in preparation for the transition to NetworkMonitor.
refs #4021
Change-Id: I1687a13dfaafde4ab3795a6f8c76c728c12929b9
diff --git a/core/network-interface.cpp b/core/network-interface.cpp
index 02761a9..ad9485e 100644
--- a/core/network-interface.cpp
+++ b/core/network-interface.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,6 +25,7 @@
#include "network-interface.hpp"
#include "core/logger.hpp"
+#include <ndn-cxx/net/network-monitor-stub.hpp>
#include <cerrno>
#include <cstring>
@@ -59,6 +60,29 @@
"NetworkInterfaceInfo must provide a default constructor");
#endif
+shared_ptr<ndn::net::NetworkInterface>
+NetworkInterfaceInfo::asNetworkInterface() const
+{
+ using namespace ndn::net;
+
+ shared_ptr<NetworkInterface> netif = NetworkMonitorStub::makeNetworkInterface();
+ netif->setIndex(this->index);
+ netif->setName(this->name);
+ netif->setEthernetAddress(this->etherAddress);
+ netif->setFlags(this->flags);
+
+ for (const auto& a4 : this->ipv4Addresses) {
+ netif->addNetworkAddress(NetworkAddress(AddressFamily::V4, a4, this->broadcastAddress,
+ 32, AddressScope::GLOBAL, 0));
+ }
+ for (const auto& a6 : this->ipv6Addresses) {
+ netif->addNetworkAddress(NetworkAddress(AddressFamily::V6, a6, {},
+ 128, AddressScope::GLOBAL, 0));
+ }
+
+ return netif;
+}
+
#ifdef WITH_TESTS
static shared_ptr<std::vector<NetworkInterfaceInfo>> s_debugNetworkInterfaces = nullptr;
@@ -100,59 +124,59 @@
switch (ifa->ifa_addr->sa_family) {
- case AF_INET: {
- const sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(ifa->ifa_addr);
- char address[INET_ADDRSTRLEN];
- if (::inet_ntop(AF_INET, &sin->sin_addr, address, sizeof(address))) {
- netif.ipv4Addresses.push_back(address_v4::from_string(address));
- NFD_LOG_TRACE(ifname << ": added IPv4 address " << address);
+ case AF_INET: {
+ const sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(ifa->ifa_addr);
+ char address[INET_ADDRSTRLEN];
+ if (::inet_ntop(AF_INET, &sin->sin_addr, address, sizeof(address))) {
+ netif.ipv4Addresses.push_back(address_v4::from_string(address));
+ NFD_LOG_TRACE(ifname << ": added IPv4 address " << address);
+ }
+ else
+ NFD_LOG_WARN(ifname << ": inet_ntop(AF_INET) failed: " << strerror(errno));
+ break;
}
- else
- NFD_LOG_WARN(ifname << ": inet_ntop(AF_INET) failed: " << strerror(errno));
- break;
- }
- case AF_INET6: {
- const sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(ifa->ifa_addr);
- char address[INET6_ADDRSTRLEN];
- if (::inet_ntop(AF_INET6, &sin6->sin6_addr, address, sizeof(address))) {
- netif.ipv6Addresses.push_back(address_v6::from_string(address));
- NFD_LOG_TRACE(ifname << ": added IPv6 address " << address);
+ case AF_INET6: {
+ const sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(ifa->ifa_addr);
+ char address[INET6_ADDRSTRLEN];
+ if (::inet_ntop(AF_INET6, &sin6->sin6_addr, address, sizeof(address))) {
+ netif.ipv6Addresses.push_back(address_v6::from_string(address));
+ NFD_LOG_TRACE(ifname << ": added IPv6 address " << address);
+ }
+ else
+ NFD_LOG_WARN(ifname << ": inet_ntop(AF_INET6) failed: " << strerror(errno));
+ break;
}
- else
- NFD_LOG_WARN(ifname << ": inet_ntop(AF_INET6) failed: " << strerror(errno));
- break;
- }
#if defined(__linux__)
- case AF_PACKET: {
- const sockaddr_ll* sll = reinterpret_cast<sockaddr_ll*>(ifa->ifa_addr);
- netif.index = sll->sll_ifindex;
- if (sll->sll_hatype == ARPHRD_ETHER && sll->sll_halen == ethernet::ADDR_LEN) {
- netif.etherAddress = ethernet::Address(sll->sll_addr);
- NFD_LOG_TRACE(ifname << ": added Ethernet address " << netif.etherAddress);
+ case AF_PACKET: {
+ const sockaddr_ll* sll = reinterpret_cast<sockaddr_ll*>(ifa->ifa_addr);
+ netif.index = sll->sll_ifindex;
+ if (sll->sll_hatype == ARPHRD_ETHER && sll->sll_halen == ethernet::ADDR_LEN) {
+ netif.etherAddress = ethernet::Address(sll->sll_addr);
+ NFD_LOG_TRACE(ifname << ": added Ethernet address " << netif.etherAddress);
+ }
+ else if (sll->sll_hatype != ARPHRD_LOOPBACK) {
+ NFD_LOG_DEBUG(ifname << ": ignoring link-layer address for unhandled hardware type "
+ << sll->sll_hatype);
+ }
+ break;
}
- else if (sll->sll_hatype != ARPHRD_LOOPBACK) {
- NFD_LOG_DEBUG(ifname << ": ignoring link-layer address for unhandled hardware type "
- << sll->sll_hatype);
- }
- break;
- }
#elif defined(__APPLE__) || defined(__FreeBSD__)
- case AF_LINK: {
- const sockaddr_dl* sdl = reinterpret_cast<sockaddr_dl*>(ifa->ifa_addr);
- netif.index = sdl->sdl_index;
- if (sdl->sdl_type == IFT_ETHER && sdl->sdl_alen == ethernet::ADDR_LEN) {
- netif.etherAddress = ethernet::Address(reinterpret_cast<uint8_t*>(LLADDR(sdl)));
- NFD_LOG_TRACE(ifname << ": added Ethernet address " << netif.etherAddress);
+ case AF_LINK: {
+ const sockaddr_dl* sdl = reinterpret_cast<sockaddr_dl*>(ifa->ifa_addr);
+ netif.index = sdl->sdl_index;
+ if (sdl->sdl_type == IFT_ETHER && sdl->sdl_alen == ethernet::ADDR_LEN) {
+ netif.etherAddress = ethernet::Address(reinterpret_cast<uint8_t*>(LLADDR(sdl)));
+ NFD_LOG_TRACE(ifname << ": added Ethernet address " << netif.etherAddress);
+ }
+ else if (sdl->sdl_type != IFT_LOOP) {
+ NFD_LOG_DEBUG(ifname << ": ignoring link-layer address for unhandled interface type "
+ << sdl->sdl_type);
+ }
+ break;
}
- else if (sdl->sdl_type != IFT_LOOP) {
- NFD_LOG_DEBUG(ifname << ": ignoring link-layer address for unhandled interface type "
- << sdl->sdl_type);
- }
- break;
- }
#endif
}
diff --git a/core/network-interface.hpp b/core/network-interface.hpp
index 4fb76d1..b94fabd 100644
--- a/core/network-interface.hpp
+++ b/core/network-interface.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -27,8 +27,8 @@
#define NFD_CORE_NETWORK_INTERFACE_HPP
#include "common.hpp"
-
#include <ndn-cxx/net/ethernet.hpp>
+#include <ndn-cxx/net/network-interface.hpp>
#include <net/if.h>
@@ -43,15 +43,6 @@
class NetworkInterfaceInfo
{
public:
-
- int index;
- std::string name;
- ethernet::Address etherAddress;
- std::vector<boost::asio::ip::address_v4> ipv4Addresses;
- std::vector<boost::asio::ip::address_v6> ipv6Addresses;
- boost::asio::ip::address_v4 broadcastAddress;
- unsigned int flags;
-
bool
isLoopback() const;
@@ -64,6 +55,22 @@
bool
isUp() const;
+ /** \brief Export to ndn::net::NetworkInterface
+ * \warning This is a temporary adaptation during the transition from NetworkInterfaceInfo to
+ * ndn::net::NetworkInterface. The return value carries the information in this instance
+ * and will not track changes in the actual network interface or emit signals.
+ */
+ shared_ptr<ndn::net::NetworkInterface>
+ asNetworkInterface() const;
+
+public:
+ int index;
+ std::string name;
+ ethernet::Address etherAddress;
+ std::vector<boost::asio::ip::address_v4> ipv4Addresses;
+ std::vector<boost::asio::ip::address_v6> ipv6Addresses;
+ boost::asio::ip::address_v4 broadcastAddress;
+ unsigned int flags;
};
inline bool
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index d0676cc..44fb03c 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -37,18 +37,18 @@
NFD_LOG_INIT("EthernetChannel");
-EthernetChannel::EthernetChannel(const NetworkInterfaceInfo& localEndpoint,
+EthernetChannel::EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
time::nanoseconds idleTimeout)
- : m_localEndpoint(localEndpoint)
+ : m_localEndpoint(std::move(localEndpoint))
, m_isListening(false)
, m_socket(getGlobalIoService())
- , m_pcap(m_localEndpoint.name)
+ , m_pcap(m_localEndpoint->getName())
, m_idleFaceTimeout(idleTimeout)
#ifdef _DEBUG
, m_nDropped(0)
#endif
{
- setUri(FaceUri::fromDev(m_localEndpoint.name));
+ setUri(FaceUri::fromDev(m_localEndpoint->getName()));
NFD_LOG_CHAN_INFO("Creating channel");
}
@@ -131,8 +131,8 @@
}
else {
const ether_header* eh;
- std::tie(eh, err) = ethernet::checkFrameHeader(pkt, len, m_localEndpoint.etherAddress,
- m_localEndpoint.etherAddress);
+ std::tie(eh, err) = ethernet::checkFrameHeader(pkt, len, m_localEndpoint->getEthernetAddress(),
+ m_localEndpoint->getEthernetAddress());
if (eh == nullptr) {
NFD_LOG_CHAN_DEBUG(err);
}
@@ -197,7 +197,7 @@
// else, create a new face
auto linkService = make_unique<GenericLinkService>();
- auto transport = make_unique<UnicastEthernetTransport>(m_localEndpoint, remoteEndpoint,
+ auto transport = make_unique<UnicastEthernetTransport>(*m_localEndpoint, remoteEndpoint,
persistency, m_idleFaceTimeout);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
@@ -218,7 +218,7 @@
return;
std::string filter = "(ether proto " + to_string(ethernet::ETHERTYPE_NDN) +
- ") && (ether dst " + m_localEndpoint.etherAddress.toString() + ")";
+ ") && (ether dst " + m_localEndpoint->getEthernetAddress().toString() + ")";
for (const auto& addr : m_channelFaces | boost::adaptors::map_keys) {
filter += " && (not ether src " + addr.toString() + ")";
}
diff --git a/daemon/face/ethernet-channel.hpp b/daemon/face/ethernet-channel.hpp
index cb4fbe9..8ad2432 100644
--- a/daemon/face/ethernet-channel.hpp
+++ b/daemon/face/ethernet-channel.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -27,8 +27,9 @@
#define NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP
#include "channel.hpp"
+#include "ethernet-protocol.hpp"
#include "pcap-helper.hpp"
-#include "core/network-interface.hpp"
+#include <ndn-cxx/net/network-interface.hpp>
namespace nfd {
namespace face {
@@ -58,7 +59,7 @@
* To enable creation of faces upon incoming connections,
* one needs to explicitly call EthernetChannel::listen method.
*/
- EthernetChannel(const NetworkInterfaceInfo& localEndpoint,
+ EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
time::nanoseconds idleTimeout);
bool
@@ -127,7 +128,7 @@
updateFilter();
private:
- const NetworkInterfaceInfo m_localEndpoint;
+ shared_ptr<const ndn::net::NetworkInterface> m_localEndpoint;
bool m_isListening;
boost::asio::posix::stream_descriptor m_socket;
PcapHelper m_pcap;
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 20fda6d..8fc9822 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -118,9 +118,10 @@
// determine the interfaces on which channels should be created
auto netifs = context.listNetifs() |
- boost::adaptors::filtered([this] (const NetworkInterfaceInfo& netif) {
- return netif.isUp() && !netif.isLoopback();
- });
+ boost::adaptors::transformed([] (const NetworkInterfaceInfo& nii) { return nii.asNetworkInterface(); }) |
+ boost::adaptors::filtered([] (const shared_ptr<const ndn::net::NetworkInterface>& netif) {
+ return netif->isUp() && !netif->isLoopback();
+ });
// create channels
for (const auto& netif : netifs) {
@@ -130,7 +131,7 @@
channel->listen(context.addFace, nullptr);
}
catch (const EthernetChannel::Error& e) {
- NFD_LOG_WARN("Cannot listen on " << netif.name << ": " << e.what());
+ NFD_LOG_WARN("Cannot listen on " << netif->getName() << ": " << e.what());
}
}
}
@@ -218,15 +219,15 @@
}
shared_ptr<EthernetChannel>
-EthernetFactory::createChannel(const NetworkInterfaceInfo& localEndpoint,
+EthernetFactory::createChannel(const shared_ptr<const ndn::net::NetworkInterface>& localEndpoint,
time::nanoseconds idleTimeout)
{
- auto it = m_channels.find(localEndpoint.name);
+ auto it = m_channels.find(localEndpoint->getName());
if (it != m_channels.end())
return it->second;
auto channel = std::make_shared<EthernetChannel>(localEndpoint, idleTimeout);
- m_channels[localEndpoint.name] = channel;
+ m_channels[localEndpoint->getName()] = channel;
return channel;
}
@@ -238,12 +239,12 @@
}
shared_ptr<Face>
-EthernetFactory::createMulticastFace(const NetworkInterfaceInfo& netif,
+EthernetFactory::createMulticastFace(const ndn::net::NetworkInterface& netif,
const ethernet::Address& address)
{
BOOST_ASSERT(address.isMulticast());
- auto key = std::make_pair(netif.name, address);
+ auto key = std::make_pair(netif.getName(), address);
auto found = m_mcastFaces.find(key);
if (found != m_mcastFaces.end()) {
return found->second;
@@ -274,19 +275,19 @@
if (m_mcastConfig.isEnabled) {
// determine interfaces on which faces should be created or retained
auto capableNetifs = context.listNetifs() |
- boost::adaptors::filtered([this] (const NetworkInterfaceInfo& netif) {
- return netif.isUp() && netif.isMulticastCapable() &&
- m_mcastConfig.netifPredicate(netif);
- });
+ boost::adaptors::transformed([] (const NetworkInterfaceInfo& nii) { return nii.asNetworkInterface(); }) |
+ boost::adaptors::filtered([this] (const shared_ptr<const ndn::net::NetworkInterface>& netif) {
+ return netif->isUp() && netif->canMulticast() && m_mcastConfig.netifPredicate(*netif);
+ });
// create faces
for (const auto& netif : capableNetifs) {
shared_ptr<Face> face;
try {
- face = this->createMulticastFace(netif, m_mcastConfig.group);
+ face = this->createMulticastFace(*netif, m_mcastConfig.group);
}
catch (const EthernetTransport::Error& e) {
- NFD_LOG_WARN("Cannot create Ethernet multicast face on " << netif.name << ": " << e.what());
+ NFD_LOG_WARN("Cannot create Ethernet multicast face on " << netif->getName() << ": " << e.what());
continue;
}
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index 1cbe4e9..7480728 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -62,10 +62,10 @@
*
* \return always a valid pointer to a EthernetChannel object, an exception
* is thrown if it cannot be created.
- * \throw PcapHelper::Error
+ * \throw PcapHelper::Error channel creation failed
*/
shared_ptr<EthernetChannel>
- createChannel(const NetworkInterfaceInfo& localEndpoint,
+ createChannel(const shared_ptr<const ndn::net::NetworkInterface>& localEndpoint,
time::nanoseconds idleTimeout);
std::vector<shared_ptr<const Channel>>
@@ -77,13 +77,13 @@
* If this method is called twice with the same arguments, only one face
* will be created. The second call will just return the existing face.
*
- * \param netif local network interface
+ * \param localEndpoint local network interface
* \param group multicast group address
*
* \throw EthernetTransport::Error transport creation fails
*/
shared_ptr<Face>
- createMulticastFace(const NetworkInterfaceInfo& netif,
+ createMulticastFace(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& group);
private:
diff --git a/daemon/face/ethernet-protocol.hpp b/daemon/face/ethernet-protocol.hpp
index 4eca7cf..639c678 100644
--- a/daemon/face/ethernet-protocol.hpp
+++ b/daemon/face/ethernet-protocol.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -26,13 +26,15 @@
#ifndef NFD_DAEMON_FACE_ETHERNET_PROTOCOL_HPP
#define NFD_DAEMON_FACE_ETHERNET_PROTOCOL_HPP
-#include "core/network-interface.hpp"
-
+#include "core/common.hpp"
+#include <ndn-cxx/net/ethernet.hpp>
#include <net/ethernet.h>
namespace nfd {
namespace ethernet {
+using namespace ndn::ethernet;
+
std::pair<const ether_header*, std::string>
checkFrameHeader(const uint8_t* packet, size_t length,
const Address& localAddr, const Address& destAddr);
diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp
index 026b540..5ea05c5 100644
--- a/daemon/face/ethernet-transport.cpp
+++ b/daemon/face/ethernet-transport.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -40,13 +40,13 @@
NFD_LOG_INIT("EthernetTransport");
-EthernetTransport::EthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+EthernetTransport::EthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint)
: m_socket(getGlobalIoService())
- , m_pcap(localEndpoint.name)
- , m_srcAddress(localEndpoint.etherAddress)
+ , m_pcap(localEndpoint.getName())
+ , m_srcAddress(localEndpoint.getEthernetAddress())
, m_destAddress(remoteEndpoint)
- , m_interfaceName(localEndpoint.name)
+ , m_interfaceName(localEndpoint.getName())
, m_hasRecentlyReceived(false)
#ifdef _DEBUG
, m_nDropped(0)
diff --git a/daemon/face/ethernet-transport.hpp b/daemon/face/ethernet-transport.hpp
index 69f4061..2412924 100644
--- a/daemon/face/ethernet-transport.hpp
+++ b/daemon/face/ethernet-transport.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -26,9 +26,10 @@
#ifndef NFD_DAEMON_FACE_ETHERNET_TRANSPORT_HPP
#define NFD_DAEMON_FACE_ETHERNET_TRANSPORT_HPP
+#include "ethernet-protocol.hpp"
#include "pcap-helper.hpp"
#include "transport.hpp"
-#include "core/network-interface.hpp"
+#include <ndn-cxx/net/network-interface.hpp>
namespace nfd {
namespace face {
@@ -60,7 +61,7 @@
const ethernet::Address& sender);
protected:
- EthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+ EthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint);
void
diff --git a/daemon/face/multicast-ethernet-transport.cpp b/daemon/face/multicast-ethernet-transport.cpp
index c8c9b2c..b4adea0 100644
--- a/daemon/face/multicast-ethernet-transport.cpp
+++ b/daemon/face/multicast-ethernet-transport.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -48,12 +48,12 @@
NFD_LOG_INIT("MulticastEthernetTransport");
-MulticastEthernetTransport::MulticastEthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+MulticastEthernetTransport::MulticastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& mcastAddress,
ndn::nfd::LinkType linkType)
: EthernetTransport(localEndpoint, mcastAddress)
#if defined(__linux__)
- , m_interfaceIndex(localEndpoint.index)
+ , m_interfaceIndex(localEndpoint.getIndex())
#endif
{
this->setLocalUri(FaceUri::fromDev(m_interfaceName));
diff --git a/daemon/face/multicast-ethernet-transport.hpp b/daemon/face/multicast-ethernet-transport.hpp
index b89e88b..8c2ce91 100644
--- a/daemon/face/multicast-ethernet-transport.hpp
+++ b/daemon/face/multicast-ethernet-transport.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -40,7 +40,7 @@
/**
* @brief Creates an Ethernet-based transport for multicast communication
*/
- MulticastEthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+ MulticastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& mcastAddress,
ndn::nfd::LinkType linkType);
diff --git a/daemon/face/unicast-ethernet-transport.cpp b/daemon/face/unicast-ethernet-transport.cpp
index 2ec15f0..316c91d 100644
--- a/daemon/face/unicast-ethernet-transport.cpp
+++ b/daemon/face/unicast-ethernet-transport.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -32,7 +32,7 @@
NFD_LOG_INIT("UnicastEthernetTransport");
-UnicastEthernetTransport::UnicastEthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+UnicastEthernetTransport::UnicastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint,
ndn::nfd::FacePersistency persistency,
time::nanoseconds idleTimeout)
diff --git a/daemon/face/unicast-ethernet-transport.hpp b/daemon/face/unicast-ethernet-transport.hpp
index d85dfc7..19617e3 100644
--- a/daemon/face/unicast-ethernet-transport.hpp
+++ b/daemon/face/unicast-ethernet-transport.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -41,7 +41,7 @@
/**
* @brief Creates an Ethernet-based transport for unicast communication
*/
- UnicastEthernetTransport(const NetworkInterfaceInfo& localEndpoint,
+ UnicastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint,
ndn::nfd::FacePersistency persistency,
time::nanoseconds idleTimeout);
diff --git a/tests/daemon/face/ethernet-channel.t.cpp b/tests/daemon/face/ethernet-channel.t.cpp
index 238e193..af9f788 100644
--- a/tests/daemon/face/ethernet-channel.t.cpp
+++ b/tests/daemon/face/ethernet-channel.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -38,7 +38,7 @@
makeChannel()
{
BOOST_ASSERT(netifs.size() > 0);
- return make_unique<EthernetChannel>(netifs.front(), time::seconds(2));
+ return make_unique<EthernetChannel>(netifs.front().asNetworkInterface(), time::seconds(2));
}
};
diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp
index 6705481..c1f2b8e 100644
--- a/tests/daemon/face/ethernet-fixture.hpp
+++ b/tests/daemon/face/ethernet-fixture.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -46,7 +46,8 @@
for (const auto& netif : listNetworkInterfaces()) {
if (!netif.isLoopback() && netif.isUp()) {
try {
- MulticastEthernetTransport transport(netif, ethernet::getBroadcastAddress(),
+ MulticastEthernetTransport transport(*netif.asNetworkInterface(),
+ ethernet::getBroadcastAddress(),
ndn::nfd::LINK_TYPE_MULTI_ACCESS);
netifs.push_back(netif);
}
@@ -64,8 +65,8 @@
BOOST_ASSERT(netifs.size() > 0);
localEp = netifs.front().name;
remoteEp = remoteAddr;
- transport = make_unique<UnicastEthernetTransport>(netifs.front(), remoteEp,
- persistency, time::seconds(2));
+ transport = make_unique<UnicastEthernetTransport>(*netifs.front().asNetworkInterface(),
+ remoteEp, persistency, time::seconds(2));
}
void
@@ -75,7 +76,8 @@
BOOST_ASSERT(netifs.size() > 0);
localEp = netifs.front().name;
remoteEp = mcastGroup;
- transport = make_unique<MulticastEthernetTransport>(netifs.front(), remoteEp, linkType);
+ transport = make_unique<MulticastEthernetTransport>(*netifs.front().asNetworkInterface(),
+ remoteEp, linkType);
}
protected: