14 #include "socks5bytestream.h"
15 #include "socks5bytestreamdatahandler.h"
16 #include "clientbase.h"
17 #include "connectionbase.h"
18 #include "connectionsocks5proxy.h"
25 SOCKS5Bytestream::SOCKS5Bytestream( SOCKS5BytestreamManager* manager, ConnectionBase* connection,
26 LogSink& logInstance,
const JID& initiator,
const JID& target,
27 const std::string& sid )
28 : m_manager( manager ), m_connection( 0 ), m_socks5( 0 ), m_logInstance( logInstance ),
29 m_socks5BytestreamDataHandler( 0 ), m_initiator( initiator ), m_target( target ),
30 m_sid( sid ), m_open( false )
35 setConnectionImpl( connection );
52 m_connection = connection;
63 if( !m_connection || !m_socks5 || !m_manager )
69 StreamHostList::const_iterator it = m_hosts.begin();
70 for( ; it != m_hosts.end(); ++it )
72 m_connection->
setServer( (*it).host, (*it).port );
80 m_manager->acknowledgeStreamHost(
false,
JID(), std::string() );
86 if( !m_open || !m_connection || !m_socks5 || !m_manager )
89 return m_socks5->
send( data );
94 if( !m_connection || !m_socks5 || !m_manager )
97 return m_socks5->
recv( timeout );
100 void SOCKS5Bytestream::activate()
103 if( m_socks5BytestreamDataHandler )
119 if( !m_socks5BytestreamDataHandler )
142 m_manager->acknowledgeStreamHost(
true, m_proxy, m_sid );
147 if( m_socks5BytestreamDataHandler )