Component Class Reference

`#include <component.h>`

Inheritance diagram for Component:
[legend]

## Public Member Functions

| Component (const std::string &ns, const std::string &server, const std::string &component, const std::string &password, int port=5347)
virtual | ~Component ()
virtual void | disconnect ()
Public Member Functions inherited from ClientBase
| ClientBase (const std::string &ns, const std::string &server, int port=-1)
| ClientBase (const std::string &ns, const std::string &password, const std::string &server, int port=-1)
virtual | ~ClientBase ()
bool | connect (bool block=true)
virtual ConnectionError | recv (int timeout=-1)
virtual const std::string & | username () const
const JID & | jid ()
void | setSasl (bool sasl)
void | setTls (TLSPolicy tls)
void | setCompression (bool compression)
void | setPort (int port)
void | setServer (const std::string &server)
void | setPassword (const std::string &password)
const std::string & | server () const
bool | sasl () const
TLSPolicy | tls () const
bool | compression () const
int | port () const
virtual const std::string & | password () const
virtual Disco * | disco () const
const std::string | getID ()
void | send (Tag *tag)
void | send (IQ &iq, IqHandler *ih, int context, bool del=false)
void | send (const IQ &iq)
void | send (const Message &msg)
void | send (const Subscription &sub)
void | send (const Presence &pres)
bool | authed () const
ConnectionState | state () const
const std::string & | xmlLang () const
void | setXmlLang (const std::string &xmllang)
ConnectionBase * | connectionImpl () const
void | setConnectionImpl (ConnectionBase *cb)
TLSBase * | encryptionImpl () const
void | setEncryptionImpl (TLSBase *tb)
CompressionBase * | compressionImpl () const
void | setCompressionImpl (CompressionBase *cb)
void | whitespacePing ()
void | xmppPing (const JID &to, EventHandler *eh)
void | setAuthzid (const JID &authzid)
void | setAuthcid (const std::string &authcid)
void | setSASLMechanisms (int mechanisms)
void | registerStanzaExtension (StanzaExtension *ext)
bool | removeStanzaExtension (int ext)
void | registerConnectionListener (ConnectionListener *cl)
void | registerIqHandler (IqHandler *ih, int exttype)
void | removeIDHandler (IqHandler *ih)
void | registerMessageHandler (MessageHandler *mh)
void | removeMessageHandler (MessageHandler *mh)
void | registerMessageSession (MessageSession *session)
void | disposeMessageSession (MessageSession *session)
void | registerPresenceHandler (PresenceHandler *ph)
void | registerPresenceHandler (const JID &jid, PresenceHandler *ph)
void | registerSubscriptionHandler (SubscriptionHandler *sh)
void | registerTagHandler (TagHandler *th, const std::string &tag, const std::string &xmlns)
void | registerStatisticsHandler (StatisticsHandler *sh)
void | removeConnectionListener (ConnectionListener *cl)
void | removeIqHandler (IqHandler *ih, int exttype)
void | removePresenceHandler (PresenceHandler *ph)
void | removePresenceHandler (const JID &jid, PresenceHandler *ph)
void | removeSubscriptionHandler (SubscriptionHandler *sh)
void | removeTagHandler (TagHandler *th, const std::string &tag, const std::string &xmlns)
void | removeStatisticsHandler ()
void | setCACerts (const StringList &cacerts)
void | setClientCert (const std::string &clientKey, const std::string &clientCerts)
void | registerMessageSessionHandler (MessageSessionHandler *msh, int types=0)
LogSink & | logInstance ()
StreamError | streamError () const
const std::string & | streamErrorText (const std::string &lang="default") const
const std::string & | streamErrorCData () const
const Tag * | streamErrorAppCondition () const
AuthenticationError | authError () const
StatisticsStruct | getStatistics ()
void | registerMUCInvitationHandler (MUCInvitationHandler *mih)
void | removeMUCInvitationHandler ()
void | addPresenceExtension (StanzaExtension *se)
bool | removePresenceExtension (int type)
const StanzaExtensionList & | presenceExtensions () const
const TagList | sendQueue ()
virtual void | handleTag (Tag *tag)
virtual void | handleCompressedData (const std::string &data)
virtual void | handleDecompressedData (const std::string &data)
virtual void | handleReceivedData (const ConnectionBase *connection, const std::string &data)
virtual void | handleConnect (const ConnectionBase *connection)
virtual void | handleDisconnect (const ConnectionBase *connection, ConnectionError reason)
virtual void | handleEncryptedData (const TLSBase *base, const std::string &data)
virtual void | handleDecryptedData (const TLSBase *base, const std::string &data)
virtual void | handleHandshakeResult (const TLSBase *base, bool success, CertInfo &certinfo)
Public Member Functions inherited from TagHandler
virtual | ~TagHandler ()
Public Member Functions inherited from ConnectionDataHandler
virtual | ~ConnectionDataHandler ()
Public Member Functions inherited from CompressionDataHandler
virtual | ~CompressionDataHandler ()
Public Member Functions inherited from TLSHandler
virtual | ~TLSHandler ()
Public Member Functions inherited from IqHandler
virtual | ~IqHandler ()

## Protected Member Functions

virtual void | handleStartNode (const Tag *start)
virtual bool | handleNormalNode (Tag *tag)
virtual bool | checkStreamVersion (const std::string &)
Protected Member Functions inherited from ClientBase
void | notifyOnResourceBindError (const Error *error)
void | notifyOnResourceBind (const std::string &resource)
void | notifyOnSessionCreateError (const Error *error)
bool | notifyOnTLSConnect (const CertInfo &info)
void | notifyOnConnect ()
void | notifyStreamEvent (StreamEvent event)
virtual void | disconnect (ConnectionError reason)
void | header ()
void | setAuthed (bool authed)
void | setAuthFailure (AuthenticationError e)
void | startSASL (SaslMechanism type)
bool | processSASLSuccess (const std::string &payload)
void | processSASLChallenge (const std::string &challenge)
void | processSASLError (Tag *tag)
void | setNTLMDomain (const std::string &domain)
void | startTls ()
bool | hasTls ()
void | send (const std::string &xml)
void | checkQueue (int handled, bool resend)
int | stanzasSent () const
std::string | getRandom ()

## Additional Inherited Members

Protected Types inherited from ClientBase
enum | SMContext { CtxSMInvalid , CtxSMFailed , CtxSMEnable , CtxSMResume , CtxSMEnabled , CtxSMResumed }
Protected Attributes inherited from ClientBase
JID | m_jid
JID | m_authzid
std::string | m_authcid
ConnectionBase * | m_connection
TLSBase * | m_encryption
CompressionBase * | m_compression
Disco * | m_disco
StanzaExtensionList | m_presenceExtensions
GLOOX_DEPRECATED std::string | m_selectedResource
std::string | m_clientCerts
std::string | m_clientKey
std::string | m_namespace
std::string | m_password
std::string | m_xmllang
std::string | m_server
std::string | m_sid
bool | m_compressionActive
bool | m_encryptionActive
bool | m_compress
bool | m_authed
bool | m_resourceBound
bool | m_block
bool | m_sasl
TLSPolicy | m_tls
int | m_port
int | m_availableSaslMechs
SMContext | m_smContext
int | m_smHandled

## Detailed Description

This is an implementation of a basic jabber Component.

It's using XEP-0114 (Jabber Component Protocol) to authenticate with a server.

Author
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  0.3

Definition at line 33 of file component.h.

## Constructor & Destructor Documentation

## Component()

Component | ( | const std::string & | ns,
|  | const std::string & | server,
|  | const std::string & | component,
|  | const std::string & | password,
|  | int | port = 5347 )

Constructs a new Component.

Parameters

  ns | The namespace that qualifies the stream. Either jabber:component:accept or jabber:component:connect. See XEP-0114 for details.
  server | The server to connect to.
  component | The component's hostname. FQDN.
  password | The component's password.
  port | The port to connect to. The default of 5347 is the default port of the router in jabberd2.

Definition at line 27 of file component.cpp.

## ~Component()

virtual ~Component | ( |  | ) |

inline virtual

Virtual Destructor.

Definition at line 52 of file component.h.

## Member Function Documentation

## checkStreamVersion()

virtual bool checkStreamVersion | ( | const std::string & | version | ) |

inline protected virtual

Implementors of this function can check if they support the advertized stream version. The return value indicates whether or not the stream can be handled. A default implementation is provided.

Parameters

  version | The advertized stream version.

Returns
  True if the stream can be handled, false otherwise.

Reimplemented from ClientBase.

Definition at line 67 of file component.h.

## disconnect()

virtual void disconnect | ( |  | ) |

inline virtual

Disconnects from the server.

Definition at line 57 of file component.h.

## handleNormalNode()

bool handleNormalNode | ( | Tag * | tag | ) |

protected virtual

This function is called for each Tag. Only stream initiation/negotiation should be done here.

Parameters

  tag | A Tag to handle.

Returns
  Returns true if the tag has been handled inside the function, false otherwise.

Implements ClientBase.

Definition at line 50 of file component.cpp.

## handleStartNode()

void handleStartNode | ( | const Tag * | start | ) |

protected virtual

This function is called right after the opening <stream:stream> was received.

Parameters

  start | The complete stream opening tag. Note that the XML representation (Tag::xml()) will contain a closed stream tag. The original is open.

Implements ClientBase.

Definition at line 35 of file component.cpp.

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

- component.h
- component.cpp