1 /***************************************************************************
2 * Copyright (C) 2005-2014 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef DATASTREAMPEER_H
22 #define DATASTREAMPEER_H
24 #include <QDataStream>
26 #include "../../remotepeer.h"
30 class DataStreamPeer : public RemotePeer
44 DataStreamPeer(AuthHandler *authHandler, QTcpSocket *socket, quint16 features, QObject *parent = 0);
46 Protocol::Type protocol() const { return Protocol::DataStreamProtocol; }
47 QString protocolName() const { return "the DataStream protocol"; }
49 static quint16 supportedFeatures();
50 static bool acceptsFeatures(quint16 peerFeatures);
51 quint16 enabledFeatures() const;
53 void dispatch(const Protocol::RegisterClient &msg);
54 void dispatch(const Protocol::ClientDenied &msg);
55 void dispatch(const Protocol::ClientRegistered &msg);
56 void dispatch(const Protocol::SetupData &msg);
57 void dispatch(const Protocol::SetupFailed &msg);
58 void dispatch(const Protocol::SetupDone &msg);
59 void dispatch(const Protocol::Login &msg);
60 void dispatch(const Protocol::LoginFailed &msg);
61 void dispatch(const Protocol::LoginSuccess &msg);
62 void dispatch(const Protocol::SessionState &msg);
64 void dispatch(const Protocol::SyncMessage &msg);
65 void dispatch(const Protocol::RpcCall &msg);
66 void dispatch(const Protocol::InitRequest &msg);
67 void dispatch(const Protocol::InitData &msg);
69 void dispatch(const Protocol::HeartBeat &msg);
70 void dispatch(const Protocol::HeartBeatReply &msg);
73 void protocolError(const QString &errorString);
76 void onSocketDataAvailable();
79 bool readSocketData(QByteArray &data);
80 void writeSocketData(const QVariantList &list);
81 void writeSocketData(const QVariantMap &handshakeMsg);
83 void handleHandshakeMessage(const QVariantList &mapData);
84 void handlePackedFunc(const QVariantList &packedFunc);
85 void dispatchPackedFunc(const QVariantList &packedFunc);