14 #include "socks5bytestream.h"
15 #include "bytestreamdatahandler.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 : Bytestream( Bytestream::S5B, logInstance, initiator, target, sid ),
29 m_manager( manager ), m_connection( 0 ), m_socks5( 0 ), m_connected( false )
34 setConnectionImpl( connection );
51 m_connection = connection;
62 if( !m_connection || !m_socks5 || !m_manager )
68 StreamHostList::const_iterator it = m_hosts.begin();
69 for( ; it != m_hosts.end(); ++it )
71 if( ++it == m_hosts.end() )
74 m_connection->
setServer( (*it).host, (*it).port );
89 if( !
m_open || !m_connection || !m_socks5 || !m_manager )
92 return m_socks5->
send( data );
97 if( !m_connection || !m_socks5 || !m_manager )
100 return m_socks5->
recv( timeout );
103 void SOCKS5Bytestream::activate()
146 m_manager->acknowledgeStreamHost(
true, m_proxy,
m_sid );
An abstract base class for a connection.
virtual ConnectionError recv(int timeout=-1)
BytestreamDataHandler * m_handler
virtual bool send(const std::string &data)
const LogSink & m_logInstance
This is an implementation of a simple SOCKS5 Proxying connection (RFC 1928 + RFC 1929).
void setServer(const std::string &server, int port=-1)
virtual void handleBytestreamData(Bytestream *bs, const std::string &data)=0
virtual void disconnect()=0
virtual ConnectionError connect()=0
virtual void handleReceivedData(const ConnectionBase *connection, const std::string &data)
The namespace for the gloox library.
virtual bool send(const std::string &data)=0
virtual void handleDisconnect(const ConnectionBase *connection, ConnectionError reason)
virtual ~SOCKS5Bytestream()
void feed(const unsigned char *data, unsigned length)
An implementation of SHA1.
virtual ConnectionError recv(int timeout=-1)=0
virtual void handleBytestreamClose(Bytestream *bs)=0
const std::string & full() const
virtual void handleBytestreamOpen(Bytestream *bs)=0
virtual void handleConnect(const ConnectionBase *connection)
const std::string EmptyString
void setConnectionImpl(ConnectionBase *connection)