face: use NetworkMonitor in EthernetFactory
EthernetFactory now creates unicast channels and multicast faces
on eligible netifs found by NetworkMonitor. However,
EthernetFactory does not yet react to fine-grained signals from
NetworkMonitor.
refs #4021
Change-Id: I58aac67d5a1b00d3cda76e78627b887f93ffa541
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index 244f769..7f53cff 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -87,12 +87,32 @@
const ethernet::Address& group);
private:
+ /** \brief Create EthernetChannel on \p netif if requested by \p m_unicastConfig.
+ * \return new or existing channel, or nullptr if no channel should be created
+ */
+ shared_ptr<EthernetChannel>
+ applyUnicastConfigToNetif(const shared_ptr<const ndn::net::NetworkInterface>& netif);
+
+ /** \brief Create Ethernet multicast face on \p netif if requested by \p m_mcastConfig.
+ * \return new or existing face, or nullptr if no face should be created
+ */
+ shared_ptr<Face>
+ applyMcastConfigToNetif(const ndn::net::NetworkInterface& netif);
+
void
applyConfig(const FaceSystem::ConfigContext& context);
private:
std::map<std::string, shared_ptr<EthernetChannel>> m_channels; ///< ifname => channel
+ struct UnicastConfig
+ {
+ bool isEnabled = false;
+ bool wantListen = false;
+ time::nanoseconds idleTimeout = time::seconds(600);
+ };
+ UnicastConfig m_unicastConfig;
+
struct MulticastConfig
{
bool isEnabled = false;
@@ -100,11 +120,12 @@
ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS;
NetworkInterfacePredicate netifPredicate;
};
-
MulticastConfig m_mcastConfig;
/// (ifname, group) => face
std::map<std::pair<std::string, ethernet::Address>, shared_ptr<Face>> m_mcastFaces;
+
+ signal::ScopedConnection m_netifAddConn;
};
} // namespace face