NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
25
#ifndef NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
26
#define NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
27
28
#include "
channel.hpp
"
29
30
namespace
nfd
{
31
32
namespace
unix_stream {
33
typedef
boost::asio::local::stream_protocol::endpoint
Endpoint
;
34
}
// namespace unix_stream
35
42
class
UnixStreamChannel
:
public
Channel
43
{
44
public
:
48
struct
Error
:
public
std::runtime_error
49
{
50
Error
(
const
std::string& what) :
std
::runtime_error(what) {}
51
};
52
59
explicit
60
UnixStreamChannel
(
const
unix_stream::Endpoint
& endpoint);
61
62
~
UnixStreamChannel
()
DECL_OVERRIDE
;
63
73
void
74
listen(
const
FaceCreatedCallback
& onFaceCreated,
75
const
FaceCreationFailedCallback
& onAcceptFailed,
76
int
backlog = boost::asio::local::stream_protocol::acceptor::max_connections);
77
78
bool
79
isListening()
const
;
80
81
private
:
82
void
83
accept(
const
FaceCreatedCallback
& onFaceCreated,
84
const
FaceCreationFailedCallback
& onAcceptFailed);
85
86
void
87
handleAccept(
const
boost::system::error_code& error,
88
const
FaceCreatedCallback
& onFaceCreated,
89
const
FaceCreationFailedCallback
& onAcceptFailed);
90
91
private
:
92
unix_stream::Endpoint
m_endpoint;
93
boost::asio::local::stream_protocol::acceptor m_acceptor;
94
boost::asio::local::stream_protocol::socket m_socket;
95
};
96
97
inline
bool
98
UnixStreamChannel::isListening
()
const
99
{
100
return
m_acceptor.is_open();
101
}
102
103
}
// namespace nfd
104
105
#endif // NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
nfd::UnixStreamChannel
UnixStreamChannel
Definition:
unix-stream-channel.cpp:36
nfd::FaceCreationFailedCallback
function< void(const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
Definition:
channel.hpp:44
nfd::Channel
Definition:
channel.hpp:47
nfd::UnixStreamChannel::Error
UnixStreamChannel-related error.
Definition:
unix-stream-channel.hpp:48
channel.hpp
std
STL namespace.
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports 'override' specifier, otherwise expands to nothing ...
Definition:
common.hpp:50
nfd::UnixStreamChannel::Error::Error
Error(const std::string &what)
Definition:
unix-stream-channel.hpp:50
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:42
nfd::UnixStreamChannel::isListening
bool isListening() const
Definition:
unix-stream-channel.hpp:98
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:33
ndnSIM
NFD
daemon
face
unix-stream-channel.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12