26 #ifndef NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP
27 #define NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP
33 #include <boost/asio/posix/stream_descriptor.hpp>
34 #include <ndn-cxx/net/network-interface.hpp>
49 class Error :
public std::runtime_error
52 using std::runtime_error::runtime_error;
61 EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
62 time::nanoseconds idleTimeout);
73 return m_channelFaces.size();
80 connect(
const ethernet::Address& remoteEndpoint,
107 handleRead(
const boost::system::error_code& error,
112 processIncomingPacket(span<const uint8_t> packet,
113 const ethernet::Address& sender,
117 std::pair<bool, shared_ptr<Face>>
118 createFace(
const ethernet::Address& remoteEndpoint,
125 shared_ptr<const ndn::net::NetworkInterface> m_localEndpoint;
126 bool m_isListening =
false;
127 boost::asio::posix::stream_descriptor m_socket;
129 std::map<ethernet::Address, shared_ptr<Face>> m_channelFaces;
130 const time::nanoseconds m_idleFaceTimeout;
134 size_t m_nDropped = 0;
Represents a channel that listens on a local endpoint.
EthernetChannel-related error.
Class implementing an 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...
Parameters used to set Transport properties or LinkService options on a newly created face.