SNode.C
|
#include <Receiver.h>
Classes | |
union | ELength2 |
union | ELength8 |
Public Member Functions | |
Receiver (core::socket::stream::SocketConnection *socketConnection) | |
Receiver (const Receiver &)=delete | |
Receiver & | operator= (const Receiver &)=delete |
virtual | ~Receiver () |
std::size_t | receive () |
Private Types | |
enum struct | ParserState { BEGIN , OPCODE , LENGTH , ELENGTH , MASKINGKEY , PAYLOAD , ERROR } |
Private Member Functions | |
std::size_t | readOpcode () |
std::size_t | readLength () |
std::size_t | readELength () |
std::size_t | readMaskingKey () |
std::size_t | readPayload () |
std::size_t | readFrameData (char *chunk, std::size_t chunkLen) |
std::size_t | readELength2 () |
std::size_t | readELength8 () |
virtual void | onMessageStart (int opCode)=0 |
virtual void | onMessageData (const char *chunk, uint64_t chunkLen)=0 |
virtual void | onMessageEnd ()=0 |
virtual void | onMessageError (uint16_t errnum)=0 |
void | reset () |
Private Attributes | |
enum web::websocket::Receiver::ParserState | parserState = ParserState::BEGIN |
bool | fin = false |
bool | continuation = false |
bool | masked = false |
uint8_t | opCode = 0 |
char | maskingKey [4] |
union web::websocket::Receiver::ELength8 | eLength8 |
union web::websocket::Receiver::ELength2 | eLength2 |
uint8_t | elengthNumBytes = 0 |
uint8_t | elengthNumBytesLeft = 0 |
uint64_t | payLoadNumBytes = 0 |
uint64_t | payLoadNumBytesLeft = 0 |
uint8_t | maskingKeyNumBytes = 4 |
uint8_t | maskingKeyNumBytesLeft = 4 |
uint16_t | errorState = 0 |
core::socket::stream::SocketConnection * | socketConnection = nullptr |
Definition at line 64 of file Receiver.h.
|
strongprivate |
Enumerator | |
---|---|
BEGIN | |
OPCODE | |
LENGTH | |
ELENGTH | |
MASKINGKEY | |
PAYLOAD | |
ERROR |
Definition at line 95 of file Receiver.h.
web::websocket::Receiver::Receiver | ( | core::socket::stream::SocketConnection * | socketConnection | ) |
Definition at line 58 of file Receiver.cpp.
References socketConnection.
Referenced by web::websocket::SubProtocolContext::SubProtocolContext().
|
delete |
|
virtual |
Definition at line 62 of file Receiver.cpp.
|
privatepure virtual |
Implemented in web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >, web::websocket::SocketContextUpgrade< SubProtocol, web::http::client::Request, web::http::client::Response >, and web::websocket::SocketContextUpgrade< SubProtocol, web::http::server::Request, web::http::server::Response >.
Referenced by readPayload().
|
privatepure virtual |
Implemented in web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >, web::websocket::SocketContextUpgrade< SubProtocol, web::http::client::Request, web::http::client::Response >, and web::websocket::SocketContextUpgrade< SubProtocol, web::http::server::Request, web::http::server::Response >.
Referenced by readLength(), readMaskingKey(), and readPayload().
|
privatepure virtual |
Implemented in web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >, web::websocket::SocketContextUpgrade< SubProtocol, web::http::client::Request, web::http::client::Response >, and web::websocket::SocketContextUpgrade< SubProtocol, web::http::server::Request, web::http::server::Response >.
Referenced by receive().
|
privatepure virtual |
Implemented in web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >, web::websocket::SocketContextUpgrade< SubProtocol, web::http::client::Request, web::http::client::Response >, and web::websocket::SocketContextUpgrade< SubProtocol, web::http::server::Request, web::http::server::Response >.
Referenced by readOpcode().
|
private |
Definition at line 206 of file Receiver.cpp.
References elengthNumBytes, elengthNumBytesLeft, ERROR, errorState, masked, MASKINGKEY, PAYLOAD, payLoadNumBytes, readELength2(), and readELength8().
Referenced by receive().
|
private |
Definition at line 170 of file Receiver.cpp.
References web::websocket::Receiver::ELength2::asBytes, web::websocket::Receiver::ELength2::asValue, elengthNumBytes, elengthNumBytesLeft, payLoadNumBytes, payLoadNumBytesLeft, and readFrameData().
Referenced by readELength().
|
private |
Definition at line 188 of file Receiver.cpp.
References web::websocket::Receiver::ELength8::asBytes, web::websocket::Receiver::ELength8::asValue, elengthNumBytes, elengthNumBytesLeft, payLoadNumBytes, payLoadNumBytesLeft, and readFrameData().
Referenced by readELength().
|
private |
Definition at line 166 of file Receiver.cpp.
References core::socket::stream::SocketConnection::readFromPeer(), and socketConnection.
Referenced by readELength2(), readELength8(), readLength(), readMaskingKey(), readOpcode(), and readPayload().
|
private |
Definition at line 128 of file Receiver.cpp.
References ELENGTH, elengthNumBytes, elengthNumBytesLeft, fin, masked, MASKINGKEY, onMessageEnd(), PAYLOAD, payLoadNumBytes, payLoadNumBytesLeft, readFrameData(), and reset().
Referenced by receive().
|
private |
Definition at line 232 of file Receiver.cpp.
References fin, maskingKey, maskingKeyNumBytes, maskingKeyNumBytesLeft, onMessageEnd(), PAYLOAD, payLoadNumBytes, readFrameData(), and reset().
Referenced by receive().
|
private |
Definition at line 102 of file Receiver.cpp.
References continuation, ERROR, errorState, fin, LENGTH, onMessageStart(), opCode, and readFrameData().
Referenced by receive().
|
private |
Definition at line 257 of file Receiver.cpp.
References fin, utils::hexDump(), masked, maskingKey, onMessageData(), onMessageEnd(), payLoadNumBytes, payLoadNumBytesLeft, readFrameData(), and reset().
Referenced by receive().
std::size_t web::websocket::Receiver::receive | ( | ) |
Definition at line 65 of file Receiver.cpp.
References BEGIN, ELENGTH, ERROR, errorState, LENGTH, MASKINGKEY, onMessageError(), OPCODE, PAYLOAD, readELength(), readLength(), readMaskingKey(), readOpcode(), readPayload(), and reset().
Referenced by web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >::onReceivedFromPeer().
|
private |
Definition at line 290 of file Receiver.cpp.
References BEGIN, continuation, elengthNumBytes, elengthNumBytesLeft, errorState, fin, masked, maskingKeyNumBytes, maskingKeyNumBytesLeft, opCode, payLoadNumBytes, and payLoadNumBytesLeft.
Referenced by readLength(), readMaskingKey(), readPayload(), and receive().
|
private |
Definition at line 98 of file Receiver.h.
Referenced by readOpcode(), and reset().
|
private |
|
private |
|
private |
Definition at line 115 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), and reset().
|
private |
Definition at line 116 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), and reset().
|
private |
Definition at line 124 of file Receiver.h.
Referenced by readELength(), readOpcode(), receive(), and reset().
|
private |
Definition at line 97 of file Receiver.h.
Referenced by readLength(), readMaskingKey(), readOpcode(), readPayload(), and reset().
|
private |
Definition at line 99 of file Receiver.h.
Referenced by readELength(), readLength(), readPayload(), and reset().
|
private |
Definition at line 103 of file Receiver.h.
Referenced by readMaskingKey(), and readPayload().
|
private |
Definition at line 121 of file Receiver.h.
Referenced by readMaskingKey(), and reset().
|
private |
Definition at line 122 of file Receiver.h.
Referenced by readMaskingKey(), and reset().
|
private |
Definition at line 101 of file Receiver.h.
Referenced by readOpcode(), and reset().
|
private |
|
private |
Definition at line 118 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), readMaskingKey(), readPayload(), and reset().
|
private |
Definition at line 119 of file Receiver.h.
Referenced by readELength2(), readELength8(), readLength(), readPayload(), and reset().
|
private |
Definition at line 126 of file Receiver.h.
Referenced by readFrameData(), and Receiver().