socks5bytestream.h
/*
Copyright (c) 2006-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef SOCKS5BYTESTREAM_H__
#define SOCKS5BYTESTREAM_H__
#include "bytestream.h"
#include "gloox.h"
#include "socks5bytestreammanager.h"
#include "connectiondatahandler.h"
#include <string>
namespace gloox
{
class SOCKS5BytestreamDataHandler;
class ConnectionBase;
class LogSink;
class GLOOX_API SOCKS5Bytestream : public ConnectionDataHandler, public Bytestream
{
friend class SOCKS5BytestreamManager;
public:
virtual ~SOCKS5Bytestream();
virtual bool connect();
virtual void close();
virtual bool send( const std::string& data );
virtual ConnectionError recv( int timeout = -1 );
void setConnectionImpl( ConnectionBase* connection );
ConnectionBase* connectionImpl( ) { return m_connection; }
void setStreamHosts( const StreamHostList& hosts ) { m_hosts = hosts; }
// reimplemented from ConnectionDataHandler
virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data );
// reimplemented from ConnectionDataHandler
virtual void handleConnect( const ConnectionBase* connection );
// reimplemented from ConnectionDataHandler
virtual void handleDisconnect( const ConnectionBase* connection, ConnectionError reason );
private:
SOCKS5Bytestream( SOCKS5BytestreamManager* manager, ConnectionBase* connection,
LogSink& logInstance, const JID& initiator, const JID& target,
const std::string& sid );
void activate();
SOCKS5BytestreamManager* m_manager;
ConnectionBase* m_connection;
ConnectionBase* m_socks5;
JID m_proxy;
bool m_connected;
StreamHostList m_hosts;
};
}
#endif // SOCKS5BYTESTREAM_H__
gloox::Bytestream::Bytestream
Bytestream(StreamType type, LogSink &logInstance, const JID &initiator, const JID &target, const std::string &sid)
Definition bytestream.h:56
gloox::ConnectionBase
An abstract base class for a connection.
Definition connectionbase.h:35
gloox::ConnectionDataHandler
This is an abstract base class to receive events from a ConnectionBase-derived object.
Definition connectiondatahandler.h:36
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::LogSink
An implementation of log sink and source.
Definition logsink.h:39
gloox::SOCKS5BytestreamManager
An SOCKS5BytestreamManager dispatches SOCKS5 Bytestreams.
Definition socks5bytestreammanager.h:52
gloox::SOCKS5Bytestream
An implementation of a single SOCKS5 Bytestream (XEP-0065).
Definition socks5bytestream.h:43
gloox::SOCKS5Bytestream::connectionImpl
ConnectionBase * connectionImpl()
Definition socks5bytestream.h:101
gloox::SOCKS5Bytestream::recv
virtual ConnectionError recv(int timeout=-1)
Definition socks5bytestream.cpp:95
gloox::SOCKS5Bytestream::close
virtual void close()
Definition socks5bytestream.cpp:110
gloox::SOCKS5Bytestream::connect
virtual bool connect()
Definition socks5bytestream.cpp:60
gloox::SOCKS5Bytestream::setConnectionImpl
void setConnectionImpl(ConnectionBase *connection)
Definition socks5bytestream.cpp:46
gloox::SOCKS5Bytestream::send
virtual bool send(const std::string &data)
Definition socks5bytestream.cpp:87
gloox::SOCKS5Bytestream::setStreamHosts
void setStreamHosts(const StreamHostList &hosts)
Definition socks5bytestream.h:107
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::ConnectionError
ConnectionError
Definition gloox.h:684
gloox::StreamHostList
std::list< StreamHost > StreamHostList
Definition socks5bytestreammanager.h:43