26 #ifndef NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP
27 #define NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP
33 #include <ndn-cxx/net/network-interface.hpp>
47 class Error :
public std::runtime_error
52 : std::runtime_error(what)
63 EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
64 time::nanoseconds idleTimeout);
75 return m_channelFaces.size();
82 connect(
const ethernet::Address& remoteEndpoint,
109 handleRead(
const boost::system::error_code& error,
114 processIncomingPacket(span<const uint8_t> packet,
115 const ethernet::Address& sender,
119 std::pair<bool, shared_ptr<Face>>
120 createFace(
const ethernet::Address& remoteEndpoint,
127 shared_ptr<const ndn::net::NetworkInterface> m_localEndpoint;
129 boost::asio::posix::stream_descriptor m_socket;
131 std::map<ethernet::Address, shared_ptr<Face>> m_channelFaces;
132 const time::nanoseconds m_idleFaceTimeout;
Represents a channel that listens on a local endpoint.
EthernetChannel-related error.
Error(const std::string &what)
Class implementing Ethernet-based channel to create faces.
void listen(const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
Start listening.
bool isListening() const final
Returns whether the channel is listening.
void connect(const ethernet::Address &remoteEndpoint, const FaceParams ¶ms, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
Create a unicast Ethernet face toward remoteEndpoint.
size_t size() const final
Returns the number of faces in the channel.
EthernetChannel(shared_ptr< const ndn::net::NetworkInterface > localEndpoint, time::nanoseconds idleTimeout)
Create an Ethernet channel on the given localEndpoint (network interface)
Helper class for dealing with libpcap handles.
std::function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when a face fails to be created.
std::function< void(const shared_ptr< Face > &)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents,...
Parameters used to set Transport properties or LinkService options on a newly created face.