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

#include <inbandbytestream.h>

Inheritance diagram for InBandBytestream:
Inheritance graph

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
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.

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).
Jakob Schröter

Definition at line 43 of file inbandbytestream.h.

Constructor & Destructor Documentation

◆ ~InBandBytestream()

~InBandBytestream ( )

Virtual destructor.

Definition at line 114 of file inbandbytestream.cpp.

Member Function Documentation

◆ blockSize()

int blockSize ( ) const

Lets you retrieve this bytestream's block-size. The default is 4096 bytes.

The bytestream's block-size.

Definition at line 58 of file inbandbytestream.h.

◆ close()

void close ( )

Closes the bytestream.

Implements Bytestream.

Definition at line 290 of file inbandbytestream.cpp.

◆ connect()

bool connect ( )

This function starts the connection process.

True if a connection to a remote entity could be established, false otherwise.
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 129 of file inbandbytestream.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 167 of file inbandbytestream.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 144 of file inbandbytestream.cpp.

◆ handleMessage()

void handleMessage ( const Message msg,
MessageSession session = 0 

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

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

Implements MessageHandler.

Definition at line 215 of file inbandbytestream.cpp.

◆ recv()

virtual ConnectionError recv ( int  timeout = -1)

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.

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

Implements Bytestream.

Definition at line 69 of file inbandbytestream.h.

◆ send()

bool send ( const std::string &  data)

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.

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

Implements Bytestream.

Definition at line 256 of file inbandbytestream.cpp.

◆ setBlockSize()

void setBlockSize ( int  blockSize)

Sets the stream's block-size. Default: 4096 bytes. Maximum allowed block-size: 65535 bytes

blockSizeThe new block size.
You should not change the block size once connect() has been called. Though neither the block-size limit nor changing it mid-stream are enforced by this function.

Definition at line 66 of file inbandbytestream.h.

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