-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsslserver.h
48 lines (38 loc) · 1.19 KB
/
sslserver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef SSLSERVER_H
#define SSLSERVER_H
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QByteArray>
#include <QtNetwork/QSslError>
#include <QAbstractSocket>
#include <QWebSocketProtocol>
#include <QSslPreSharedKeyAuthenticator>
#include "app.h"
#include "websocketclient.h"
QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
QT_FORWARD_DECLARE_CLASS(QWebSocket)
class SslServer : public QObject
{
Q_OBJECT
public:
explicit SslServer(QObject *parent = nullptr);
~SslServer();
private:
private Q_SLOTS:
void onAcceptError(QAbstractSocket::SocketError socketError);
void onPeerVerifyError(QSslError socketError);
void onPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
void onServerError(QWebSocketProtocol::CloseCode closeCode);
void onNewConnection();
void processTextMessage(QString message);
void processBinaryMessage(QByteArray message);
void socketDisconnected();
void onSslErrors(const QList<QSslError> &errors);
WebSocketClient *findClientForSocket(QWebSocket* socket);
signals:
public slots:
private:
QWebSocketServer *m_pWebSocketServer;
QList<WebSocketClient *> m_clients;
};
#endif // SSLSERVER_H