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>
47 class Error :
public std::runtime_error
50 using std::runtime_error::runtime_error;
59 EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
60 time::nanoseconds idleTimeout);
71 return m_channelFaces.size();
78 connect(
const ethernet::Address& remoteEndpoint,
105 handleRead(
const boost::system::error_code& error,
110 processIncomingPacket(span<const uint8_t> packet,
111 const ethernet::Address& sender,
115 std::pair<bool, shared_ptr<Face>>
116 createFace(
const ethernet::Address& remoteEndpoint,
123 shared_ptr<const ndn::net::NetworkInterface> m_localEndpoint;
125 boost::asio::posix::stream_descriptor m_socket;
127 std::map<ethernet::Address, shared_ptr<Face>> m_channelFaces;
128 const time::nanoseconds m_idleFaceTimeout;
Represents a channel that listens on a local endpoint.
EthernetChannel-related error.
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...
Parameters used to set Transport properties or LinkService options on a newly created face.