Torc  0.1
Public Types | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
TorcWebSocketReader Class Reference

#include <torcwebsocketreader.h>

Public Types

enum  OpCode {
  OpContinuation = 0x0, OpText = 0x1, OpBinary = 0x2, OpReserved3 = 0x3,
  OpReserved4 = 0x4, OpReserved5 = 0x5, OpReserved6 = 0x6, OpReserved7 = 0x7,
  OpClose = 0x8, OpPing = 0x9, OpPong = 0xA, OpReservedB = 0xB,
  OpReservedC = 0xC, OpReservedD = 0xD, OpReservedE = 0xE, OpReservedF = 0xF
}
 
enum  CloseCode {
  CloseNormal = 1000, CloseGoingAway = 1001, CloseProtocolError = 1002, CloseUnsupportedDataType = 1003,
  CloseReserved1004 = 1004, CloseStatusCodeMissing = 1005, CloseAbnormal = 1006, CloseInconsistentData = 1007,
  ClosePolicyViolation = 1008, CloseMessageTooBig = 1009, CloseMissingExtension = 1010, CloseUnexpectedError = 1011,
  CloseTLSHandshakeError = 1015
}
 
enum  WSVersion {
  VersionUnknown = -1, Version0 = 0, Version4 = 4, Version5 = 5,
  Version6 = 6, Version7 = 7, Version8 = 8, Version13 = 13
}
 
enum  WSSubProtocol { SubProtocolNone = (0 << 0), SubProtocolJSONRPC = (1 << 0) }
 

Protected Member Functions

 TorcWebSocketReader (QTcpSocket &Socket, WSSubProtocol Protocol, bool ServerSide)
 
 ~TorcWebSocketReader ()=default
 
const QByteArray & GetPayload (void)
 
void Reset (void)
 
bool CloseSent (void)
 
void SendFrame (OpCode Code, QByteArray &Payload)
 
void InitiateClose (CloseCode Close, const QString &Reason)
 
bool Read (void)
 
void EnableEcho (void)
 
void SetSubProtocol (WSSubProtocol Protocol)
 

Static Protected Member Functions

static QString OpCodeToString (OpCode Code)
 Convert OpCode to human readable string. More...
 
static QString CloseCodeToString (CloseCode Code)
 Convert CloseCode to human readable string. More...
 
static OpCode FormatForSubProtocol (WSSubProtocol Protocol)
 
static QString SubProtocolsToString (WSSubProtocols Protocols)
 Convert SubProtocols to HTTP readable string. More...
 
static WSSubProtocols SubProtocolsFromString (const QString &Protocols)
 Parse supported WSSubProtocols from Protocols. More...
 
static QList< WSSubProtocolSubProtocolsFromPrioritisedString (const QString &Protocols)
 Parse a prioritised list of supported WebSocket sub-protocols. More...
 

Friends

class TorcWebSocket
 

Detailed Description

Definition at line 10 of file torcwebsocketreader.h.

Member Enumeration Documentation

Enumerator
CloseNormal 
CloseGoingAway 
CloseProtocolError 
CloseUnsupportedDataType 
CloseReserved1004 
CloseStatusCodeMissing 
CloseAbnormal 
CloseInconsistentData 
ClosePolicyViolation 
CloseMessageTooBig 
CloseMissingExtension 
CloseUnexpectedError 
CloseTLSHandshakeError 

Definition at line 35 of file torcwebsocketreader.h.

Enumerator
OpContinuation 
OpText 
OpBinary 
OpReserved3 
OpReserved4 
OpReserved5 
OpReserved6 
OpReserved7 
OpClose 
OpPing 
OpPong 
OpReservedB 
OpReservedC 
OpReservedD 
OpReservedE 
OpReservedF 

Definition at line 15 of file torcwebsocketreader.h.

Enumerator
SubProtocolNone 
SubProtocolJSONRPC 

Definition at line 64 of file torcwebsocketreader.h.

Enumerator
VersionUnknown 
Version0 
Version4 
Version5 
Version6 
Version7 
Version8 
Version13 

Definition at line 52 of file torcwebsocketreader.h.

Constructor & Destructor Documentation

TorcWebSocketReader::TorcWebSocketReader ( QTcpSocket &  Socket,
WSSubProtocol  Protocol,
bool  ServerSide 
)
protected

Definition at line 121 of file torcwebsocketreader.cpp.

TorcWebSocketReader::~TorcWebSocketReader ( )
protecteddefault

Member Function Documentation

QString TorcWebSocketReader::CloseCodeToString ( CloseCode  Code)
staticprotected

Convert CloseCode to human readable string.

Definition at line 53 of file torcwebsocketreader.cpp.

bool TorcWebSocketReader::CloseSent ( void  )
protected

Definition at line 158 of file torcwebsocketreader.cpp.

void TorcWebSocketReader::EnableEcho ( void  )
protected

Definition at line 163 of file torcwebsocketreader.cpp.

TorcWebSocketReader::OpCode TorcWebSocketReader::FormatForSubProtocol ( WSSubProtocol  Protocol)
staticprotected

Definition at line 76 of file torcwebsocketreader.cpp.

const QByteArray & TorcWebSocketReader::GetPayload ( void  )
protected

Definition at line 143 of file torcwebsocketreader.cpp.

void TorcWebSocketReader::InitiateClose ( CloseCode  Close,
const QString &  Reason 
)
protected

Definition at line 174 of file torcwebsocketreader.cpp.

QString TorcWebSocketReader::OpCodeToString ( OpCode  Code)
staticprotected

Convert OpCode to human readable string.

Definition at line 36 of file torcwebsocketreader.cpp.

bool TorcWebSocketReader::Read ( void  )
protected

Definition at line 355 of file torcwebsocketreader.cpp.

void TorcWebSocketReader::Reset ( void  )
protected

Definition at line 148 of file torcwebsocketreader.cpp.

void TorcWebSocketReader::SendFrame ( OpCode  Code,
QByteArray &  Payload 
)
protected

Definition at line 187 of file torcwebsocketreader.cpp.

void TorcWebSocketReader::SetSubProtocol ( WSSubProtocol  Protocol)
protected

Definition at line 168 of file torcwebsocketreader.cpp.

QList< TorcWebSocketReader::WSSubProtocol > TorcWebSocketReader::SubProtocolsFromPrioritisedString ( const QString &  Protocols)
staticprotected

Parse a prioritised list of supported WebSocket sub-protocols.

Definition at line 111 of file torcwebsocketreader.cpp.

TorcWebSocketReader::WSSubProtocols TorcWebSocketReader::SubProtocolsFromString ( const QString &  Protocols)
staticprotected

Parse supported WSSubProtocols from Protocols.

Definition at line 101 of file torcwebsocketreader.cpp.

QString TorcWebSocketReader::SubProtocolsToString ( WSSubProtocols  Protocols)
staticprotected

Convert SubProtocols to HTTP readable string.

Definition at line 91 of file torcwebsocketreader.cpp.

Friends And Related Function Documentation

friend class TorcWebSocket
friend

Definition at line 12 of file torcwebsocketreader.h.


The documentation for this class was generated from the following files: