SOCKS5BytestreamManager Class Reference

An SOCKS5BytestreamManager dispatches SOCKS5 Bytestreams. More...

#include <socks5bytestreammanager.h>

Inheritance diagram for SOCKS5BytestreamManager:

Inheritance graph
[legend]
Collaboration diagram for SOCKS5BytestreamManager:

Collaboration graph
[legend]

List of all members.

Public Types

enum  S5BMode { S5BTCP }

Public Member Functions

 SOCKS5BytestreamManager (ClientBase *parent, SOCKS5BytestreamHandler *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="")
bool dispose (SOCKS5Bytestream *s5b)
void acceptSOCKS5Bytestream (const std::string &sid)
void rejectSOCKS5Bytestream (const std::string &sid)
void registerSOCKS5BytestreamHandler (SOCKS5BytestreamHandler *s5bh)
void removeSOCKS5BytestreamHandler ()
void registerSOCKS5BytestreamServer (SOCKS5BytestreamServer *server)
void removeSOCKS5BytestreamServer ()
virtual bool handleIq (Stanza *stanza)
virtual bool handleIqID (Stanza *stanza, int context)


Detailed Description

An SOCKS5BytestreamManager dispatches SOCKS5 Bytestreams.

Author:
Jakob Schroeter <js@camaya.net>
Since:
0.9

Definition at line 50 of file socks5bytestreammanager.h.


Member Enumeration Documentation

enum S5BMode

Supported transport layer protocols.

Enumerator:
S5BTCP  Use TCP on the transport layer. Use UDP on the transport layer.

Definition at line 60 of file socks5bytestreammanager.h.


Constructor & Destructor Documentation

Constructs a new SOCKS5BytestreamManager.

Parameters:
parent The ClientBase to use for sending data.
s5bh A SOCKS5BytestreamManager -derived object that will receive incoming and outgoing SOCKS5Bytestreams.

Definition at line 28 of file socks5bytestreammanager.cpp.

~SOCKS5BytestreamManager (  )  [virtual]

Virtual destructor.

Definition at line 35 of file socks5bytestreammanager.cpp.


Member Function Documentation

void setStreamHosts ( StreamHostList  hosts  )  [inline]

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

Note:
At least one StreamHost is required.
Parameters:
hosts A list of StreamHosts.

Definition at line 84 of file socks5bytestreammanager.h.

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

Adds one StreamHost to the list of StreamHosts.

Parameters:
jid The StreamHost's JID.
host The StreamHost's hostname.
port The StreamHost's port.

Definition at line 51 of file socks5bytestreammanager.cpp.

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

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 SOCKS5BytestreamHandler interface. Multiple bytestreams (even per JID) can be initiated without waiting for success.

Parameters:
to The recipient of the requested bytestream.
mode The desired transport layer protocol.
sid The bytestreakm's stream ID, if previously negotiated e.g. using SI (XEP-0095).
Returns:
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 SOCKS5BytestreamHandler.

Definition at line 60 of file socks5bytestreammanager.cpp.

bool dispose ( SOCKS5Bytestream s5b  ) 

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

Parameters:
s5b The bytestream to dispose. It will be deleted here.

Definition at line 412 of file socks5bytestreammanager.cpp.

void acceptSOCKS5Bytestream ( const std::string &  sid  ) 

Use this function to accept an incoming bytestream.

Parameters:
sid The stream's id as passed to SOCKS5BytestreamHandler::handleIncomingSOCKS5Bytestream().

Definition at line 248 of file socks5bytestreammanager.cpp.

void rejectSOCKS5Bytestream ( const std::string &  sid  ) 

Use this function to reject an incoming bytestream.

Parameters:
sid The stream's id as passed to SOCKS5BytestreamHandler::handleIncomingSOCKS5Bytestream().

Definition at line 262 of file socks5bytestreammanager.cpp.

void registerSOCKS5BytestreamHandler ( SOCKS5BytestreamHandler s5bh  )  [inline]

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

Parameters:
s5bh The SOCKS5BytestreamHandler derived object to receive notifications.

Definition at line 135 of file socks5bytestreammanager.h.

void removeSOCKS5BytestreamHandler (  )  [inline]

Removes the registered SOCKS5BytestreamHandler.

Definition at line 141 of file socks5bytestreammanager.h.

void registerSOCKS5BytestreamServer ( SOCKS5BytestreamServer server  )  [inline]

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

Parameters:
server The SOCKS5BytestreamServer to use.

Definition at line 149 of file socks5bytestreammanager.h.

void removeSOCKS5BytestreamServer (  )  [inline]

Un-registers any local SOCKS5BytestreamServer.

Definition at line 154 of file socks5bytestreammanager.h.

bool handleIq ( Stanza stanza  )  [virtual]

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

Parameters:
stanza The complete Stanza.
Returns:
Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, a 'error' will be sent.

Implements IqHandler.

Definition at line 163 of file socks5bytestreammanager.cpp.

bool handleIqID ( Stanza stanza,
int  context 
) [virtual]

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 positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.

Parameters:
stanza The complete Stanza.
context A value to restore context, stored with ClientBase::trackID().
Returns:
Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, a 'error' will be sent.

Implements IqHandler.

Definition at line 321 of file socks5bytestreammanager.cpp.


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

Generated on Fri Oct 10 15:26:24 2008 for gloox by  doxygen 1.5.6