X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fprotocols%2Flegacy%2Flegacypeer.h;fp=src%2Fcommon%2Fprotocols%2Flegacy%2Flegacypeer.h;h=a3aa178b8b8f99e8986e9aee562e09781d2f2112;hp=0000000000000000000000000000000000000000;hb=1cc49e5bd7542366995f501adf60da4ad90869e2;hpb=8834ebbb9e03ed09bd3509e5f8634769ff68bb48 diff --git a/src/common/protocols/legacy/legacypeer.h b/src/common/protocols/legacy/legacypeer.h new file mode 100644 index 00000000..a3aa178b --- /dev/null +++ b/src/common/protocols/legacy/legacypeer.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef LEGACYPEER_H +#define LEGACYPEER_H + +#include + +#include "../../remotepeer.h" + +class QDataStream; + +class LegacyPeer : public RemotePeer +{ + Q_OBJECT + +public: + enum RequestType { + Sync = 1, + RpcCall, + InitRequest, + InitData, + HeartBeat, + HeartBeatReply + }; + + LegacyPeer(QTcpSocket *socket, QObject *parent = 0); + ~LegacyPeer() {} + + void setSignalProxy(SignalProxy *proxy); + + void dispatch(const Protocol::SyncMessage &msg); + void dispatch(const Protocol::RpcCall &msg); + void dispatch(const Protocol::InitRequest &msg); + void dispatch(const Protocol::InitData &msg); + + void dispatch(const Protocol::HeartBeat &msg); + void dispatch(const Protocol::HeartBeatReply &msg); + + // FIXME: this is only used for the auth phase and should be replaced by something more generic + void writeSocketData(const QVariant &item); + +private slots: + void socketDataAvailable(); + +private: + bool readSocketData(QVariant &item); + void handlePackedFunc(const QVariant &packedFunc); + void dispatchPackedFunc(const QVariantList &packedFunc); + + QDataStream _stream; + qint32 _blockSize; + bool _useCompression; +}; + +#endif