gloox  1.0
Public Member Functions | List of all members
InBandBytestream Class Reference

#include <inbandbytestream.h>

Inheritance diagram for InBandBytestream:
Inheritance graph
[legend]

Public Member Functions

virtual ~InBandBytestream ()
int blockSize () const
void setBlockSize (int blockSize)
virtual ConnectionError recv (int timeout=-1)
bool send (const std::string &data)
virtual bool connect ()
virtual void close ()
virtual bool handleIq (const IQ &iq)
virtual void handleIqID (const IQ &iq, int context)
virtual void handleMessage (const Message &msg, MessageSession *session=0)
- 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 ()
- Public Member Functions inherited from IqHandler
virtual ~IqHandler ()
- Public Member Functions inherited from MessageHandler
virtual ~MessageHandler ()

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 In-Band Bytestream (XEP-0047).

One instance of this class handles a single byte stream.

See SIProfileFT for a detailed description on how to implement file transfer.

Note
This class can receive data wrapped in Message stanzas. This will only work if you are not using MessageSessions. However, it will always send data using IQ stanzas (which will always work).
Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.8

Definition at line 43 of file inbandbytestream.h.

Constructor & Destructor Documentation

~InBandBytestream ( )
virtual

Virtual destructor.

Definition at line 114 of file inbandbytestream.cpp.

Member Function Documentation

int blockSize ( ) const
inline

Lets you retrieve this bytestream's block-size.

Returns
The bytestream's block-size.

Definition at line 58 of file inbandbytestream.h.

void close ( )
virtual

Closes the bytestream.

Implements Bytestream.

Definition at line 281 of file inbandbytestream.cpp.

bool connect ( )
virtual

This function starts the connection process.

Returns
True if a connection to a remote entity could be established, false otherwise.
Note
If false is returned you should pass this Bytestream object to SIProfileFT::dispose() for deletion.
Make sure you have a BytestreamDataHandler registered (using registerBytestreamDataHandler()) before calling this function.

Implements Bytestream.

Definition at line 127 of file inbandbytestream.cpp.

bool handleIq ( const IQ iq)
virtual

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

Parameters
iqThe complete IQ 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.
Since
1.0

Implements IqHandler.

Definition at line 161 of file inbandbytestream.cpp.

void handleIqID ( const IQ iq,
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
iqThe complete IQ stanza.
contextA value to restore context, stored with ClientBase::trackID().
Note
Only IQ stanzas of type 'result' or 'error' can arrive here.
Since
1.0

Implements IqHandler.

Definition at line 142 of file inbandbytestream.cpp.

void handleMessage ( const Message msg,
MessageSession session = 0 
)
virtual

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

Parameters
msgThe complete Message.
sessionIf this MessageHandler is used with a MessageSession, this parameter holds a pointer to that MessageSession.
Since
1.0

Implements MessageHandler.

Definition at line 206 of file inbandbytestream.cpp.

virtual ConnectionError recv ( int  timeout = -1)
inlinevirtual

Call this function repeatedly to receive data. You should even do this if you use the bytestream to merely send data. May be a NOOP, depending on the actual stream type.

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 68 of file inbandbytestream.h.

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

Use this function to send a chunk of data over an open bytestream. If the stream is not open or has been closed again (by the remote entity or locally), nothing is sent and false is returned. This function does any base64 encoding for you, if necessary.

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 247 of file inbandbytestream.cpp.

void setBlockSize ( int  blockSize)
inline

Sets the stream's block-size. Default: 4096

Parameters
blockSizeThe new block size.
Note
You should not change the block size once connect() has been called.

Definition at line 65 of file inbandbytestream.h.


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