33 websocketpp::connection_hdl hdl,
35 :
Face(remoteUri, localUri)
57 websocketpp::lib::error_code ec;
58 m_server.send(m_handle, payload.
wire(), payload.
size(),
59 websocketpp::frame::opcode::binary, ec);
77 websocketpp::lib::error_code ec;
78 m_server.send(m_handle, payload.
wire(), payload.
size(),
79 websocketpp::frame::opcode::binary, ec);
94 websocketpp::lib::error_code ec;
95 m_server.close(m_handle, websocketpp::close::status::normal,
"closed by nfd", ec);
106 NFD_LOG_FACE_WARN(
"Received WebSocket message is too big (" << msg.size() <<
" bytes)");
116 std::tie(isOk, element) =
Block::fromBuffer(reinterpret_cast<const uint8_t*>(msg.c_str()),
void sendInterest(const Interest &interest) 1
send an Interest
static std::tuple< bool, Block > fromBuffer(ConstBufferPtr buffer, size_t offset)
Try to construct block from Buffer.
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
void cancel(const EventId &eventId)
cancel a scheduled event
signal::Signal< Face, Interest > onSendInterest
fires when an Interest is sent out
websocketpp::server< websocketpp::config::asio > Server
represents the underlying protocol and address used by a Face
const ByteCounter & getNOutBytes() const
sent bytes
void setPersistency(ndn::nfd::FacePersistency persistency)
const uint8_t * wire() const
void close() 1
Close the face.
bool decodeAndDispatchInput(const Block &element)
Class representing a wire element of NDN-TLV packet format.
represents an Interest packet
signal::Signal< Face, Data > onSendData
fires when a Data is sent out
#define emitSignal(...)
(implementation detail)
void fail(const std::string &reason)
fail the face and raise onFail event if it's UP; otherwise do nothing
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
FaceCounters & getMutableCounters()
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
WebSocketFace(const FaceUri &remoteUri, const FaceUri &localUri, websocketpp::connection_hdl hdl, websocket::Server &server)
void sendData(const Data &data) 1
send a Data
#define NFD_LOG_INIT(name)
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
void handleReceive(const std::string &msg)
const ByteCounter & getNInBytes() const
received bytes
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.
const size_t MAX_NDN_PACKET_SIZE
practical limit of network layer packet size