PTLib  Version 2.10.4
XMPP::C2S::StreamHandler Class Reference

This class handles the client side of a C2S (Client to Server) XMPP stream. More...

#include <xmpp_c2s.h>

Inheritance diagram for XMPP::C2S::StreamHandler:
XMPP::BaseStreamHandler PThread PObject

List of all members.

Public Member Functions

 StreamHandler (const JID &jid, const PString &pwd, PBoolean newAccount=false)
 ~StreamHandler ()
virtual PBoolean IsEstablished () const
virtual PBoolean Start (Transport *transport=0)
PBoolean Send (Stanza *stanza)
 Request the delivery of the specified stanza NOTE: the StreamHandler takes ownership of the stanza and will take care of deleting it.
void SetVersion (WORD major, WORD minor)
void GetVersion (WORD &major, WORD &minor) const
const JIDGetJID () const
PNotifierListSessionEstablishedHandlers ()
 These notifier lists after when a client session is established (i.e.
PNotifierListSessionReleasedHandlers ()
PNotifierListErrorHandlers ()
 These notifier lists are fired when a XMPP stanza or a stream error is received.
PNotifierListMessageHandlers ()
PNotifierListPresenceHandlers ()
PNotifierListIQHandlers ()
PNotifierListIQNamespaceHandlers (const PString &xml_namespace)
 A notifier list for a specific namespace.
PNotifierListMessageSenderHandlers (const JID &from)
 A notifier list for a particular message originator.
virtual PBoolean DiscoverItems (const PString &jid, PNotifier *responseHandler, const PString &node=PString::Empty())
 JEP-0030 Service Discovery access methods.
virtual PBoolean DiscoverInfo (const PString &jid, PNotifier *responseHandler, const PString &node=PString::Empty())

Protected Types

enum  StreamState {
  Null, RegStarted, TLSStarted, SASLStarted,
  NonSASLStarted, StreamSent, BindSent, SessionSent,
  Established
}

Protected Member Functions

virtual void OnOpen (Stream &stream, INT)
virtual void OnClose (Stream &stream, INT)
virtual void StartRegistration ()
virtual void StartAuthNegotiation ()
virtual void OnSessionEstablished ()
virtual void OnSessionReleased ()
virtual void OnElement (PXML &pdu)
virtual void OnError (PXML &pdu)
virtual void OnMessage (XMPP::Message &pdu)
virtual void OnPresence (XMPP::Presence &pdu)
virtual void OnIQ (XMPP::IQ &pdu)
virtual void HandleNullState (PXML &pdu)
virtual void HandleRegStartedState (PXML &pdu)
virtual void HandleTLSStartedState (PXML &pdu)
virtual void HandleNonSASLStartedState (PXML &pdu)
virtual void HandleStreamSentState (PXML &pdu)
virtual void HandleBindSentState (PXML &pdu)
virtual void HandleSessionSentState (PXML &pdu)
virtual void HandleEstablishedState (PXML &pdu)
virtual PBoolean Discover (const PString &xmlns, const PString &jid, PNotifier *responseHandler, const PString &node)
virtual void SetState (StreamState s)

Protected Attributes

WORD m_VersionMajor
WORD m_VersionMinor
PString m_StreamID
PBoolean m_NewAccount
JID m_JID
const PString m_Password
PBoolean m_HasBind
PBoolean m_HasSession
PNotifierList m_SessionEstablishedHandlers
PNotifierList m_SessionReleasedHandlers
PNotifierList m_ErrorHandlers
PNotifierList m_MessageHandlers
PNotifierList m_PresenceHandlers
PNotifierList m_IQHandlers
PDictionary< PString,
PNotifierList
m_IQNamespaceHandlers
PDictionary< JID, PNotifierListm_MessageSenderHandlers
PMutex m_PendingIQsLock
StanzaList m_PendingIQs
StreamState m_State

Detailed Description

This class handles the client side of a C2S (Client to Server) XMPP stream.


Member Enumeration Documentation

Enumerator:
Null 
RegStarted 
TLSStarted 
SASLStarted 
NonSASLStarted 

non SASL authentication (JEP-0078)

StreamSent 
BindSent 
SessionSent 
Established 

Constructor & Destructor Documentation

XMPP::C2S::StreamHandler::StreamHandler ( const JID jid,
const PString pwd,
PBoolean  newAccount = false 
)

Member Function Documentation

virtual PBoolean XMPP::C2S::StreamHandler::Discover ( const PString xmlns,
const PString jid,
PNotifier responseHandler,
const PString node 
) [protected, virtual]
virtual PBoolean XMPP::C2S::StreamHandler::DiscoverInfo ( const PString jid,
PNotifier responseHandler,
const PString node = PString::Empty() 
) [virtual]
Parameters:
jidJID to which a query will be send
responseHandlerHandler function for responses
nodeOptional node
virtual PBoolean XMPP::C2S::StreamHandler::DiscoverItems ( const PString jid,
PNotifier responseHandler,
const PString node = PString::Empty() 
) [virtual]

JEP-0030 Service Discovery access methods.

The response handler will receive a PIQ stanza (a smart pointer to a XMPP::IQ)

Parameters:
jidJID to which a query will be send
responseHandlerHandler function for responses
nodeOptional node

These notifier lists are fired when a XMPP stanza or a stream error is received.

For the notifier lists to be fired the stream must be already in the established state (i.e. after the bind and the session state). The parameter passed to the notifiers is a reference to the received pdu

References m_ErrorHandlers.

const JID& XMPP::C2S::StreamHandler::GetJID ( ) const [inline]

References m_JID.

void XMPP::C2S::StreamHandler::GetVersion ( WORD &  major,
WORD &  minor 
) const
virtual void XMPP::C2S::StreamHandler::HandleBindSentState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleEstablishedState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleNonSASLStartedState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleNullState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleRegStartedState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleSessionSentState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleStreamSentState ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::HandleTLSStartedState ( PXML pdu) [protected, virtual]

A notifier list for a specific namespace.

The list will be fired only upon receiving an IQ with the child element of the specified namespace

virtual PBoolean XMPP::C2S::StreamHandler::IsEstablished ( ) const [inline, virtual]

References Established, and m_State.

A notifier list for a particular message originator.

The list will be fired only upon receiving a message from the specified jid. NOTE: if a matching notifier list is found and it's not emnpty, the generic MessageHandlers list IS NOT fired.

virtual void XMPP::C2S::StreamHandler::OnClose ( Stream stream,
INT   
) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnElement ( PXML pdu) [protected, virtual]

Reimplemented from XMPP::BaseStreamHandler.

virtual void XMPP::C2S::StreamHandler::OnError ( PXML pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnIQ ( XMPP::IQ pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnMessage ( XMPP::Message pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnOpen ( Stream stream,
INT   
) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnPresence ( XMPP::Presence pdu) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnSessionEstablished ( ) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::OnSessionReleased ( ) [protected, virtual]

Request the delivery of the specified stanza NOTE: the StreamHandler takes ownership of the stanza and will take care of deleting it.

BIG NOTE: use this method and not Write() if you want to get a notification when an answer to an iq arrives

These notifier lists after when a client session is established (i.e.

after the handshake and authentication steps are completed) or is released. The parameter passed to the notifiers is a reference to the stream handler

References m_SessionEstablishedHandlers.

virtual void XMPP::C2S::StreamHandler::SetState ( StreamState  s) [protected, virtual]
void XMPP::C2S::StreamHandler::SetVersion ( WORD  major,
WORD  minor 
)
virtual PBoolean XMPP::C2S::StreamHandler::Start ( Transport transport = 0) [virtual]

Reimplemented from XMPP::BaseStreamHandler.

virtual void XMPP::C2S::StreamHandler::StartAuthNegotiation ( ) [protected, virtual]
virtual void XMPP::C2S::StreamHandler::StartRegistration ( ) [protected, virtual]

Member Data Documentation

Referenced by GetJID().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines