00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef SOCKS5BYTESTREAM_H__
00015 #define SOCKS5BYTESTREAM_H__
00016
00017 #include "bytestream.h"
00018 #include "gloox.h"
00019 #include "socks5bytestreammanager.h"
00020 #include "connectiondatahandler.h"
00021
00022 #include <string>
00023
00024 namespace gloox
00025 {
00026
00027 class SOCKS5BytestreamDataHandler;
00028 class ConnectionBase;
00029 class LogSink;
00030
00042 class GLOOX_API SOCKS5Bytestream : public ConnectionDataHandler, public Bytestream
00043 {
00044 friend class SOCKS5BytestreamManager;
00045
00046 public:
00050 virtual ~SOCKS5Bytestream();
00051
00063 virtual bool connect();
00064
00068 virtual void close();
00069
00079 virtual bool send( const std::string& data );
00080
00087 virtual ConnectionError recv( int timeout = -1 );
00088
00094 void setConnectionImpl( ConnectionBase* connection );
00095
00101 ConnectionBase* connectionImpl( ) { return m_connection; }
00102
00107 void setStreamHosts( const StreamHostList& hosts ) { m_hosts = hosts; }
00108
00109
00110 virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data );
00111
00112
00113 virtual void handleConnect( const ConnectionBase* connection );
00114
00115
00116 virtual void handleDisconnect( const ConnectionBase* connection, ConnectionError reason );
00117
00118 private:
00119 SOCKS5Bytestream( SOCKS5BytestreamManager* manager, ConnectionBase* connection,
00120 LogSink& logInstance, const JID& initiator, const JID& target,
00121 const std::string& sid );
00122 void activate();
00123
00124 SOCKS5BytestreamManager* m_manager;
00125 ConnectionBase* m_connection;
00126 ConnectionBase* m_socks5;
00127 JID m_proxy;
00128 bool m_connected;
00129
00130 StreamHostList m_hosts;
00131
00132 };
00133
00134 }
00135
00136 #endif // SOCKS5BYTESTREAM_H__