2 QWebSockets implements the WebSocket protocol as defined in RFC 6455.
3 Copyright (C) 2013 Kurt Pattyn (pattyn.kurt@gmail.com)
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.
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.
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
20 #ifndef DATAPROCESSOR_P_H
21 #define DATAPROCESSOR_P_H
27 // This file is not part of the Qt API. It exists purely as an
28 // implementation detail. This header file may change from version to
29 // version without notice, or even be removed.
38 #include "qwebsocketprotocol.h"
47 The DataProcessor class reads and interprets incoming websocket messages, and emits appropriate signals.
49 class DataProcessor: public QObject
53 explicit DataProcessor(QObject *parent = 0);
54 virtual ~DataProcessor();
56 static quint64 maxMessageSize();
57 static quint64 maxFrameSize();
60 void pingReceived(QByteArray data);
61 void pongReceived(QByteArray data);
62 void closeReceived(QWebSocketProtocol::CloseCode closeCode, QString closeReason);
63 void textFrameReceived(QString frame, bool lastFrame);
64 void binaryFrameReceived(QByteArray frame, bool lastFrame);
65 void textMessageReceived(QString message);
66 void binaryMessageReceived(QByteArray message);
67 void errorEncountered(QWebSocketProtocol::CloseCode code, QString description);
70 void process(QIODevice *pIoDevice);
74 Q_DISABLE_COPY(DataProcessor)
78 PS_READ_PAYLOAD_LENGTH,
79 PS_READ_BIG_PAYLOAD_LENGTH,
87 QWebSocketProtocol::OpCode m_opCode;
88 bool m_isControlFrame;
91 QByteArray m_binaryMessage;
92 QString m_textMessage;
93 quint64 m_payloadLength;
94 QTextCodec::ConverterState *m_pConverterState;
95 QTextCodec *m_pTextCodec;
97 bool processControlFrame(const Frame &frame);
102 #endif // DATAPROCESSOR_P_H