NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
websocket-transport.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_TRANSPORT_HPP
27
#define NFD_DAEMON_FACE_WEBSOCKET_TRANSPORT_HPP
28
29
#include "
transport.hpp
"
30
#include "
websocketpp.hpp
"
31
#include "
core/scheduler.hpp
"
32
33
namespace
nfd
{
34
namespace
face
{
35
40
class
WebSocketTransportCounters
:
public
virtual
Transport::Counters
41
{
42
public
:
45
PacketCounter
nOutPings
;
46
49
PacketCounter
nInPongs
;
50
};
51
54
class
WebSocketTransport
DECL_CLASS_FINAL
:
public
Transport
55
,
protected
virtual
WebSocketTransportCounters
56
{
57
public
:
60
typedef
WebSocketTransportCounters
Counters
;
61
62
WebSocketTransport
(websocketpp::connection_hdl hdl,
63
websocket::Server
& server,
64
time::milliseconds pingInterval);
65
66
virtual
const
Counters&
67
getCounters() const
DECL_OVERRIDE
;
68
72
void
73
receiveMessage(const
std
::
string
& msg);
74
75
void
76
handlePong();
77
78
void
79
handlePongTimeout();
80
81
protected:
82
virtual
void
83
beforeChangePersistency(
ndn
::
nfd
::
FacePersistency
newPersistency)
DECL_FINAL
;
84
85
virtual
void
86
doClose() DECL_FINAL;
87
88
private:
89
virtual
void
90
doSend(
Transport
::
Packet
&& packet) DECL_FINAL;
91
92
void
93
schedulePing();
94
95
void
96
sendPing();
97
98
void
99
processErrorCode(const websocketpp::lib::error_code& error);
100
101
private:
102
websocketpp::connection_hdl m_handle;
103
websocket::
Server
& m_server;
104
time
::milliseconds m_pingInterval;
105
scheduler::ScopedEventId m_pingEventId;
106
};
107
108
inline const
WebSocketTransport
::Counters&
109
WebSocketTransport
::getCounters()
const
110
{
111
return
*
this
;
112
}
113
114
}
// namespace face
115
}
// namespace nfd
116
117
#endif // NFD_DAEMON_FACE_WEBSOCKET_TRANSPORT_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
websocketpp.hpp
nfd::face::WebSocketTransportCounters
counters provided by WebSocketTransport
Definition:
websocket-transport.hpp:40
nfd::websocket::Server
websocketpp::server< websocketpp::config::asio > Server
Definition:
websocketpp.hpp:46
nfd::face::Transport::Packet
stores a packet along with the remote endpoint
Definition:
transport.hpp:113
nfd::face::TransportCounters
counters provided by Transport
Definition:
transport.hpp:57
std
STL namespace.
DECL_FINAL
#define DECL_FINAL
expands to 'final' if compiler supports 'final' specifier on method, otherwise expands to nothing ...
Definition:
common.hpp:60
nfd::PacketCounter
represents a counter of number of packets
Definition:
counter.hpp:77
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports 'override' specifier, otherwise expands to nothing ...
Definition:
common.hpp:50
ndn::time
Definition:
time-custom-clock.hpp:28
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
nfd::face::DECL_CLASS_FINAL::Counters
WebSocketTransportCounters Counters
counters provided by WebSocketTransport
Definition:
websocket-transport.hpp:60
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
face
nfd::face::WebSocketTransportCounters::nOutPings
PacketCounter nOutPings
count of outgoing Pings
Definition:
websocket-transport.hpp:45
nfd::face::WebSocketTransportCounters::nInPongs
PacketCounter nInPongs
count of incoming Pongs
Definition:
websocket-transport.hpp:49
nfd::face::DECL_CLASS_FINAL
A multicast Transport that uses raw Ethernet II frames.
Definition:
ethernet-transport.hpp:48
scheduler.hpp
transport.hpp
nfd::face::Transport
the lower part of a Face
Definition:
transport.hpp:104
nfd::face::WebSocketTransport
WebSocketTransport
Definition:
websocket-transport.cpp:31
ndnSIM
NFD
daemon
face
websocket-transport.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12