SNode.C
|
#include <Receiver.h>
Classes | |
union | ELength2 |
union | ELength8 |
Public Member Functions | |
Receiver (bool maskingExpected) | |
Receiver (const Receiver &)=delete | |
Receiver & | operator= (const Receiver &)=delete |
virtual | ~Receiver () |
std::size_t | receive () |
std::size_t | getPayloadTotalRead () const |
Private Types | |
enum struct | ParserState { BEGIN , OPCODE , LENGTH , ELENGTH , MASKINGKEY , PAYLOAD , ERROR } |
Private Member Functions | |
std::size_t | readFrameData (char *chunk, std::size_t chunkLen) |
std::size_t | readOpcode () |
std::size_t | readLength () |
std::size_t | readELength () |
std::size_t | readMaskingKey () |
std::size_t | readPayload () |
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 () |
virtual std::size_t | readFrameChunk (char *chunk, std::size_t chunkLen) const =0 |
Private Attributes | |
enum web::websocket::Receiver::ParserState | parserState = ParserState::BEGIN |
bool | fin = false |
bool | continuation = false |
bool | masked = false |
bool | maskingExpected = 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 |
std::size_t | payloadTotalRead = 0 |
Definition at line 54 of file Receiver.h.
|
strongprivate |
Enumerator | |
---|---|
BEGIN | |
OPCODE | |
LENGTH | |
ELENGTH | |
MASKINGKEY | |
PAYLOAD | |
ERROR |
Definition at line 89 of file Receiver.h.
web::websocket::Receiver::Receiver | ( | bool | maskingExpected | ) |
Definition at line 60 of file Receiver.cpp.
References maskingExpected.
Referenced by web::websocket::SubProtocolContext::SubProtocolContext().
|
delete |
|
virtual |
Definition at line 64 of file Receiver.cpp.
std::size_t web::websocket::Receiver::getPayloadTotalRead | ( | ) | const |
Definition at line 104 of file Receiver.cpp.
References payloadTotalRead.
Referenced by web::websocket::SocketContextUpgrade< SubProtocolT, RequestT, ResponseT >::getPayloadTotalRead().
|
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 216 of file Receiver.cpp.
References elengthNumBytes, elengthNumBytesLeft, ERROR, errorState, masked, MASKINGKEY, PAYLOAD, payloadNumBytes, readELength2(), and readELength8().
Referenced by receive().
|
private |
Definition at line 180 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 198 of file Receiver.cpp.
References web::websocket::Receiver::ELength8::asBytes, web::websocket::Receiver::ELength8::asValue, elengthNumBytes, elengthNumBytesLeft, payloadNumBytes, payloadNumBytesLeft, and readFrameData().
Referenced by readELength().
|
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 readFrameData().
|
private |
Definition at line 108 of file Receiver.cpp.
References readFrameChunk().
Referenced by readELength2(), readELength8(), readLength(), readMaskingKey(), readOpcode(), and readPayload().
|
private |
Definition at line 138 of file Receiver.cpp.
References ELENGTH, elengthNumBytes, elengthNumBytesLeft, ERROR, fin, masked, maskingExpected, MASKINGKEY, onMessageEnd(), PAYLOAD, payloadNumBytes, payloadNumBytesLeft, readFrameData(), and reset().
Referenced by receive().
|
private |
Definition at line 242 of file Receiver.cpp.
References fin, maskingKey, maskingKeyNumBytes, maskingKeyNumBytesLeft, onMessageEnd(), PAYLOAD, payloadNumBytes, readFrameData(), and reset().
Referenced by receive().
|
private |
Definition at line 112 of file Receiver.cpp.
References continuation, ERROR, errorState, fin, LENGTH, onMessageStart(), opCode, and readFrameData().
Referenced by receive().
|
private |
Definition at line 267 of file Receiver.cpp.
References fin, utils::hexDump(), masked, maskingKey, onMessageData(), onMessageEnd(), payloadNumBytes, payloadNumBytesLeft, payloadTotalRead, readFrameData(), and reset().
Referenced by receive().
std::size_t web::websocket::Receiver::receive | ( | ) |
Definition at line 67 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 302 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 92 of file Receiver.h.
Referenced by readOpcode(), and reset().
|
private |
|
private |
|
private |
Definition at line 111 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), and reset().
|
private |
Definition at line 112 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), and reset().
|
private |
Definition at line 120 of file Receiver.h.
Referenced by readELength(), readOpcode(), receive(), and reset().
|
private |
Definition at line 91 of file Receiver.h.
Referenced by readLength(), readMaskingKey(), readOpcode(), readPayload(), and reset().
|
private |
Definition at line 93 of file Receiver.h.
Referenced by readELength(), readLength(), readPayload(), and reset().
|
private |
Definition at line 95 of file Receiver.h.
Referenced by readLength(), and Receiver().
|
private |
Definition at line 99 of file Receiver.h.
Referenced by readMaskingKey(), and readPayload().
|
private |
Definition at line 117 of file Receiver.h.
Referenced by readMaskingKey(), and reset().
|
private |
Definition at line 118 of file Receiver.h.
Referenced by readMaskingKey(), and reset().
|
private |
Definition at line 97 of file Receiver.h.
Referenced by readOpcode(), and reset().
|
private |
|
private |
Definition at line 114 of file Receiver.h.
Referenced by readELength(), readELength2(), readELength8(), readLength(), readMaskingKey(), readPayload(), and reset().
|
private |
Definition at line 115 of file Receiver.h.
Referenced by readELength2(), readELength8(), readLength(), readPayload(), and reset().
|
private |
Definition at line 122 of file Receiver.h.
Referenced by getPayloadTotalRead(), and readPayload().