From 91f93d2781e494d7835385aa501667d71ae231e7 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Wed, 6 Nov 2013 20:00:39 +0100 Subject: Add sslEchoClient and sslEchoServer examples Add license headers Change-Id: Ied74cb3db6ceed6c3f361e4afac860a7a3fb7676 Reviewed-by: Kurt Pattyn --- src/websockets/qwebsocketserver.h | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/websockets/qwebsocketserver.h') diff --git a/src/websockets/qwebsocketserver.h b/src/websockets/qwebsocketserver.h index a925fda..c616c0b 100644 --- a/src/websockets/qwebsocketserver.h +++ b/src/websockets/qwebsocketserver.h @@ -42,12 +42,17 @@ #ifndef QWEBSOCKETSERVER_H #define QWEBSOCKETSERVER_H +#include "QtWebSockets/qwebsockets_global.h" +#include "QtWebSockets/qwebsocketprotocol.h" + #include #include #include -#include "QtWebSockets/qwebsockets_global.h" -#include "QtWebSockets/qwebsocketprotocol.h" +#ifndef QT_NO_SSL +#include +#include +#endif QT_BEGIN_NAMESPACE @@ -61,8 +66,17 @@ class Q_WEBSOCKETS_EXPORT QWebSocketServer : public QObject Q_DISABLE_COPY(QWebSocketServer) Q_DECLARE_PRIVATE(QWebSocketServer) + Q_ENUMS(SecureMode) + public: - explicit QWebSocketServer(const QString &serverName, QObject *parent = Q_NULLPTR); + enum SecureMode { +#ifndef QT_NO_SSL + SECURE_MODE, +#endif + NON_SECURE_MODE + }; + + explicit QWebSocketServer(const QString &serverName, SecureMode secureMode, QObject *parent = Q_NULLPTR); virtual ~QWebSocketServer(); bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); @@ -76,6 +90,8 @@ public: quint16 serverPort() const; QHostAddress serverAddress() const; + SecureMode secureMode() const; + bool setSocketDescriptor(int socketDescriptor); int socketDescriptor() const; @@ -96,6 +112,10 @@ public: void setProxy(const QNetworkProxy &networkProxy); QNetworkProxy proxy() const; #endif +#ifndef QT_NO_SSL + void setSslConfiguration(const QSslConfiguration &sslConfiguration); + QSslConfiguration sslConfiguration() const; +#endif QList supportedVersions() const; QList supportedProtocols() const; @@ -103,8 +123,13 @@ public: Q_SIGNALS: void acceptError(QAbstractSocket::SocketError socketError); + //TODO: should use a delegate iso of a synchronous signal void originAuthenticationRequired(QWebSocketCorsAuthenticator *pAuthenticator); void newConnection(); +#ifndef QT_NO_SSL + void peerVerifyError(const QSslError &error); + void sslErrors(const QList &errors); +#endif private: QWebSocketServerPrivate * const d_ptr; -- cgit v1.2.1