There was no '?' between path and query. Bug detected by someone on the internet.
[contrib/qtwebsockets.git] / src / qwebsocketserver.h
1 /*
2 QWebSockets implements the WebSocket protocol as defined in RFC 6455.
3 Copyright (C) 2013 Kurt Pattyn (pattyn.kurt@gmail.com)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20 #ifndef QWEBSOCKETSERVER_H
21 #define QWEBSOCKETSERVER_H
22
23 #include <QObject>
24 #include <QString>
25 #include <QHostAddress>
26 #include "qwebsocketsglobal.h"
27 #include "qwebsocketprotocol.h"
28
29 QT_BEGIN_NAMESPACE
30
31 class QWebSocketServerPrivate;
32 class QWebSocket;
33 class QCorsAuthenticator;
34
35 class Q_WEBSOCKETS_EXPORT QWebSocketServer : public QObject
36 {
37     Q_OBJECT
38
39 public:
40     explicit QWebSocketServer(const QString &serverName, QObject *parent = 0);
41     virtual ~QWebSocketServer();
42
43     bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
44     void close();
45
46     bool isListening() const;
47
48     void setMaxPendingConnections(int numConnections);
49     int maxPendingConnections() const;
50
51     quint16 serverPort() const;
52     QHostAddress serverAddress() const;
53
54     bool setSocketDescriptor(int socketDescriptor);
55     int socketDescriptor() const;
56
57     bool waitForNewConnection(int msec = 0, bool *timedOut = 0);
58     bool hasPendingConnections() const;
59     virtual QWebSocket *nextPendingConnection();
60
61     QAbstractSocket::SocketError serverError() const;
62     QString errorString() const;
63
64     void pauseAccepting();
65     void resumeAccepting();
66
67     void setServerName(const QString &serverName);
68     QString serverName() const;
69
70 #ifndef QT_NO_NETWORKPROXY
71     void setProxy(const QNetworkProxy &networkProxy);
72     QNetworkProxy proxy() const;
73 #endif
74
75     QList<QWebSocketProtocol::Version> supportedVersions() const;
76     QList<QString> supportedProtocols() const;
77     QList<QString> supportedExtensions() const;
78
79 Q_SIGNALS:
80     void acceptError(QAbstractSocket::SocketError socketError);
81     void originAuthenticationRequired(QCorsAuthenticator *pAuthenticator);
82     void newConnection();
83
84 private:
85     Q_DISABLE_COPY(QWebSocketServer)
86     Q_DECLARE_PRIVATE(QWebSocketServer)
87     QWebSocketServerPrivate * const d_ptr;
88 };
89
90 QT_END_NAMESPACE
91
92 #endif // QWEBSOCKETSERVER_H