NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
unix-stream-channel.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
27
#define NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
28
29
#include "
channel.hpp
"
30
31
namespace
nfd
{
32
33
namespace
unix_stream {
34
typedef
boost::asio::local::stream_protocol::endpoint
Endpoint
;
35
}
// namespace unix_stream
36
43
class
UnixStreamChannel
:
public
Channel
44
{
45
public
:
49
struct
Error
:
public
std::runtime_error
50
{
51
Error
(
const
std::string& what) :
std
::runtime_error(what) {}
52
};
53
60
explicit
61
UnixStreamChannel
(
const
unix_stream::Endpoint
& endpoint);
62
63
~
UnixStreamChannel
()
override
;
64
74
void
75
listen(
const
FaceCreatedCallback
& onFaceCreated,
76
const
FaceCreationFailedCallback
& onAcceptFailed,
77
int
backlog = boost::asio::local::stream_protocol::acceptor::max_connections);
78
79
bool
80
isListening()
const
;
81
82
private
:
83
void
84
accept(
const
FaceCreatedCallback
& onFaceCreated,
85
const
FaceCreationFailedCallback
& onAcceptFailed);
86
87
void
88
handleAccept(
const
boost::system::error_code& error,
89
const
FaceCreatedCallback
& onFaceCreated,
90
const
FaceCreationFailedCallback
& onAcceptFailed);
91
92
private
:
93
unix_stream::Endpoint
m_endpoint;
94
boost::asio::local::stream_protocol::acceptor m_acceptor;
95
boost::asio::local::stream_protocol::socket m_socket;
96
};
97
98
inline
bool
99
UnixStreamChannel::isListening
()
const
100
{
101
return
m_acceptor.is_open();
102
}
103
104
}
// namespace nfd
105
106
#endif // NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
nfd::UnixStreamChannel
UnixStreamChannel
Definition:
unix-stream-channel.cpp:36
nfd::Channel
Definition:
channel.hpp:47
nfd::UnixStreamChannel::Error
UnixStreamChannel-related error.
Definition:
unix-stream-channel.hpp:49
channel.hpp
std
STL namespace.
nfd::UnixStreamChannel::Error::Error
Error(const std::string &what)
Definition:
unix-stream-channel.hpp:51
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::UnixStreamChannel
Class implementing a local channel to create faces.
Definition:
unix-stream-channel.hpp:43
nfd::FaceCreationFailedCallback
function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
Definition:
channel.hpp:44
nfd::UnixStreamChannel::isListening
bool isListening() const
Definition:
unix-stream-channel.hpp:99
nfd::FaceCreatedCallback
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when the face is created (as a response to incoming connec...
Definition:
channel.hpp:38
nfd::unix_stream::Endpoint
boost::asio::local::stream_protocol::endpoint Endpoint
Definition:
unix-stream-channel.hpp:34
ndnSIM
NFD
daemon
face
unix-stream-channel.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13