diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-06-02 16:40:22 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-06-17 07:34:57 (GMT) |
commit | f171bc207c2a7371ac6924ff467049dd0258aa00 (patch) | |
tree | eda5b5feb94dea264ea26b839b6f9ef5e32c915f /Swiften/Network/SOCKS5ProxiedConnection.h | |
parent | 5a1bdf2f6a4842176be5938f8db5cb9d151aceb5 (diff) | |
download | swift-contrib-f171bc207c2a7371ac6924ff467049dd0258aa00.zip swift-contrib-f171bc207c2a7371ac6924ff467049dd0258aa00.tar.bz2 |
Allow different connection methods for Client.
Diffstat (limited to 'Swiften/Network/SOCKS5ProxiedConnection.h')
-rw-r--r-- | Swiften/Network/SOCKS5ProxiedConnection.h | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.h b/Swiften/Network/SOCKS5ProxiedConnection.h index 592ce7d..61092e0 100644 --- a/Swiften/Network/SOCKS5ProxiedConnection.h +++ b/Swiften/Network/SOCKS5ProxiedConnection.h @@ -6,54 +6,31 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> - -#include <Swiften/Network/Connection.h> -#include <Swiften/Network/HostAddressPort.h> - -namespace boost { - class thread; - namespace system { - class error_code; - } -} +#include <Swiften/Network/ProxiedConnection.h> namespace Swift { class ConnectionFactory; + class DomainNameResolver; + class TimerFactory; - class SOCKS5ProxiedConnection : public Connection, public boost::enable_shared_from_this<SOCKS5ProxiedConnection> { + class SOCKS5ProxiedConnection : public ProxiedConnection { public: typedef boost::shared_ptr<SOCKS5ProxiedConnection> ref; - ~SOCKS5ProxiedConnection(); - - static ref create(ConnectionFactory* connectionFactory, const HostAddressPort& proxy) { - return ref(new SOCKS5ProxiedConnection(connectionFactory, proxy)); + static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort) { + return ref(new SOCKS5ProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort)); } - virtual void listen(); - virtual void connect(const HostAddressPort& address); - virtual void disconnect(); - virtual void write(const SafeByteArray& data); - - virtual HostAddressPort getLocalAddress() const; - private: - SOCKS5ProxiedConnection(ConnectionFactory* connectionFactory, const HostAddressPort& proxy); + SOCKS5ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort); - void handleConnectionConnectFinished(bool error); - void handleDataRead(boost::shared_ptr<SafeByteArray> data); - void handleDisconnected(const boost::optional<Error>& error); + virtual void initializeProxy(); + virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data); private: enum { ProxyAuthenticating = 0, ProxyConnecting, } proxyState_; - bool connected_; - ConnectionFactory* connectionFactory_; - HostAddressPort proxy_; - HostAddressPort server_; - boost::shared_ptr<Connection> connection_; }; } |