diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-28 01:04:55 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-28 01:04:55 +0000 |
| commit | 24e7e5627d7915f31cffade24b5a800ca9ddde9e (patch) | |
| tree | 5f04dc8742f549f314ffbceda5d682f105de2803 /src/server/mod_proxy65.h | |
| parent | 07d0e72d6e7f9fa73d49c2f779206abf79f4a5a7 (diff) | |
| download | qxmpp-24e7e5627d7915f31cffade24b5a800ca9ddde9e.tar.gz | |
add plugin for XEP 0065 ByteStreams proxy
Diffstat (limited to 'src/server/mod_proxy65.h')
| -rw-r--r-- | src/server/mod_proxy65.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/server/mod_proxy65.h b/src/server/mod_proxy65.h new file mode 100644 index 00000000..32d15cf4 --- /dev/null +++ b/src/server/mod_proxy65.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2008-2010 The QXmpp developers + * + * Author: + * Jeremy Lainé + * + * Source: + * http://code.google.com/p/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + */ + +#ifndef QXMPP_SERVER_PROXY65_H +#define QXMPP_SERVER_PROXY65_H + +#include <QTime> + +#include "QXmppServerExtension.h" + +class QTcpSocket; + +class QTcpSocketPair : public QObject +{ + Q_OBJECT + +public: + QTcpSocketPair(const QString &hash); + + void activate(); + void addSocket(QTcpSocket *socket); + + QString key; + QTime time; + qint64 transfer; + +signals: + void finished(); + +private slots: + void disconnected(); + void sendData(); + +private: + QTcpSocket *target; + QTcpSocket *source; +}; + +class QXmppServerProxy65Private; + +/// \brief QXmppServer extension for XEP-0065: SOCKS5 Bytestreams. +/// + +class QXmppServerProxy65 : public QXmppServerExtension +{ + Q_OBJECT + Q_CLASSINFO("ExtensionName", "proxy65"); + Q_PROPERTY(QString jid READ jid WRITE setJid); + Q_PROPERTY(QString statisticsFile READ statisticsFile WRITE setStatisticsFile); + +public: + QXmppServerProxy65(); + ~QXmppServerProxy65(); + + QString jid() const; + void setJid(const QString &jid); + + QString statisticsFile() const; + void setStatisticsFile(const QString &statisticsFile); + + QStringList discoveryItems() const; + bool handleStanza(QXmppStream *stream, const QDomElement &element); + bool start(QXmppServer *server); + void stop(); + +private slots: + void slotPairFinished(); + void slotSocketConnected(QTcpSocket *socket, const QString &hostName, quint16 port); + void slotUpdateStatistics(); + +private: + QXmppServerProxy65Private * const d; +}; + +#endif |
