face: make EthernetFace more robust against errors.
We now call .fail() instead of throwing an exception.
Also modernize the code with some C++11 features.
In particular, std::unique_ptr is now used to manage
the pcap instance.
Change-Id: I91200ff9ab64ddb2d86f082647043e42ca85f538
Refs: #1984
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index b7d5ec0..cc8516a 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -47,8 +47,8 @@
}
};
- typedef std::map< std::pair<std::string, ethernet::Address>,
- shared_ptr<EthernetFace> > MulticastFaceMap;
+ typedef std::map<std::pair<std::string, ethernet::Address>,
+ shared_ptr<EthernetFace>> MulticastFaceMap;
// from ProtocolFactory
virtual void
@@ -81,14 +81,10 @@
const MulticastFaceMap&
getMulticastFaces() const;
- virtual std::list<shared_ptr<const Channel> >
+ virtual std::list<shared_ptr<const Channel>>
getChannels() const;
private:
- void
- afterFaceFailed(const std::string& interfaceName,
- const ethernet::Address& address);
-
/**
* \brief Look up EthernetFace using specified interface and address
*
@@ -105,14 +101,12 @@
MulticastFaceMap m_multicastFaces;
};
-
inline const EthernetFactory::MulticastFaceMap&
EthernetFactory::getMulticastFaces() const
{
return m_multicastFaces;
}
-
} // namespace nfd
#endif // NFD_DAEMON_FACE_ETHERNET_FACTORY_HPP