Implementation of Face abstraction that uses WebSocket as underlying transport mechanism. More...
#include <websocket-face.hpp>
Public Member Functions | |
WebSocketFace (const FaceUri &remoteUri, const FaceUri &localUri, websocketpp::connection_hdl hdl, websocket::Server &server) | |
void | sendInterest (const Interest &interest) 1 |
send an Interest More... | |
void | sendData (const Data &data) 1 |
send a Data More... | |
void | close () 1 |
Close the face. More... | |
void | setPingEventId (scheduler::EventId &id) |
Public Member Functions inherited from nfd::Face | |
Face (const FaceUri &remoteUri, const FaceUri &localUri, bool isLocal=false, bool isMultiAccess=false) | |
virtual | ~Face () |
FaceId | getId () const |
const std::string & | getDescription () const |
Get the description. More... | |
void | setDescription (const std::string &description) |
Set the face description. More... | |
void | setMetric (uint64_t metric) |
uint64_t | getMetric () const |
bool | isLocal () const |
Get whether face is connected to a local app. More... | |
ndn::nfd::FacePersistency | getPersistency () const |
Get the persistency setting. More... | |
bool | isMultiAccess () const |
Get whether packets sent by this face may reach multiple peers. More... | |
virtual bool | isUp () const |
Get whether underlying communication is up. More... | |
const FaceCounters & | getCounters () const |
const FaceUri & | getRemoteUri () const |
const FaceUri & | getLocalUri () const |
template<typename FaceTraits > | |
void | copyStatusTo (FaceTraits &traits) const |
virtual ndn::nfd::FaceStatus | getFaceStatus () const |
Protected Member Functions | |
void | handleReceive (const std::string &msg) |
Protected Member Functions inherited from nfd::Face | |
void | setPersistency (ndn::nfd::FacePersistency persistency) |
bool | decodeAndDispatchInput (const Block &element) |
void | fail (const std::string &reason) |
fail the face and raise onFail event if it's UP; otherwise do nothing More... | |
FaceCounters & | getMutableCounters () |
Friends | |
class | WebSocketChannel |
Additional Inherited Members | |
Public Attributes inherited from nfd::Face | |
signal::Signal< Face, Interest > | onReceiveInterest |
fires when an Interest is received More... | |
signal::Signal< Face, Data > | onReceiveData |
fires when a Data is received More... | |
signal::Signal< Face, Interest > | onSendInterest |
fires when an Interest is sent out More... | |
signal::Signal< Face, Data > | onSendData |
fires when a Data is sent out More... | |
signal::Signal< Face, std::string > | onFail |
fires when face disconnects or fails to perform properly More... | |
Implementation of Face abstraction that uses WebSocket as underlying transport mechanism.
Definition at line 50 of file websocket-face.hpp.
nfd::WebSocketFace::WebSocketFace | ( | const FaceUri & | remoteUri, |
const FaceUri & | localUri, | ||
websocketpp::connection_hdl | hdl, | ||
websocket::Server & | server | ||
) |
Definition at line 32 of file websocket-face.cpp.
References ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, NFD_LOG_FACE_INFO, and nfd::Face::setPersistency().
|
virtual |
send an Interest
Implements nfd::Face.
Definition at line 45 of file websocket-face.cpp.
References emitSignal, nfd::Face::getMutableCounters(), nfd::LinkLayerCounters::getNOutBytes(), NFD_LOG_FACE_TRACE, NFD_LOG_FACE_WARN, nfd::Face::onSendInterest, ndn::Block::size(), ndn::Block::wire(), and ndn::Interest::wireEncode().
|
virtual |
send a Data
Implements nfd::Face.
Definition at line 65 of file websocket-face.cpp.
References emitSignal, nfd::Face::getMutableCounters(), nfd::LinkLayerCounters::getNOutBytes(), NFD_LOG_FACE_TRACE, NFD_LOG_FACE_WARN, nfd::Face::onSendData, ndn::Block::size(), ndn::Block::wire(), and ndn::Data::wireEncode().
|
virtual |
Close the face.
This terminates all communication on the face and cause onFail() method event to be invoked
Implements nfd::Face.
Definition at line 85 of file websocket-face.cpp.
References nfd::scheduler::cancel(), nfd::Face::fail(), and NFD_LOG_FACE_INFO.
|
inline |
Definition at line 67 of file websocket-face.hpp.
|
protected |
Definition at line 101 of file websocket-face.cpp.
References nfd::Face::decodeAndDispatchInput(), ndn::Block::fromBuffer(), nfd::Face::getMutableCounters(), nfd::LinkLayerCounters::getNInBytes(), ndn::MAX_NDN_PACKET_SIZE, NFD_LOG_FACE_TRACE, NFD_LOG_FACE_WARN, and ndn::Block::type().
|
friend |
Definition at line 74 of file websocket-face.hpp.