NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
ConnectFailedCallback
& 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
ConnectFailedCallback
& onAcceptFailed);
85
86
void
87
handleAccept(
const
boost::system::error_code& error,
88
const
FaceCreatedCallback
& onFaceCreated,
89
const
ConnectFailedCallback
& 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:35
nfd::Channel
Definition:
channel.hpp:34
nfd::UnixStreamChannel::isListening
bool isListening() const
Definition:
unix-stream-channel.hpp:98
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 this feature, otherwise expands to nothing ...
Definition:
common.hpp:49
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:38
nfd::UnixStreamChannel
Class implementing a local channel to create faces.
Definition:
unix-stream-channel.hpp:42
nfd::Channel::ConnectFailedCallback
function< void(const std::string &reason)> ConnectFailedCallback
Prototype for the callback that is called when face is failed to get created.
Definition:
channel.hpp:46
nfd::unix_stream::Endpoint
boost::asio::local::stream_protocol::endpoint Endpoint
Definition:
unix-stream-channel.hpp:33
nfd::Channel::FaceCreatedCallback
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback called when face is created (as a response to incoming connection or after...
Definition:
channel.hpp:41
ndnSIM
NFD
daemon
face
unix-stream-channel.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11