# XMPP::Stream Class Reference

This class represents a XMPP stream, i.e. More...

`#include <xmpp.h>`

Inheritance diagram for XMPP::Stream:

List of all members.

## Public Member Functions

| Stream (Transport *transport=0)
| ~Stream ()
virtual PBoolean | OnOpen ()
| This callback is executed when the Open() function is called with open channels.
PNotifierList & | OpenHandlers ()
virtual PBoolean | Close ()
| Close the channel.
virtual void | OnClose ()
PNotifierList & | CloseHandlers ()
virtual PBoolean | Write (const void *buf, PINDEX len)
| Low level write to the channel.
virtual PBoolean | Write (const PString &data)
virtual PBoolean | Write (const PXML &pdu)
virtual PXML * | Read ()
| Read a XMPP stanza from the stream.
virtual void | Reset ()
| Reset the parser.
PXMLStreamParser * | GetParser ()

## Protected Attributes

PXMLStreamParser * | m_Parser
PNotifierList | m_OpenHandlers
PNotifierList | m_CloseHandlers

## Detailed Description

This class represents a XMPP stream, i.e.

a XML message exchange between XMPP entities

## Constructor & Destructor Documentation

XMPP::Stream::Stream | ( | Transport * | transport = `0` | ) |

XMPP::Stream::~Stream | ( |  | ) |

## Member Function Documentation

virtual PBoolean XMPP::Stream::Close | ( |  | ) | `[virtual]`

Close the channel.

This will detach itself from the read and write channels and delete both of them if they are auto delete.

Returns:
  true if the channel is closed.

Reimplemented from PIndirectChannel.

PNotifierList& XMPP::Stream::CloseHandlers | ( |  | ) | `[inline]`

PXMLStreamParser* XMPP::Stream::GetParser | ( |  | ) | `[inline]`

virtual void XMPP::Stream::OnClose | ( |  | ) | `[inline, virtual]`

virtual PBoolean XMPP::Stream::OnOpen | ( |  | ) | `[inline, virtual]`

This callback is executed when the Open() function is called with open channels.

It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.

The default behaviour is to simply return true.

Returns:
  Returns true if the protocol handshaking is successful.

Reimplemented from PIndirectChannel.

PNotifierList& XMPP::Stream::OpenHandlers | ( |  | ) | `[inline]`

virtual PXML* XMPP::Stream::Read | ( |  | ) | `[virtual]`

Read a XMPP stanza from the stream.

virtual void XMPP::Stream::Reset | ( |  | ) | `[virtual]`

Reset the parser.

The will delete and re-instantiate the XML stream parser.

virtual PBoolean XMPP::Stream::Write | ( | const PXML & | pdu | ) | `[virtual]`

virtual PBoolean XMPP::Stream::Write | ( | const PString & | data | ) | `[virtual]`

virtual PBoolean XMPP::Stream::Write | ( | const void * | buf,
|  | PINDEX | len |
| ) |  |  | `[virtual]`

Low level write to the channel.

This function will block until the requested number of characters are written or the write timeout is reached. The GetLastWriteCount() function returns the actual number of bytes written.

This will use the `writeChannel` pointer to actually do the write. If `writeChannel` is null the this asserts.

The GetErrorCode() function should be consulted after Write() returns false to determine what caused the failure.

Returns:
  true if at least len bytes were written to the channel.

Reimplemented from PIndirectChannel.

## Member Data Documentation

PNotifierList XMPP::Stream::m_CloseHandlers `[protected]`

PNotifierList XMPP::Stream::m_OpenHandlers `[protected]`

PXMLStreamParser* XMPP::Stream::m_Parser `[protected]`

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

- xmpp.h