InBandBytestream Class Reference

An implementation of a single In-Band Bytestream (XEP-0047). More...

#include <inbandbytestream.h>

Inherits gloox::Bytestream, gloox::IqHandler, and gloox::MessageHandler.

List of all members.

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)

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@camaya.net>
Since:
0.8

Definition at line 43 of file inbandbytestream.h.


Constructor & Destructor Documentation

~InBandBytestream (  )  [virtual]

Virtual destructor.

Definition at line 105 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 272 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 118 of file inbandbytestream.cpp.

bool handleIq ( const IQ iq  )  [virtual]

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

Parameters:
iq The 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 152 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:
iq The complete IQ stanza.
context A 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 133 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:
msg The complete Message.
session If this MessageHandler is used with a MessageSession, this parameter holds a pointer to that MessageSession.
Since:
1.0

Implements MessageHandler.

Definition at line 197 of file inbandbytestream.cpp.

virtual ConnectionError recv ( int  timeout = -1  )  [inline, virtual]

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:
timeout The 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:
data The 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 238 of file inbandbytestream.cpp.

void setBlockSize ( int  blockSize  )  [inline]

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

Parameters:
blockSize The 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:
Generated on Tue Jun 8 23:37:56 2010 for gloox by  doxygen 1.6.3