gloox
1.0.16
|
#include <bytestream.h>
Public Types | |
enum | StreamType { S5B, IBB } |
Public Member Functions | |
Bytestream (StreamType type, LogSink &logInstance, const JID &initiator, const JID &target, const std::string &sid) | |
virtual | ~Bytestream () |
bool | isOpen () const |
virtual bool | connect ()=0 |
virtual void | close ()=0 |
virtual bool | send (const std::string &data)=0 |
virtual ConnectionError | recv (int timeout=-1)=0 |
const std::string & | sid () const |
StreamType | type () const |
const JID & | target () const |
const JID & | initiator () const |
void | registerBytestreamDataHandler (BytestreamDataHandler *bdh) |
void | removeBytestreamDataHandler () |
Protected Attributes | |
BytestreamDataHandler * | m_handler |
const LogSink & | m_logInstance |
const JID | m_initiator |
const JID | m_target |
StreamType | m_type |
std::string | m_sid |
bool | m_open |
An abstraction of a single bytestream.
Used as a base class for InBand Bytestreams as well as SOCKS5 Bytestreams. You should not need to use this class directly.
Definition at line 36 of file bytestream.h.
enum StreamType |
Available stream types.
Enumerator | |
---|---|
S5B |
SOCKS5 Bytestream |
IBB |
In-Band Bytestream |
Definition at line 42 of file bytestream.h.
|
inline |
Creates a new Bytestream.
type | The stream type. |
logInstance | A Logsink to use for logging. Obtain it from ClientBase::logInstance(). |
initiator | The initiator of the stream (usually the sender). |
target | The target of the stream (usually the receiver). |
sid | The stream's ID. |
Definition at line 56 of file bytestream.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 65 of file bytestream.h.
|
pure virtual |
Closes the bytestream.
Implemented in InBandBytestream, and SOCKS5Bytestream.
|
pure virtual |
This function starts the connection process.
Implemented in InBandBytestream, and SOCKS5Bytestream.
|
inline |
|
inline |
Returns whether the bytestream is open, that is, accepted by both parties and ready to send/receive data.
Definition at line 72 of file bytestream.h.
|
pure 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. |
Implemented in SOCKS5Bytestream, and InBandBytestream.
|
inline |
Use this function to register an object that will receive any notifications from the Bytestream instance. Only one BytestreamDataHandler can be registered at any one time.
bdh | The BytestreamDataHandler-derived object to receive notifications. |
Definition at line 142 of file bytestream.h.
|
inline |
Removes the registered BytestreamDataHandler.
Definition at line 148 of file bytestream.h.
|
pure 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. |
Implemented in SOCKS5Bytestream, and InBandBytestream.
|
inline |
Lets you retrieve the stream's ID.
Definition at line 114 of file bytestream.h.
|
inline |
|
inline |
|
protected |
A handler for incoming data and open/close events.
Definition at line 153 of file bytestream.h.
|
protected |
The initiator's JID.
Definition at line 159 of file bytestream.h.
|
protected |
A LogSink instance to use for logging.
Definition at line 156 of file bytestream.h.
|
protected |
Indicates whether or not the stream is open.
Definition at line 171 of file bytestream.h.
|
protected |
The stream ID.
Definition at line 168 of file bytestream.h.
|
protected |
The target's JID.
Definition at line 162 of file bytestream.h.
|
protected |
The stream type.
Definition at line 165 of file bytestream.h.