34 shared_ptr<EthernetFace>
39 BOOST_THROW_EXCEPTION(
Error(address.
toString() +
" is not a multicast address"));
41 shared_ptr<EthernetFace> face = findMulticastFace(interface.
name, address);
45 face = make_shared<EthernetFace>(boost::asio::posix::stream_descriptor(
getGlobalIoService()),
48 auto key = std::make_pair(interface.name, address);
49 face->onFail.connectSingleShot([
this, key] (
const std::string& reason) {
50 m_multicastFaces.erase(key);
52 m_multicastFaces.insert({key, face});
57 shared_ptr<EthernetFace>
58 EthernetFactory::findMulticastFace(
const std::string& interfaceName,
61 auto it = m_multicastFaces.find({interfaceName, address});
62 if (it != m_multicastFaces.end())
74 BOOST_THROW_EXCEPTION(
Error(
"EthernetFactory does not support 'createFace' operation"));
77 std::list<shared_ptr<const Channel>>
function< void(const std::string &reason)> FaceConnectFailedCallback
Prototype for the callback that is called when face is failed to get created.
represents an Ethernet hardware address
represents the underlying protocol and address used by a Face
contains information about a network interface
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed) 1
Try to create Face using the supplied FaceUri.
bool isMulticast() const
True if this is a multicast address.
std::string toString(char sep= ':') const
Converts the address to a human-readable string.
Copyright (c) 2011-2015 Regents of the University of California.
shared_ptr< EthernetFace > createMulticastFace(const NetworkInterfaceInfo &interface, const ethernet::Address &address)
Create an EthernetFace to communicate with the given multicast group.
virtual std::list< shared_ptr< const Channel > > getChannels() const
Exception of EthernetFactory.
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback called when face is created (as a response to incoming connection or after...
boost::asio::io_service & getGlobalIoService()