39                        time::nanoseconds idleTimeout)
    40   : m_localEndpoint(localEndpoint)
    42   , m_idleFaceTimeout(idleTimeout)
    51                     bool wantLpReliability,
    55   shared_ptr<Face> 
face;
    57     face = createFace(remoteEndpoint, persistency, wantLpReliability).second;
    59   catch (
const boost::system::system_error& e) {
    62       onConnectFailed(504, std::string(
"Face creation failed: ") + e.what());
    80   m_socket.open(m_localEndpoint.protocol());
    81   m_socket.set_option(ip::udp::socket::reuse_address(
true));
    82   if (m_localEndpoint.address().is_v6()) {
    83     m_socket.set_option(ip::v6_only(
true));
    85   m_socket.bind(m_localEndpoint);
    87   waitForNewPeer(onFaceCreated, onFaceCreationFailed);
    95   m_socket.async_receive_from(boost::asio::buffer(m_receiveBuffer), m_remoteEndpoint,
    96                               bind(&UdpChannel::handleNewPeer, 
this,
    97                                    boost::asio::placeholders::error,
    98                                    boost::asio::placeholders::bytes_transferred,
    99                                    onFaceCreated, onReceiveFailed));
   103 UdpChannel::handleNewPeer(
const boost::system::error_code& error,
   104                           size_t nBytesReceived,
   112         onReceiveFailed(500, 
"Receive failed: " + error.message());
   119   bool isCreated = 
false;
   120   shared_ptr<Face> 
face;
   125   catch (
const boost::system::system_error& e) {
   126     NFD_LOG_CHAN_DEBUG(
"Face creation for " << m_remoteEndpoint << 
" failed: " << e.what());
   128       onReceiveFailed(504, std::string(
"Face creation failed: ") + e.what());
   139   transport->
receiveDatagram(m_receiveBuffer.data(), nBytesReceived, error);
   141   waitForNewPeer(onFaceCreated, onReceiveFailed);
   144 std::pair<bool, shared_ptr<Face>>
   147                        bool wantLpReliability)
   149   auto it = m_channelFaces.find(remoteEndpoint);
   150   if (it != m_channelFaces.end()) {
   153     return {
false, it->second};
   158   socket.set_option(ip::udp::socket::reuse_address(
true));
   159   socket.bind(m_localEndpoint);
   160   socket.connect(remoteEndpoint);
   164   auto linkService = make_unique<GenericLinkService>(options);
   165   auto transport = make_unique<UnicastUdpTransport>(std::move(
socket), persistency, m_idleFaceTimeout);
   166   auto face = make_shared<Face>(std::move(linkService), std::move(transport));
   168   m_channelFaces[remoteEndpoint] = face;
 bool isListening() const override
Returns whether the channel is listening. 
 
void setUri(const FaceUri &uri)
 
LpReliability::Options reliabilityOptions
options for reliability 
 
detail::SimulatorIo & getGlobalIoService()
 
void connectFaceClosedSignal(Face &face, const std::function< void()> &f)
invokes a callback when the face is closed 
 
bool isEnabled
enables link-layer reliability 
 
void connect(const udp::Endpoint &remoteEndpoint, ndn::nfd::FacePersistency persistency, bool wantLpReliability, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
Create a unicast UDP face toward remoteEndpoint. 
 
A Transport that communicates on a unicast UDP socket. 
 
void receiveDatagram(const uint8_t *buffer, size_t nBytesReceived, const boost::system::error_code &error)
Receive datagram, translate buffer into packet, deliver to parent class. 
 
#define NFD_LOG_CHAN_DEBUG(msg)
Log a message at DEBUG level. 
 
UdpChannel(const udp::Endpoint &localEndpoint, time::nanoseconds idleTimeout)
Create a UDP channel on the given localEndpoint. 
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
#define NFD_LOG_CHAN_INFO(msg)
Log a message at INFO level. 
 
#define NFD_LOG_CHAN_TRACE(msg)
Log a message at TRACE level. 
 
#define NFD_LOG_CHAN_WARN(msg)
Log a message at WARN level. 
 
represents the underlying protocol and address used by a Face 
 
function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when a face fails to be created. 
 
boost::asio::ip::udp::endpoint Endpoint
 
Options that control the behavior of GenericLinkService. 
 
void listen(const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
Start listening. 
 
Catch-all error for socket component errors that don't fit in other categories. 
 
#define NFD_LOG_INIT(name)
 
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...