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.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