gloox
1.0
|
#include <inbandbytestream.h>
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) |
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.
Definition at line 43 of file inbandbytestream.h.
~InBandBytestream | ( | ) | [virtual] |
Virtual destructor.
Definition at line 114 of file inbandbytestream.cpp.
int blockSize | ( | ) | const [inline] |
Lets you retrieve this bytestream's block-size.
Definition at line 58 of file inbandbytestream.h.
void close | ( | ) | [virtual] |
bool connect | ( | ) | [virtual] |
This function starts the connection process.
Implements Bytestream.
Definition at line 127 of file inbandbytestream.cpp.
Reimplement this function if you want to be notified about incoming IQs.
iq | The complete IQ stanza. |
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.
iq | The complete IQ stanza. |
context | A value to restore context, stored with ClientBase::trackID(). |
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.
msg | The complete Message. |
session | If this MessageHandler is used with a MessageSession, this parameter holds a pointer to that MessageSession. |
Implements MessageHandler.
Definition at line 206 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.
timeout | The timeout to use for select in microseconds. Default of -1 means blocking. |
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.
data | The block of data to send. |
Implements Bytestream.
Definition at line 247 of file inbandbytestream.cpp.
void setBlockSize | ( | int | blockSize | ) | [inline] |
Sets the stream's block-size. Default: 4096
blockSize | The new block size. |
Definition at line 65 of file inbandbytestream.h.