26 #ifndef NFD_DAEMON_FACE_UDP_CHANNEL_HPP
27 #define NFD_DAEMON_FACE_UDP_CHANNEL_HPP
50 time::nanoseconds idleTimeout,
51 bool wantCongestionMarking,
57 return m_socket.is_open();
63 return m_channelFaces.size();
96 handleNewPeer(
const boost::system::error_code& error,
97 size_t nBytesReceived,
101 std::pair<bool, shared_ptr<Face>>
108 boost::asio::ip::udp::socket m_socket;
109 std::array<uint8_t, ndn::MAX_NDN_PACKET_SIZE> m_receiveBuffer;
110 std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
111 const time::nanoseconds m_idleFaceTimeout;
112 const bool m_wantCongestionMarking;
Represents a channel that listens on a local endpoint.
Class implementing a UDP-based channel to create faces.
void listen(const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
Start listening.
size_t size() const final
Returns the number of faces in the channel.
void connect(const udp::Endpoint &remoteEndpoint, const FaceParams ¶ms, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
Create a unicast UDP face toward remoteEndpoint.
UdpChannel(const udp::Endpoint &localEndpoint, time::nanoseconds idleTimeout, bool wantCongestionMarking, size_t defaultMtu)
Create a UDP channel on the given localEndpoint.
bool isListening() const final
Returns whether the channel is 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.
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...
boost::asio::ip::udp::endpoint Endpoint
Parameters used to set Transport properties or LinkService options on a newly created face.