Added warning comment to private header files
[contrib/qtwebsockets.git] / src / qwebsocketserver_p.h
1 /**
2  * @file websocketserver_p.h
3  * @author Kurt Pattyn (pattyn.kurt@gmail.com)
4  * @brief Defines the private WebSocketServerPrivate class.
5  */
6
7 #ifndef QWEBSOCKETSERVER_P_H
8 #define QWEBSOCKETSERVER_P_H
9 //
10 //  W A R N I N G
11 //  -------------
12 //
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.
16 //
17 // We mean it.
18 //
19
20 #include <QObject>
21 #include <QQueue>
22 #include <QString>
23 #include <QHostAddress>
24 #include "qwebsocket.h"
25
26 class QTcpServer;
27 class QWebSocketServer;
28
29 class QWebSocketServerPrivate : public QObject
30 {
31         Q_OBJECT
32
33 public:
34         explicit QWebSocketServerPrivate(const QString &serverName, QWebSocketServer * const pWebSocketServer, QObject *parent = 0);
35         virtual ~QWebSocketServerPrivate();
36
37         void close();
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);
53
54         QList<QWebSocketProtocol::Version> supportedVersions() const;
55         QList<QString> supportedProtocols() const;
56         QList<QString> supportedExtensions() const;
57
58 Q_SIGNALS:
59         void newConnection();
60
61 private Q_SLOTS:
62         void onNewConnection();
63         void onCloseConnection();
64         void handshakeReceived();
65
66 private:
67         QWebSocketServer * const q_ptr;
68
69         QTcpServer *m_pTcpServer;
70         QString m_serverName;
71         QQueue<QWebSocket *> m_pendingConnections;
72
73         void addPendingConnection(QWebSocket *pWebSocket);
74 };
75
76 #endif // QWEBSOCKETSERVER_P_H