face: EthernetChannel
Change-Id: I8d9be571a2b0abe0cfad09756ea6c691e0679450
Refs: #4011
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index 403afac..b239157 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -41,17 +41,14 @@
{
public:
/**
- * \brief Create UDP channel for the local endpoint
+ * \brief Create a UDP channel on the given \p localEndpoint
*
* To enable creation of faces upon incoming connections,
* one needs to explicitly call UdpChannel::listen method.
- * The created socket is bound to the localEndpoint.
- * reuse_address option is set
- *
- * \throw UdpChannel::Error if bind on the socket fails
+ * The created socket is bound to \p localEndpoint.
*/
UdpChannel(const udp::Endpoint& localEndpoint,
- const time::seconds& timeout);
+ time::nanoseconds idleTimeout);
bool
isListening() const override
@@ -66,9 +63,12 @@
}
/**
- * \brief Create a face by establishing connection to remote endpoint
+ * \brief Create a unicast UDP face toward \p remoteEndpoint
*
- * \throw UdpChannel::Error if bind or connect on the socket fail
+ * \param remoteEndpoint The remote UDP endpoint
+ * \param persistency Persistency of the newly created face
+ * \param onFaceCreated Callback to notify successful creation of the face
+ * \param onConnectFailed Callback to notify errors
*/
void
connect(const udp::Endpoint& remoteEndpoint,
@@ -77,14 +77,15 @@
const FaceCreationFailedCallback& onConnectFailed);
/**
- * \brief Enable listening on the local endpoint, accept connections,
- * and create faces when remote host makes a connection
+ * \brief Start listening
+ *
+ * Enable listening on the local endpoint, waiting for incoming datagrams,
+ * and creating a face when a datagram is received from a new remote host.
+ *
+ * Faces created in this way will have on-demand persistency.
*
* \param onFaceCreated Callback to notify successful creation of a face
* \param onFaceCreationFailed Callback to notify errors
- *
- * Once a face is created, if it doesn't send/receive anything for
- * a period of time equal to timeout, it will be destroyed
*/
void
listen(const FaceCreatedCallback& onFaceCreated,
@@ -96,8 +97,8 @@
const FaceCreationFailedCallback& onReceiveFailed);
/**
- * \brief The channel has received a new packet from a remote
- * endpoint that is not associated with any UdpFace yet
+ * \brief The channel has received a packet from a remote
+ * endpoint not associated with any UDP face yet
*/
void
handleNewPeer(const boost::system::error_code& error,
@@ -113,9 +114,9 @@
const udp::Endpoint m_localEndpoint;
udp::Endpoint m_remoteEndpoint; ///< The latest peer that started communicating with us
boost::asio::ip::udp::socket m_socket; ///< Socket used to "accept" new peers
- std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
std::array<uint8_t, ndn::MAX_NDN_PACKET_SIZE> m_receiveBuffer;
- time::seconds m_idleFaceTimeout; ///< Timeout for automatic closure of idle on-demand faces
+ std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
+ const time::nanoseconds m_idleFaceTimeout; ///< Timeout for automatic closure of idle on-demand faces
};
} // namespace face