gloox  1.0.28
Public Member Functions | List of all members
SOCKS5Bytestream Class Reference

#include <socks5bytestream.h>

Inheritance diagram for SOCKS5Bytestream:
Inheritance graph
[legend]

Public Member Functions

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)
 
ConnectionBaseconnectionImpl ()
 
void setStreamHosts (const StreamHostList &hosts)
 
virtual void handleReceivedData (const ConnectionBase *connection, const std::string &data)
 
virtual void handleConnect (const ConnectionBase *connection)
 
virtual void handleDisconnect (const ConnectionBase *connection, ConnectionError reason)
 
- Public Member Functions inherited from ConnectionDataHandler
virtual ~ConnectionDataHandler ()
 
- Public Member Functions inherited from Bytestream
 Bytestream (StreamType type, LogSink &logInstance, const JID &initiator, const JID &target, const std::string &sid)
 
virtual ~Bytestream ()
 
bool isOpen () const
 
const std::string & sid () const
 
StreamType type () const
 
const JIDtarget () const
 
const JIDinitiator () const
 
void registerBytestreamDataHandler (BytestreamDataHandler *bdh)
 
void removeBytestreamDataHandler ()
 

Additional Inherited Members

- Public Types inherited from Bytestream
enum  StreamType { S5B , IBB }
 
- Protected Attributes inherited from Bytestream
BytestreamDataHandlerm_handler
 
const LogSinkm_logInstance
 
const JID m_initiator
 
const JID m_target
 
StreamType m_type
 
std::string m_sid
 
bool m_open
 

Detailed Description

An implementation of a single SOCKS5 Bytestream (XEP-0065).

One instance of this class handles one bytestream.

See SOCKS5BytestreamManager for a detailed description on how to implement SOCKS5 Bytestreams in your application.

Author
Jakob Schröter js@ca.nosp@m.maya.nosp@m..net
Since
0.9

Definition at line 42 of file socks5bytestream.h.

Constructor & Destructor Documentation

◆ ~SOCKS5Bytestream()

~SOCKS5Bytestream ( )
virtual

Virtual destructor.

Definition at line 37 of file socks5bytestream.cpp.

Member Function Documentation

◆ close()

void close ( )
virtual

Closes the bytestream.

Implements Bytestream.

Definition at line 110 of file socks5bytestream.cpp.

◆ connect()

bool connect ( )
virtual

This function starts the connection process. That is, it attempts to connect to each of the available StreamHosts. Once a working StreamHosts is found, the SOCKS5BytestreamManager is notified and the function returns.

Returns
True if a connection to a StreamHost could be established, false otherwise.
Note
If false is returned you should hand this SOCKS5Bytestream object to SOCKS5BytestreamManager::dispose() for deletion.
Make sure you have a SOCKS5BytestreamDataHandler registered (using registerSOCKS5BytestreamDataHandler()) before calling this function.

Implements Bytestream.

Definition at line 60 of file socks5bytestream.cpp.

◆ connectionImpl()

ConnectionBase* connectionImpl ( )
inline

This function returns the concrete connection implementation currently in use.

Returns
The concrete connection implementation.
Since
0.9.7

Definition at line 101 of file socks5bytestream.h.

◆ handleConnect()

void handleConnect ( const ConnectionBase connection)
virtual

This function is called when e.g. the raw TCP connection was established.

Parameters
connectionThe connection.

Implements ConnectionDataHandler.

Definition at line 144 of file socks5bytestream.cpp.

◆ handleDisconnect()

void handleDisconnect ( const ConnectionBase connection,
ConnectionError  reason 
)
virtual

This connection is called when e.g. the raw TCP connection was closed.

Parameters
connectionThe connection.
reasonThe reason for the disconnect.

Implements ConnectionDataHandler.

Definition at line 155 of file socks5bytestream.cpp.

◆ handleReceivedData()

void handleReceivedData ( const ConnectionBase connection,
const std::string &  data 
)
virtual

This function is called for received from the underlying transport.

Parameters
connectionThe connection that received the data.
dataThe data received.

Implements ConnectionDataHandler.

Definition at line 121 of file socks5bytestream.cpp.

◆ recv()

ConnectionError recv ( int  timeout = -1)
virtual

Call this function repeatedly to receive data from the socket. You should even do this if you use the bytestream to merely send data.

Parameters
timeoutThe timeout to use for select in microseconds. Default of -1 means blocking.
Returns
The state of the connection.

Implements Bytestream.

Definition at line 95 of file socks5bytestream.cpp.

◆ send()

bool send ( const std::string &  data)
virtual

Use this function to send a chunk of data over an open bytestream. There is no limit for the size of the chunk (other than your machine's memory). If the stream is not open or has been closed again (by the remote entity or locally), nothing is sent and false is returned.

Parameters
dataThe block of data to send.
Returns
True if the data has been sent (no guarantee of receipt), false in case of an error.

Implements Bytestream.

Definition at line 87 of file socks5bytestream.cpp.

◆ setConnectionImpl()

void setConnectionImpl ( ConnectionBase connection)

Sets the connection to use.

Parameters
connectionThe connection. The bytestream will own the connection, any previously set connection gets deleted.

Definition at line 46 of file socks5bytestream.cpp.

◆ setStreamHosts()

void setStreamHosts ( const StreamHostList hosts)
inline

Use this function to set the available StreamHosts. Usually you should not need to use this function directly.

Definition at line 107 of file socks5bytestream.h.


The documentation for this class was generated from the following files: