2 * @file websocketserver_p.h
3 * @author Kurt Pattyn (pattyn.kurt@gmail.com)
4 * @brief Defines the private WebSocketServerPrivate class.
7 #ifndef QWEBSOCKETSERVER_P_H
8 #define QWEBSOCKETSERVER_P_H
13 // This file is not part of the Qt API. It exists purely as an
14 // implementation detail. This header file may change from version to
15 // version without notice, or even be removed.
23 #include <QHostAddress>
24 #include "qwebsocket.h"
27 class QWebSocketServer;
29 class QWebSocketServerPrivate : public QObject
34 explicit QWebSocketServerPrivate(const QString &serverName, QWebSocketServer * const pWebSocketServer, QObject *parent = 0);
35 virtual ~QWebSocketServerPrivate();
38 QString errorString() const;
39 bool hasPendingConnections() const;
40 bool isListening() const;
41 bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
42 int maxPendingConnections() const;
43 virtual QWebSocket *nextPendingConnection();
44 QNetworkProxy proxy() const;
45 QHostAddress serverAddress() const;
46 QAbstractSocket::SocketError serverError() const;
47 quint16 serverPort() const;
48 void setMaxPendingConnections(int numConnections);
49 void setProxy(const QNetworkProxy &networkProxy);
50 bool setSocketDescriptor(int socketDescriptor);
51 int socketDescriptor() const;
52 bool waitForNewConnection(int msec = 0, bool *timedOut = 0);
54 QList<QWebSocketProtocol::Version> supportedVersions() const;
55 QList<QString> supportedProtocols() const;
56 QList<QString> supportedExtensions() const;
62 void onNewConnection();
63 void onCloseConnection();
64 void handshakeReceived();
67 QWebSocketServer * const q_ptr;
69 QTcpServer *m_pTcpServer;
71 QQueue<QWebSocket *> m_pendingConnections;
73 void addPendingConnection(QWebSocket *pWebSocket);
76 #endif // QWEBSOCKETSERVER_P_H