X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fremotepeer.h;h=4a82492372c967157702a6e031bcbdc629daca14;hb=efe4239f96f0cf10b1c94e87f8fdd21f3bdbe10e;hp=5e064252e998903f7ad7e4db7ab6e75743081b66;hpb=6eefdfc697067d184a589fc8a231b16316c09106;p=quassel.git diff --git a/src/common/remotepeer.h b/src/common/remotepeer.h index 5e064252..4a824923 100644 --- a/src/common/remotepeer.h +++ b/src/common/remotepeer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -27,6 +27,7 @@ #include "compressor.h" #include "peer.h" #include "protocol.h" +#include "proxyline.h" #include "signalproxy.h" class QTimer; @@ -39,18 +40,21 @@ class COMMON_EXPORT RemotePeer : public Peer public: // import the virtuals from the baseclass - using Peer::handle; using Peer::dispatch; + using Peer::handle; + + RemotePeer(AuthHandler* authHandler, QTcpSocket* socket, Compressor::CompressionLevel level, QObject* parent = nullptr); - RemotePeer(AuthHandler *authHandler, QTcpSocket *socket, Compressor::CompressionLevel level, QObject *parent = nullptr); + void setSignalProxy(SignalProxy* proxy) override; - void setSignalProxy(SignalProxy *proxy) override; + void setProxyLine(ProxyLine proxyLine); virtual QString protocolName() const = 0; QString description() const override; virtual quint16 enabledFeatures() const { return 0; } QString address() const override; + QHostAddress hostAddress() const; quint16 port() const override; bool isOpen() const override; @@ -62,30 +66,30 @@ public: bool compressionEnabled() const; void setCompressionEnabled(bool enabled); - QTcpSocket *socket() const; + QTcpSocket* socket() const; public slots: - void close(const QString &reason = QString()) override; + void close(const QString& reason = QString()) override; signals: void transferProgress(int current, int max); - void socketError(QAbstractSocket::SocketError error, const QString &errorString); - void statusMessage(const QString &msg); + void socketError(QAbstractSocket::SocketError error, const QString& errorString); + void statusMessage(const QString& msg); // Only used by LegacyPeer void protocolVersionMismatch(int actual, int expected); protected: - SignalProxy *signalProxy() const override; + SignalProxy* signalProxy() const override; - void writeMessage(const QByteArray &msg); - virtual void processMessage(const QByteArray &msg) = 0; + void writeMessage(const QByteArray& msg); + virtual void processMessage(const QByteArray& msg) = 0; // These protocol messages get handled internally and won't reach SignalProxy - void handle(const Protocol::HeartBeat &heartBeat); - void handle(const Protocol::HeartBeatReply &heartBeatReply); - virtual void dispatch(const Protocol::HeartBeat &msg) = 0; - virtual void dispatch(const Protocol::HeartBeatReply &msg) = 0; + void handle(const Protocol::HeartBeat& heartBeat); + void handle(const Protocol::HeartBeatReply& heartBeatReply); + virtual void dispatch(const Protocol::HeartBeat& msg) = 0; + virtual void dispatch(const Protocol::HeartBeatReply& msg) = 0; protected slots: virtual void onSocketStateChanged(QAbstractSocket::SocketState state); @@ -99,13 +103,15 @@ private slots: void changeHeartBeatInterval(int secs); private: - bool readMessage(QByteArray &msg); + bool readMessage(QByteArray& msg); private: - QTcpSocket *_socket; - Compressor *_compressor; - SignalProxy *_signalProxy; - QTimer *_heartBeatTimer; + QTcpSocket* _socket; + Compressor* _compressor; + SignalProxy* _signalProxy; + ProxyLine _proxyLine; + bool _useProxyLine; + QTimer* _heartBeatTimer; int _heartBeatCount; int _lag; quint32 _msgSize;