gloox  1.0.27
Public Types | Public Member Functions | List of all members
SOCKS5BytestreamManager Class Reference

#include <socks5bytestreammanager.h>

Inheritance diagram for SOCKS5BytestreamManager:
Inheritance graph

Public Types

enum  S5BMode { S5BTCP , S5BUDP , S5BInvalid }

Public Member Functions

 SOCKS5BytestreamManager (ClientBase *parent, BytestreamHandler *s5bh)
virtual ~SOCKS5BytestreamManager ()
void setStreamHosts (StreamHostList hosts)
void addStreamHost (const JID &jid, const std::string &host, int port)
bool requestSOCKS5Bytestream (const JID &to, S5BMode mode, const std::string &sid=EmptyString, const JID &from=JID())
bool dispose (SOCKS5Bytestream *s5b)
void acceptSOCKS5Bytestream (const std::string &sid)
void rejectSOCKS5Bytestream (const std::string &sid, StanzaError reason=StanzaErrorNotAcceptable)
void registerBytestreamHandler (BytestreamHandler *s5bh)
void removeBytestreamHandler ()
void registerSOCKS5BytestreamServer (SOCKS5BytestreamServer *server)
void removeSOCKS5BytestreamServer ()
virtual bool handleIq (const IQ &iq)
virtual void handleIqID (const IQ &iq, int context)
- Public Member Functions inherited from IqHandler
virtual ~IqHandler ()

Detailed Description

An SOCKS5BytestreamManager dispatches SOCKS5 Bytestreams.

Jakob Schröter

Definition at line 51 of file socks5bytestreammanager.h.

Member Enumeration Documentation

◆ S5BMode

enum S5BMode

Supported transport layer protocols.


Use TCP on the transport layer.


Use UDP on the transport layer. Not currently supported.


Invalid mode.

Definition at line 61 of file socks5bytestreammanager.h.

Constructor & Destructor Documentation

◆ SOCKS5BytestreamManager()

Constructs a new SOCKS5BytestreamManager.

parentThe ClientBase to use for sending data.
s5bhA SOCKS5BytestreamManager -derived object that will receive incoming and outgoing SOCKS5Bytestreams.

Definition at line 148 of file socks5bytestreammanager.cpp.

◆ ~SOCKS5BytestreamManager()

Virtual destructor.

Definition at line 158 of file socks5bytestreammanager.cpp.

Member Function Documentation

◆ acceptSOCKS5Bytestream()

void acceptSOCKS5Bytestream ( const std::string &  sid)

Use this function to accept an incoming bytestream.

sidThe stream's id as passed to BytestreamHandler::handleIncomingSOCKS5Bytestream().

Definition at line 340 of file socks5bytestreammanager.cpp.

◆ addStreamHost()

void addStreamHost ( const JID jid,
const std::string &  host,
int  port 

Adds one StreamHost to the list of StreamHosts.

jidThe StreamHost's JID.
hostThe StreamHost's hostname.
portThe StreamHost's port.

Definition at line 169 of file socks5bytestreammanager.cpp.

◆ dispose()

bool dispose ( SOCKS5Bytestream s5b)

To get rid of a bytestream (i.e., close and delete it), call this function. You should then not use the bytestream any more. The remote entity will be notified of the closing of the stream.

s5bThe bytestream to dispose. It will be deleted here.

Definition at line 473 of file socks5bytestreammanager.cpp.

◆ handleIq()

bool handleIq ( const IQ iq)

Reimplement this function if you want to be notified about incoming IQs.

iqThe complete IQ stanza.
Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, an 'error' will be sent back.

Implements IqHandler.

Definition at line 269 of file socks5bytestreammanager.cpp.

◆ handleIqID()

void handleIqID ( const IQ iq,
int  context 

Reimplement this function if you want to be notified about incoming IQs with a specific value of the id attribute. You have to enable tracking of those IDs using Client::trackID(). This is usually useful for IDs that generate a empty positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.

iqThe complete IQ stanza.
contextA value to restore context, stored with ClientBase::trackID().
Only IQ stanzas of type 'result' or 'error' can arrive here.

Implements IqHandler.

Definition at line 390 of file socks5bytestreammanager.cpp.

◆ registerBytestreamHandler()

void registerBytestreamHandler ( BytestreamHandler s5bh)

Use this function to register an object that will receive new incoming bytestream requests from the SOCKS5BytestreamManager. Only one BytestreamHandler can be registered at any one time.

s5bhThe BytestreamHandler derived object to receive notifications.

Definition at line 141 of file socks5bytestreammanager.h.

◆ registerSOCKS5BytestreamServer()

void registerSOCKS5BytestreamServer ( SOCKS5BytestreamServer server)

Tells the SOCKS5BytestreamManager which SOCKS5BytestreamServer handles peer-2-peer SOCKS5 bytestreams.

serverThe SOCKS5BytestreamServer to use.

Definition at line 155 of file socks5bytestreammanager.h.

◆ rejectSOCKS5Bytestream()

void rejectSOCKS5Bytestream ( const std::string &  sid,
StanzaError  reason = StanzaErrorNotAcceptable 

Use this function to reject an incoming bytestream.

sidThe stream's id as passed to BytestreamHandler::handleIncomingSOCKS5Bytestream().
reasonThe reason for the reject.

Definition at line 354 of file socks5bytestreammanager.cpp.

◆ removeBytestreamHandler()

void removeBytestreamHandler ( )

Removes the registered BytestreamHandler.

Definition at line 147 of file socks5bytestreammanager.h.

◆ removeSOCKS5BytestreamServer()

void removeSOCKS5BytestreamServer ( )

Un-registers any local SOCKS5BytestreamServer.

Definition at line 160 of file socks5bytestreammanager.h.

◆ requestSOCKS5Bytestream()

bool requestSOCKS5Bytestream ( const JID to,
S5BMode  mode,
const std::string &  sid = EmptyString,
const JID from = JID() 

This function requests a bytestream with the remote entity. Data can only be sent over an open stream. Use isOpen() to find out what the stream's current state is. However, successful opening/initiation will be announced by means of the BytestreamHandler interface. Multiple bytestreams (even per JID) can be initiated without waiting for success.

toThe recipient of the requested bytestream.
modeThe desired transport layer protocol.
sidThe bytestream's stream ID, if previously negotiated e.g. using SI (XEP-0095).
fromAn optional 'from' address to stamp outgoing requests with. Only useful in component scenarios. Defaults to empty JID.
False in case of an error, true otherwise. A return value of true does not indicate that the bytestream has been opened. This is announced by means of the BytestreamHandler.

Definition at line 178 of file socks5bytestreammanager.cpp.

◆ setStreamHosts()

void setStreamHosts ( StreamHostList  hosts)

Sets a list of StreamHosts that will be used for subsequent bytestream requests.

At least one StreamHost is required.
hostsA list of StreamHosts.

Definition at line 86 of file socks5bytestreammanager.h.

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