NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
websocket-face.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_FACE_HPP
27
#define NFD_DAEMON_FACE_WEBSOCKET_FACE_HPP
28
29
#include "
face.hpp
"
30
#include "
core/scheduler.hpp
"
31
32
#ifndef HAVE_WEBSOCKET
33
#error "Cannot include this file when WebSocket support is not enabled"
34
#endif // HAVE_WEBSOCKET
35
36
#include "
websocketpp.hpp
"
37
38
namespace
nfd
{
39
40
namespace
websocket {
41
typedef
boost::asio::ip::tcp::endpoint
Endpoint
;
42
typedef
websocketpp::server<websocketpp::config::asio>
Server
;
43
}
// namespace websocket
44
45
50
class
WebSocketFace
:
public
Face
51
{
52
public
:
53
WebSocketFace
(
const
FaceUri
& remoteUri,
const
FaceUri
& localUri,
54
websocketpp::connection_hdl hdl,
websocket::Server
& server);
55
56
// from Face
57
void
58
sendInterest
(
const
Interest
& interest)
DECL_OVERRIDE
;
59
60
void
61
sendData
(
const
Data
& data)
DECL_OVERRIDE
;
62
63
void
64
close
()
DECL_OVERRIDE
;
65
66
void
67
setPingEventId
(
scheduler::EventId
&
id
)
68
{
69
m_pingEventId = id;
70
}
71
72
protected
:
73
// friend because it needs to invoke protected handleReceive
74
friend
class
WebSocketChannel
;
75
76
void
77
handleReceive
(
const
std::string& msg);
78
79
private
:
80
websocketpp::connection_hdl m_handle;
81
websocket::Server
& m_server;
82
scheduler::EventId
m_pingEventId;
83
bool
m_closed;
84
};
85
86
}
// namespace nfd
87
88
#endif // NFD_DAEMON_FACE_WEBSOCKET_FACE_HPP
face.hpp
nfd::WebSocketFace::sendInterest
void sendInterest(const Interest &interest) 1
send an Interest
Definition:
websocket-face.cpp:45
websocketpp.hpp
nfd::websocket::Server
websocketpp::server< websocketpp::config::asio > Server
Definition:
websocket-face.hpp:42
ndn::util::FaceUri
represents the underlying protocol and address used by a Face
Definition:
face-uri.hpp:44
nfd::WebSocketFace::close
void close() 1
Close the face.
Definition:
websocket-face.cpp:85
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
nfd::scheduler::EventId
std::shared_ptr< ns3::EventId > EventId
Definition:
scheduler.hpp:39
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports this feature, otherwise expands to nothing ...
Definition:
common.hpp:49
nfd::Face
represents a face
Definition:
face.hpp:57
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::WebSocketFace
Implementation of Face abstraction that uses WebSocket as underlying transport mechanism.
Definition:
websocket-face.hpp:50
scheduler.hpp
nfd::WebSocketChannel
Class implementing WebSocket-based channel to create faces.
Definition:
websocket-channel.hpp:37
nfd::WebSocketFace::WebSocketFace
WebSocketFace(const FaceUri &remoteUri, const FaceUri &localUri, websocketpp::connection_hdl hdl, websocket::Server &server)
Definition:
websocket-face.cpp:32
nfd::WebSocketFace::sendData
void sendData(const Data &data) 1
send a Data
Definition:
websocket-face.cpp:65
nfd::WebSocketFace::setPingEventId
void setPingEventId(scheduler::EventId &id)
Definition:
websocket-face.hpp:67
nfd::WebSocketFace::handleReceive
void handleReceive(const std::string &msg)
Definition:
websocket-face.cpp:101
nfd::websocket::Endpoint
boost::asio::ip::tcp::endpoint Endpoint
Definition:
websocket-face.hpp:41
ndn::Data
represents a Data packet
Definition:
data.hpp:39
ndnSIM
NFD
daemon
face
websocket-face.hpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14