libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::WebSocket Class Reference

#include <WebSocket.h>

Classes

struct  Header
 

Public Member Functions

 WebSocket ()
 
virtual ~WebSocket ()
 
bool isFinished ()
 
void setFinished ()
 This method sets _finished and terminates _content with a null character. More...
 
std::vector< char > & getContent ()
 
uint32_t getContentSize ()
 
HeadergetHeader ()
 
void reset ()
 
uint32_t process (char *buffer, int32_t bufferLength)
 Parses WebSocket data from a buffer. More...
 
bool dataProcessingStarted ()
 

Static Public Member Functions

static void encode (const std::vector< char > &data, Header::Opcode::Enum messageType, std::vector< char > &output)
 Encodes a WebSocket packet. More...
 
static void encodeClose (std::vector< char > &output)
 Encodes a WebSocket "close" packet. More...
 

Constructor & Destructor Documentation

§ WebSocket()

BaseLib::WebSocket::WebSocket ( )

§ ~WebSocket()

virtual BaseLib::WebSocket::~WebSocket ( )
inlinevirtual

Member Function Documentation

§ dataProcessingStarted()

bool BaseLib::WebSocket::dataProcessingStarted ( )
inline

§ encode()

void BaseLib::WebSocket::encode ( const std::vector< char > &  data,
Header::Opcode::Enum  messageType,
std::vector< char > &  output 
)
static

Encodes a WebSocket packet.

Parameters
[in]dataThe data to encode
[in]messageTypeThe message type of the packet.
[out]outputThe WebSocket packet

§ encodeClose()

void BaseLib::WebSocket::encodeClose ( std::vector< char > &  output)
static

Encodes a WebSocket "close" packet.

Parameters
[out]outputThe WebSocket "close" packet.

§ getContent()

std::vector<char>& BaseLib::WebSocket::getContent ( )
inline

§ getContentSize()

uint32_t BaseLib::WebSocket::getContentSize ( )
inline

§ getHeader()

Header& BaseLib::WebSocket::getHeader ( )
inline

§ isFinished()

bool BaseLib::WebSocket::isFinished ( )
inline

§ process()

uint32_t BaseLib::WebSocket::process ( char *  buffer,
int32_t  bufferLength 
)

Parses WebSocket data from a buffer.

Parameters
bufferThe buffer to parse
bufferLengthThe size of the buffer
Returns
Returns the number of actually processed bytes

§ reset()

void BaseLib::WebSocket::reset ( )

§ setFinished()

void BaseLib::WebSocket::setFinished ( )

This method sets _finished and terminates _content with a null character.

Use it, when the header does not contain "Content-Length".

See also
isFinished()
_finished

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