NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
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 "
websocketpp.hpp
"
31
32
namespace
nfd
{
33
34
namespace
websocket {
35
typedef
boost::asio::ip::tcp::endpoint
Endpoint
;
36
}
// namespace websocket
37
41
class
WebSocketChannel
:
public
Channel
42
{
43
public
:
51
explicit
52
WebSocketChannel
(
const
websocket::Endpoint
& localEndpoint);
53
60
void
61
listen(
const
FaceCreatedCallback
& onFaceCreated);
62
66
size_t
67
size()
const
;
68
69
bool
70
isListening()
const
;
71
72
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
75
void
76
setPingInterval(time::milliseconds interval);
77
80
void
81
setPongTimeout(time::milliseconds timeout);
82
83
void
84
handlePong(websocketpp::connection_hdl hdl);
85
86
void
87
handlePongTimeout(websocketpp::connection_hdl hdl);
88
89
private
:
90
void
91
handleMessage(websocketpp::connection_hdl hdl,
92
websocket::Server::message_ptr msg);
93
94
void
95
handleOpen(websocketpp::connection_hdl hdl);
96
97
void
98
handleClose(websocketpp::connection_hdl hdl);
99
100
private
:
101
websocket::Endpoint
m_localEndpoint;
102
websocket::Server
m_server;
103
104
std::map<websocketpp::connection_hdl, shared_ptr<Face>,
105
std::owner_less<websocketpp::connection_hdl>> m_channelFaces;
106
107
FaceCreatedCallback
m_onFaceCreatedCallback;
108
time::milliseconds m_pingInterval;
109
};
110
111
inline
bool
112
WebSocketChannel::isListening
()
const
113
{
114
return
m_server.is_listening();
115
}
116
117
}
// namespace nfd
118
119
#endif // NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:40
nfd::WebSocketChannel::isListening
bool isListening() const
Definition:
websocket-channel.hpp:112
websocketpp.hpp
nfd::WebSocketChannel
WebSocketChannel
Definition:
websocket-channel.cpp:33
nfd::websocket::Server
websocketpp::server< websocketpp::config::asio > Server
Definition:
websocketpp.hpp:46
nfd::Channel
Definition:
channel.hpp:47
channel.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::WebSocketChannel
Class implementing WebSocket-based channel to create faces.
Definition:
websocket-channel.hpp:41
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::websocket::Endpoint
boost::asio::ip::tcp::endpoint Endpoint
Definition:
websocket-channel.hpp:35
ndnSIM
NFD
daemon
face
websocket-channel.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13