Renamed qwebsocket.pri to qwebsockets.pri
[contrib/qtwebsockets.git] / src / handshakerequest_p.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 HANDSHAKEREQUEST_P_H
21 #define HANDSHAKEREQUEST_P_H
22 //
23 //  W A R N I N G
24 //  -------------
25 //
26 // This file is not part of the Qt API.  It exists purely as an
27 // implementation detail.  This header file may change from version to
28 // version without notice, or even be removed.
29 //
30 // We mean it.
31 //
32
33 #include <QObject>
34 #include <QMap>
35 #include <QString>
36 #include <QUrl>
37 #include <QSet>
38
39 #include "qwebsocketprotocol.h"
40
41 QT_BEGIN_NAMESPACE
42
43 class QTextStream;
44
45 class HandshakeRequest
46 {
47 public:
48         HandshakeRequest(int port, bool isSecure);
49         virtual ~HandshakeRequest();
50
51         void clear();
52
53         int getPort() const;
54         bool isSecure() const;
55         bool isValid() const;
56         QMap<QString, QString> getHeaders() const;
57         QList<QWebSocketProtocol::Version> getVersions() const;
58         QString getKey() const;
59         QString getOrigin() const;
60         QList<QString> getProtocols() const;
61         QList<QString> getExtensions() const;
62         QUrl getRequestUrl() const;
63         QString getResourceName() const;
64         QString getHost() const;
65
66 private:
67         Q_DISABLE_COPY(HandshakeRequest)
68         QTextStream &readFromStream(QTextStream &textStream);
69         friend QTextStream &operator >>(QTextStream &stream, HandshakeRequest &request);
70
71         int m_port;
72         bool m_isSecure;
73         bool m_isValid;
74         QMap<QString, QString> m_headers;
75         QList<QWebSocketProtocol::Version> m_versions;
76         QString m_key;
77         QString m_origin;
78         QList<QString> m_protocols;
79         QList<QString> m_extensions;
80         QUrl m_requestUrl;
81 };
82
83 QTextStream &operator >>(QTextStream &stream, HandshakeRequest &request);
84
85 QT_END_NAMESPACE
86
87 #endif // HANDSHAKEREQUEST_P_H