summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-06-02 16:40:22 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-06-17 07:34:57 (GMT)
commitf171bc207c2a7371ac6924ff467049dd0258aa00 (patch)
treeeda5b5feb94dea264ea26b839b6f9ef5e32c915f /Swiften/Network/HTTPConnectProxiedConnection.h
parent5a1bdf2f6a4842176be5938f8db5cb9d151aceb5 (diff)
downloadswift-contrib-f171bc207c2a7371ac6924ff467049dd0258aa00.zip
swift-contrib-f171bc207c2a7371ac6924ff467049dd0258aa00.tar.bz2
Allow different connection methods for Client.
Diffstat (limited to 'Swiften/Network/HTTPConnectProxiedConnection.h')
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.h47
1 files changed, 9 insertions, 38 deletions
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.h b/Swiften/Network/HTTPConnectProxiedConnection.h
index 8318ecc..e6c8629 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.h
+++ b/Swiften/Network/HTTPConnectProxiedConnection.h
@@ -13,59 +13,30 @@
#pragma once
-#include <boost/enable_shared_from_this.hpp>
-
-#include <Swiften/Network/Connection.h>
-#include <Swiften/Network/Connector.h>
-#include <Swiften/Network/HostAddressPort.h>
-#include <Swiften/Base/SafeString.h>
-
-namespace boost {
- class thread;
- namespace system {
- class error_code;
- }
-}
+#include <Swiften/Network/ProxiedConnection.h>
namespace Swift {
+ class DomainNameResolver;
class ConnectionFactory;
class EventLoop;
+ class TimerFactory;
- class HTTPConnectProxiedConnection : public Connection, public boost::enable_shared_from_this<HTTPConnectProxiedConnection> {
+ class HTTPConnectProxiedConnection : public ProxiedConnection {
public:
typedef boost::shared_ptr<HTTPConnectProxiedConnection> ref;
- ~HTTPConnectProxiedConnection();
-
- static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword) {
- return ref(new HTTPConnectProxiedConnection(resolver, connectionFactory, timerFactory, eventLoop, proxyHost, proxyPort, authID, authPassword));
+ static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword) {
+ return ref(new HTTPConnectProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, authID, authPassword));
}
- virtual void listen();
- virtual void connect(const HostAddressPort& address);
- virtual void disconnect();
- virtual void write(const SafeByteArray& data);
-
- virtual HostAddressPort getLocalAddress() const;
private:
- HTTPConnectProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword);
+ HTTPConnectProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword);
- void handleConnectFinished(Connection::ref connection);
- void handleDataRead(boost::shared_ptr<SafeByteArray> data);
- void handleDisconnected(const boost::optional<Error>& error);
- void cancelConnector();
+ virtual void initializeProxy();
+ virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data);
private:
- bool connected_;
- DomainNameResolver* resolver_;
- ConnectionFactory* connectionFactory_;
- TimerFactory* timerFactory_;
- std::string proxyHost_;
- int proxyPort_;
- HostAddressPort server_;
SafeByteArray authID_;
SafeByteArray authPassword_;
- Connector::ref connector_;
- boost::shared_ptr<Connection> connection_;
};
}