NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 "
websocketpp.hpp
"
31
32
namespace
nfd
{
33
34
namespace
websocket {
35
typedef
boost::asio::ip::tcp::endpoint
Endpoint
;
36
}
// namespace websocket
37
38
namespace
face
{
39
43
class
WebSocketChannel
:
public
Channel
44
{
45
public
:
53
explicit
54
WebSocketChannel
(
const
websocket::Endpoint
& localEndpoint);
55
56
bool
57
isListening
()
const override
58
{
59
return
m_server.is_listening();
60
}
61
62
size_t
63
size
()
const override
64
{
65
return
m_channelFaces.size();
66
}
67
74
void
75
listen(
const
FaceCreatedCallback
& onFaceCreated);
76
77
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
80
void
81
setPingInterval(
time::milliseconds
interval);
82
85
void
86
setPongTimeout(
time::milliseconds
timeout
);
87
88
void
89
handlePong(
websocketpp::connection_hdl
hdl);
90
91
void
92
handlePongTimeout(
websocketpp::connection_hdl
hdl);
93
94
private
:
95
void
96
handleMessage(
websocketpp::connection_hdl
hdl,
97
websocket::Server::message_ptr
msg);
98
99
void
100
handleOpen(
websocketpp::connection_hdl
hdl);
101
102
void
103
handleClose(
websocketpp::connection_hdl
hdl);
104
105
private
:
106
const
websocket::Endpoint
m_localEndpoint;
107
websocket::Server
m_server;
108
std::map<websocketpp::connection_hdl, shared_ptr<Face>,
109
std::owner_less<websocketpp::connection_hdl>> m_channelFaces;
110
FaceCreatedCallback
m_onFaceCreatedCallback;
111
time::milliseconds
m_pingInterval;
112
};
113
114
}
// namespace face
115
}
// namespace nfd
116
117
#endif // NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:40
websocketpp.hpp
nfd::face::Channel
represent a channel that communicates on a local endpoint
Definition:
channel.hpp:52
nfd::face::WebSocketChannel
Class implementing WebSocket-based channel to create faces.
Definition:
websocket-channel.hpp:43
websocketpp::lib::asio::milliseconds
boost::posix_time::time_duration milliseconds(long duration)
Definition:
asio.hpp:117
websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::message_ptr
connection_type::message_ptr message_ptr
Type of message pointers that this endpoint uses.
Definition:
endpoint.hpp:70
channel.hpp
websocketpp::connection_hdl
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
Definition:
connection_hdl.hpp:48
websocketpp::transport::error::timeout
Timer expired.
Definition:
connection.hpp:174
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::face::WebSocketChannel
WebSocketChannel
Definition:
websocket-channel.cpp:34
websocketpp::server< websocketpp::config::asio >
face
nfd::face::WebSocketChannel::isListening
bool isListening() const override
Returns whether the channel is listening.
Definition:
websocket-channel.hpp:57
nfd::websocket::Endpoint
boost::asio::ip::tcp::endpoint Endpoint
Definition:
websocket-channel.hpp:35
nfd::face::WebSocketChannel::size
size_t size() const override
Returns the number of faces in the channel.
Definition:
websocket-channel.hpp:63
nfd::face::FaceCreatedCallback
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...
Definition:
channel.hpp:35
ndnSIM
NFD
daemon
face
websocket-channel.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11