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
websocket-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_WEBSOCKET_CHANNEL_HPP
27
#define NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
28
29
#include "
channel.hpp
"
30
#include "
websocket-face.hpp
"
31
32
namespace
nfd
{
33
37
class
WebSocketChannel
:
public
Channel
38
{
39
public
:
49
explicit
50
WebSocketChannel
(
const
websocket::Endpoint
& localEndpoint);
51
59
void
60
listen
(
const
FaceCreatedCallback
& onFaceCreated);
61
65
size_t
66
size
()
const
;
67
68
bool
69
isListening
()
const
;
70
71
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
72
void
73
setPingInterval(time::milliseconds interval);
74
75
void
76
setPongTimeout(time::milliseconds timeout);
77
78
private
:
79
void
80
sendPing(websocketpp::connection_hdl hdl);
81
82
void
83
handlePong(websocketpp::connection_hdl hdl, std::string msg);
84
85
void
86
handlePongTimeout(websocketpp::connection_hdl hdl, std::string msg);
87
88
void
89
handleMessage(websocketpp::connection_hdl hdl, websocket::Server::message_ptr msg);
90
91
void
92
handleOpen(websocketpp::connection_hdl hdl);
93
94
void
95
handleClose(websocketpp::connection_hdl hdl);
96
97
private
:
98
websocket::Endpoint
m_localEndpoint;
99
websocket::Server
m_server;
100
101
std::map<websocketpp::connection_hdl, shared_ptr<WebSocketFace>,
102
std::owner_less<websocketpp::connection_hdl>> m_channelFaces;
103
107
FaceCreatedCallback
m_onFaceCreatedCallback;
108
112
bool
m_isListening;
113
114
time::milliseconds m_pingInterval;
115
};
116
117
inline
bool
118
WebSocketChannel::isListening
()
const
119
{
120
return
m_isListening;
121
}
122
123
}
// namespace nfd
124
125
#endif // NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
nfd::websocket::Server
websocketpp::server< websocketpp::config::asio > Server
Definition:
websocket-face.hpp:42
nfd::Channel
Definition:
channel.hpp:34
channel.hpp
nfd::WebSocketChannel::isListening
bool isListening() const
Definition:
websocket-channel.hpp:118
nfd::WebSocketChannel::WebSocketChannel
WebSocketChannel(const websocket::Endpoint &localEndpoint)
Create WebSocket channel for the local endpoint.
Definition:
websocket-channel.cpp:36
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::WebSocketChannel::size
size_t size() const
Get number of faces in the channel.
Definition:
websocket-channel.cpp:182
nfd::WebSocketChannel::listen
void listen(const FaceCreatedCallback &onFaceCreated)
Enable listening on the local endpoint, accept connections, and create faces when remote host makes a...
Definition:
websocket-channel.cpp:168
nfd::WebSocketChannel
Class implementing WebSocket-based channel to create faces.
Definition:
websocket-channel.hpp:37
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:39
nfd::websocket::Endpoint
boost::asio::ip::tcp::endpoint Endpoint
Definition:
websocket-face.hpp:41
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
websocket-face.hpp
ndnSIM
NFD
daemon
face
websocket-channel.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11