cutelyst
4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
protocolwebsocket.h
1
/*
2
* SPDX-FileCopyrightText: (C) 2017-2019 Daniel Nicoletti <dantti12@gmail.com>
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
#ifndef PROTOCOLWEBSOCKET_H
6
#define PROTOCOLWEBSOCKET_H
7
8
#include "protocol.h"
9
10
namespace
Cutelyst
{
11
class
Context;
12
class
Server;
13
class
ProtocolWebSocket
final :
public
Protocol
14
{
15
public
:
16
ProtocolWebSocket
(
Server
*wsgi);
17
virtual
~ProtocolWebSocket
()
override
;
18
19
Type type()
const override
;
20
21
static
QByteArray
createWebsocketHeader(quint8 opcode, quint64 len);
22
static
QByteArray
createWebsocketCloseReply(
const
QString
&msg, quint16 closeCode);
23
24
void
parse(
Socket
*sock,
QIODevice
*io)
const
override
final
;
25
26
ProtocolData
*createData(
Socket
*sock)
const
override
final
;
27
28
private
:
29
bool
send_text(
Cutelyst::Context
*c,
Socket
*sock,
bool
singleFrame)
const
;
30
void
send_binary(
Cutelyst::Context
*c,
Socket
*sock,
bool
singleFrame)
const
;
31
void
send_pong(
QIODevice
*io,
const
QByteArray
data)
const
;
32
void
send_closed(
Cutelyst::Context
*c,
Socket
*sock,
QIODevice
*io)
const
;
33
bool
websocket_parse_header(
Socket
*sock,
const
char
*buf,
QIODevice
*io)
const
;
34
bool
websocket_parse_size(
Socket
*sock,
const
char
*buf,
int
websockets_max_message_size)
const
;
35
void
websocket_parse_mask(
Socket
*sock,
char
*buf,
QIODevice
*io)
const
;
36
bool
websocket_parse_payload(
Socket
*sock,
char
*buf,
int
len,
QIODevice
*io)
const
;
37
38
int
m_websockets_max_size;
39
};
40
41
}
// namespace Cutelyst
42
43
#endif
// PROTOCOLWEBSOCKET_H
Cutelyst::Context
The Cutelyst Context.
Definition
context.h:42
Cutelyst::ProtocolData
Definition
protocol.h:19
Cutelyst::ProtocolWebSocket
Definition
protocolwebsocket.h:14
Cutelyst::Protocol
Definition
protocol.h:70
Cutelyst::Server
Implements a web server.
Definition
server.h:60
Cutelyst::Socket
Definition
socket.h:25
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition
group-core-actions.dox:1
QByteArray
QIODevice
QString
Cutelyst
Server
protocolwebsocket.h
Generated by
1.9.8