26 #ifndef NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP 27 #define NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP 32 #include <ndn-cxx/net/network-interface.hpp> 46 class Error :
public std::runtime_error
51 :
std::runtime_error(what)
62 EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
63 time::nanoseconds idleTimeout);
74 return m_channelFaces.size();
81 connect(
const ethernet::Address& remoteEndpoint,
108 handleRead(
const boost::system::error_code& error,
113 processIncomingPacket(
const uint8_t* packet,
size_t length,
114 const ethernet::Address& sender,
118 std::pair<bool, shared_ptr<Face>>
119 createFace(
const ethernet::Address& remoteEndpoint,
126 shared_ptr<const ndn::net::NetworkInterface> m_localEndpoint;
128 boost::asio::posix::stream_descriptor m_socket;
130 std::map<ethernet::Address, shared_ptr<Face>> m_channelFaces;
131 const time::nanoseconds m_idleFaceTimeout;
142 #endif // NFD_DAEMON_FACE_ETHERNET_CHANNEL_HPP void listen(const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
Start listening.
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.
size_t size() const override
Returns the number of faces in the channel.
Parameters used to set Transport properties or LinkService options on a newly created face...
EthernetChannel-related error.
Class implementing Ethernet-based channel to create faces.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
EthernetChannel(shared_ptr< const ndn::net::NetworkInterface > localEndpoint, time::nanoseconds idleTimeout)
Create an Ethernet channel on the given localEndpoint (network interface)
Error(const std::string &what)
Represents a channel that listens on a local endpoint.
void connect(const ethernet::Address &remoteEndpoint, const FaceParams ¶ms, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
Create a unicast Ethernet face toward remoteEndpoint.
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...
bool isListening() const override
Returns whether the channel is listening.
Helper class for dealing with libpcap handles.