#include <clientbase.h>
Inherits TagHandler, ConnectionDataHandler, CompressionDataHandler, TLSHandler, and IqHandler.
Inherited by Client, and Component.
Inheritance diagram for ClientBase:

Public Member Functions | |
| 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) |
| 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 (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 |
| 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) |
Protected Member Functions | |
| 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) |
| virtual bool | checkStreamVersion (const std::string &version) |
| void | startSASL (SaslMechanism type) |
| void | processSASLSuccess () |
| void | processSASLChallenge (const std::string &challenge) |
| void | processSASLError (Tag *tag) |
| void | setNTLMDomain (const std::string &domain) |
| void | startTls () |
| bool | hasTls () |
Protected Attributes | |
| 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 |
| 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_block |
| bool | m_sasl |
| TLSPolicy | m_tls |
| int | m_port |
| int | m_availableSaslMechs |
It manages connection establishing, authentication, filter registration and invocation. You should normally use Client for client connections and Component for component connections.
Definition at line 75 of file clientbase.h.
|
||||||||||||||||
|
Constructs a new ClientBase. You should not need to use this class directly. Use Client or Component instead.
Definition at line 86 of file clientbase.cpp. |
|
||||||||||||||||||||
|
Constructs a new ClientBase. You should not need to use this class directly. Use Client or Component instead.
Definition at line 101 of file clientbase.cpp. |
|
|
Virtual destrcuctor. Definition at line 137 of file clientbase.cpp. |
|
|
Adds a StanzaExtension that will be sent with every Presence stanza sent. Capabilities are included by default if you are using a Client.
Definition at line 1461 of file clientbase.cpp. |
|
|
Returns whether authentication has taken place and was successful.
Definition at line 289 of file clientbase.h. |
|
|
Use this function to retrieve the type of the authentication error after it occurs and you received a ConnectionError of type ConnAuthenticationFailed from the ConnectionListener.
Definition at line 639 of file clientbase.h. |
|
|
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.
Reimplemented in Component. Definition at line 895 of file clientbase.cpp. |
|
|
Returns whether Stream Compression is currently enabled (not necessarily used).
Definition at line 213 of file clientbase.h. |
|
|
This function returns the concrete compression implementation currently in use.
Definition at line 348 of file clientbase.h. |
|
|
Initiates the connection to a server. This function blocks as long as a connection is established. You can have the connection block 'til the end of the connection, or you can have it return immediately. If you choose the latter, its your responsibility to call recv() every now and then to actually receive data from the socket and to feed the parser.
Definition at line 162 of file clientbase.cpp. |
|
|
This function returns the concrete connection implementation currently in use.
Definition at line 316 of file clientbase.h. |
|
|
This function gives access to the
Definition at line 232 of file clientbase.h. |
|
|
Disconnects the underlying stream and broadcasts the given reason.
Definition at line 361 of file clientbase.cpp. |
|
|
Removes the given MessageSession from the list of MessageSessions and deletes it.
Definition at line 1128 of file clientbase.cpp. |
|
|
This function returns the concrete encryption implementation currently in use.
Definition at line 332 of file clientbase.h. |
|
|
Creates a string which is unique in the current instance and can be used as an ID for queries.
Definition at line 886 of file clientbase.cpp. |
|
|
Returns a StatisticsStruct containing byte and stanza counts for the current active connection.
Definition at line 836 of file clientbase.cpp. |
|
|
This function is called when compression is finished.
Implements CompressionDataHandler. Definition at line 276 of file clientbase.cpp. |
|
|
This function is called when e.g. the raw TCP connection was established.
Implements ConnectionDataHandler. Definition at line 339 of file clientbase.cpp. |
|
|
This function is called when decompression is finished.
Implements CompressionDataHandler. Definition at line 286 of file clientbase.cpp. |
|
||||||||||||
|
Reimplement this function to receive decrypted data from a TLSBase implementation.
Implements TLSHandler. Definition at line 299 of file clientbase.cpp. |
|
||||||||||||
|
This connection is called when e.g. the raw TCP connection was closed.
Implements ConnectionDataHandler. Definition at line 344 of file clientbase.cpp. |
|
||||||||||||
|
Reimplement this function to receive encrypted data from a TLSBase implementation.
Implements TLSHandler. Definition at line 291 of file clientbase.cpp. |
|
||||||||||||||||
|
Reimplement this function to receive the result of a TLS handshake.
Implements TLSHandler. Definition at line 307 of file clientbase.cpp. |
|
||||||||||||
|
This function is called for received from the underlying transport.
Implements ConnectionDataHandler. Definition at line 329 of file clientbase.cpp. |
|
|
This function is called when a registered XML element arrives. As with every handler in gloox, the Tag is going to be deleted after this function returned. If you need a copy afterwards, create it using Tag::clone().
Implements TagHandler. Definition at line 192 of file clientbase.cpp. |
|
|
Indicates whether or not TLS is supported.
Definition at line 410 of file clientbase.cpp. |
|
|
Sends the stream header. Definition at line 401 of file clientbase.cpp. |
|
|
Returns the current Jabber ID. If an authorization ID has been set (using setAuthzid()) this authzid is returned.
Definition at line 146 of file clientbase.h. |
|
|
Returns the LogSink instance for this ClientBase and all related objects.
Definition at line 598 of file clientbase.h. |
|
|
This function is called to notify about successful connection. Definition at line 1230 of file clientbase.cpp. |
|
|
This function is called when binding a resource succeeded.
Definition at line 1254 of file clientbase.cpp. |
|
|
This function is called when resource binding yieled an error.
Definition at line 1249 of file clientbase.cpp. |
|
|
This function is called when session creation yieled an error.
Definition at line 1259 of file clientbase.cpp. |
|
|
This function is called when the TLS handshake completed correctly. The return value is used to determine whether or not the client accepted the server's certificate. If false is returned the connection is closed.
Definition at line 1241 of file clientbase.cpp. |
|
|
This function is used to notify subscribers of stream events.
Definition at line 1264 of file clientbase.cpp. |
|
|
Returns the current password.
Definition at line 226 of file clientbase.h. |
|
|
Returns the port. The default of -1 means that the actual port will be looked up using SRV records, or the XMPP default port of 5222 will be used.
Definition at line 220 of file clientbase.h. |
|
|
Returns the current list of Presence StanzaExtensions.
Definition at line 679 of file clientbase.h. |
|
|
Processes the given SASL challenge and sends a response.
Definition at line 525 of file clientbase.cpp. |
|
|
Examines the given Tag for SASL errors.
Definition at line 674 of file clientbase.cpp. |
|
|
Releases SASL related resources. Definition at line 702 of file clientbase.cpp. |
|
|
Use this periodically to receive data from the socket and to feed the parser. You need to use this only if you chose to connect in non-blocking mode.
Definition at line 154 of file clientbase.cpp. |
|
|
Registers
Definition at line 1218 of file clientbase.cpp. |
|
||||||||||||
|
Registers
Definition at line 1091 of file clientbase.cpp. |
|
|
Registers
Definition at line 1143 of file clientbase.cpp. |
|
|
Registers the given MessageSession to receive Messages incoming from the session's target JID.
Definition at line 1122 of file clientbase.cpp. |
|
||||||||||||
|
Use this function to register a MessageSessionHandler with the Client. Optionally the MessageSessionHandler can receive only MessageSessions with a given message type. There can be only one handler per message type.
Definition at line 1022 of file clientbase.cpp. |
|
|
Registers a MUCInvitationHandler with the ClientBase.
Definition at line 1203 of file clientbase.cpp. |
|
||||||||||||
|
Registers a new PresenceHandler for the given JID. Presences received for this particular JID will not be forwarded to the generic PresenceHandler (and therefore the Roster). This functionality is primarily intended for the MUC implementation.
Definition at line 1049 of file clientbase.cpp. |
|
|
Registers
Definition at line 1037 of file clientbase.cpp. |
|
|
Registers a new StanzaExtension with the StanzaExtensionFactory.
Definition at line 820 of file clientbase.cpp. |
|
|
Registers
Definition at line 1192 of file clientbase.cpp. |
|
|
Registers
Definition at line 1155 of file clientbase.cpp. |
|
||||||||||||||||
|
Registers
Definition at line 1167 of file clientbase.cpp. |
|
|
Removes the given object from the list of connection listeners.
Definition at line 1224 of file clientbase.cpp. |
|
|
Removes the given IqHandler from the list of handlers of pending operations, added using trackID(). Necessary, for example, when closing a GUI element that has an operation pending.
Definition at line 1076 of file clientbase.cpp. |
|
||||||||||||
|
Removes the given IQ handler for the given extension type.
Definition at line 1105 of file clientbase.cpp. |
|
|
Removes the given object from the list of message handlers.
Definition at line 1149 of file clientbase.cpp. |
|
|
Removes the currently registered MUCInvitationHandler. Definition at line 1212 of file clientbase.cpp. |
|
|
Removes the StanzaExtension of the given type from the list of Presence StanzaExtensions. Use addPresenceExtension() to replace an already added type. Definition at line 1470 of file clientbase.cpp. |
|
||||||||||||
|
Removes the given object from the list of presence handlers for the given JID.
Definition at line 1060 of file clientbase.cpp. |
|
|
Removes the given object from the list of presence handlers.
Definition at line 1043 of file clientbase.cpp. |
|
|
Removes the given StanzaExtension type from the StanzaExtensionFactory.
Definition at line 828 of file clientbase.cpp. |
|
|
Removes the current StatisticsHandler. Definition at line 1198 of file clientbase.cpp. |
|
|
Removes the given object from the list of subscription handlers.
Definition at line 1161 of file clientbase.cpp. |
|
||||||||||||||||
|
Removes the given object from the list of tag handlers for the given element and namespace.
Definition at line 1179 of file clientbase.cpp. |
|
|
Returns whether SASL is currently enabled (not necessarily used).
Definition at line 201 of file clientbase.h. |
|
|
A convenience function that sends the given Presence stanza.
Definition at line 759 of file clientbase.cpp. |
|
|
A convenience function that sends the given Subscription stanza.
Definition at line 750 of file clientbase.cpp. |
|
|
A convenience function that sends the given Message stanza.
Definition at line 741 of file clientbase.cpp. |
|
|
A convenience function that sends the given IQ stanza.
Definition at line 732 of file clientbase.cpp. |
|
||||||||||||||||||||
|
Sends the given IQ stanza. The given IqHandler is registered to be notified of replies. This, of course, only works for IQs of type get or set. An ID is added if necessary.
Definition at line 713 of file clientbase.cpp. |
|
|
Sends the given Tag over an established connection. The ClientBase object becomes the owner of this Tag and will delete it after sending it. You should not rely on the existance of the Tag after it's been sent. If you still need it after sending it, use Tag::clone() to create a deep copy.
Definition at line 771 of file clientbase.cpp. |
|
|
Returns the current prepped server.
Definition at line 195 of file clientbase.h. |
|
|
Use this function to set an authentication ID (authcid) for SASL PLAIN. The default authcid is the username, i.e. the JID's node part. This should work in most cases. If this is not what you want to use for authentication, use this function.
Definition at line 390 of file clientbase.h. |
|
|
Tells ClientBase that authentication was successful (or not).
Definition at line 764 of file clientbase.h. |
|
|
If authentication failed, this function tells ClientBase the reason.
Definition at line 771 of file clientbase.h. |
|
|
Use this function to set an authorization ID (authzid). Provided the server supports it and the user has sufficient rights, they could then authenticate as bob@example.net but act as alice@example.net.
Definition at line 380 of file clientbase.h. |
|
|
Use this function to set a number of trusted root CA certificates which shall be used to verify a servers certificate.
Definition at line 567 of file clientbase.h. |
|
||||||||||||
|
Use this function to set the user's certificate and private key. The certificate will be presented to the server upon request and can be used for SASL EXTERNAL authentication. The user's certificate file should be a bundle of more than one certificate in PEM format. The first one in the file should be the user's certificate, each cert following that one should have signed the previous one.
Definition at line 431 of file clientbase.cpp. |
|
|
Switches usage of Stream Compression on/off (if available). Default: on if available. Stream Compression should only be disabled if there are problems with using it.
Definition at line 167 of file clientbase.h. |
|
|
Use this function if you have a class supporting some fancy compression algorithm. This should be called before calling connect(). If there already is a compression implementation set (either manually or automatically), it gets deleted.
Definition at line 932 of file clientbase.cpp. |
|
|
Use this function if you have a class implementing a UDP, SCTP (or whatever) connection. This should be called before calling connect(). If there already is a connection implementation set (either manually or automatically), it gets deleted.
Definition at line 914 of file clientbase.cpp. |
|
|
Use this function if you have a class supporting hardware encryption (or whatever). This should be called before calling connect(). If there already is a encryption implementation set (either manually or automatically), it gets deleted.
Definition at line 923 of file clientbase.cpp. |
|
|
Sets the domain to use in SASL NTLM authentication.
Definition at line 809 of file clientbase.h. |
|
|
Sets the password to use to connect to the XMPP server.
Definition at line 189 of file clientbase.h. |
|
|
Sets the port to connect to. This is not necessary if either the default port (5222) is used or SRV records exist which will be resolved.
Definition at line 174 of file clientbase.h. |
|
|
Switches usage of SASL on/off. Default: on. SASL should only be disabled if there are problems with using it.
Definition at line 153 of file clientbase.h. |
|
|
Use this function to limit SASL mechanisms gloox can use. By default, all supported mechanisms are allowed. To exclude one (or more) mechanisms, remove it from SaslMechAll like so: int mymechs = SaslMechAll ^ SaslMechDigestMd5;
Definition at line 402 of file clientbase.h. |
|
|
Sets the XMPP server to connect to.
Definition at line 424 of file clientbase.cpp. |
|
|
Sets the TLS policy. Default: TLS will be used if available. TLS should only be disabled if there are problems with using it.
Definition at line 160 of file clientbase.h. |
|
|
Sets the value for the xml:lang attribute of the initial stream.
Definition at line 309 of file clientbase.h. |
|
|
Starts authentication using the given SASL mechanism.
Definition at line 437 of file clientbase.cpp. |
|
|
Starts the TLS handshake. Definition at line 419 of file clientbase.cpp. |
|
|
Returns the current connection status.
Definition at line 844 of file clientbase.cpp. |
|
|
Use this function to retrieve the type of the stream error after it occurs and you received a ConnectionError of type ConnStreamError from the ConnectionListener.
Definition at line 606 of file clientbase.h. |
|
|
This function can be used to retrieve the application-specific error condition of a stream error.
Definition at line 632 of file clientbase.h. |
|
|
In case the defined-condition element of an stream error contains XML character data you can use this function to retrieve it. RFC 3920 only defines one condition (see-other-host)where this is possible.
Definition at line 625 of file clientbase.h. |
|
|
Returns the text of a stream error for the given language if available. If the requested language is not available, the default text (without a xml:lang attribute) will be returned.
Definition at line 1016 of file clientbase.cpp. |
|
|
Returns whether TLS is currently enabled (not necessarily used).
Definition at line 207 of file clientbase.h. |
|
|
Reimplement this function to provide a username for connection purposes.
Definition at line 137 of file clientbase.h. |
|
|
Sends a whitespace ping to the server.
Definition at line 849 of file clientbase.cpp. |
|
|
Retrieves the value of the xml:lang attribute of the initial stream. Default is 'en', i.e. if not changed by a call to setXmlLang(). Definition at line 301 of file clientbase.h. |
|
||||||||||||
|
Sends a XMPP Ping (XEP-0199) to the given JID.
Definition at line 854 of file clientbase.cpp. |
|
|
An alternative authentication ID. See setAuthcid(). Definition at line 824 of file clientbase.h. |
|
|
Whether authentication has been completed successfully. Definition at line 849 of file clientbase.h. |
|
|
An optional authorization ID. See setAuthzid(). Definition at line 823 of file clientbase.h. |
|
|
The SASL mechanisms the server offered. Definition at line 856 of file clientbase.h. |
|
|
Whether blocking connection is wanted. Definition at line 850 of file clientbase.h. |
|
|
TLS client certificates. Definition at line 835 of file clientbase.h. |
|
|
TLS client private key. Definition at line 836 of file clientbase.h. |
|
|
Whether stream compression is desired at all. Definition at line 847 of file clientbase.h. |
|
|
Used for connection compression. Definition at line 827 of file clientbase.h. |
|
|
Indicates whether or not stream compression is currently activated. Definition at line 843 of file clientbase.h. |
|
|
The transport connection. Definition at line 825 of file clientbase.h. |
|
|
The local Service Discovery client. Definition at line 828 of file clientbase.h. |
|
|
Used for connection encryption. Definition at line 826 of file clientbase.h. |
|
|
Indicates whether or not stream encryption is currently activated. Definition at line 845 of file clientbase.h. |
|
|
The 'self' JID. Definition at line 822 of file clientbase.h. |
|
|
Default namespace. Definition at line 837 of file clientbase.h. |
|
|
Client's password. Definition at line 838 of file clientbase.h. |
|
|
The port to connect to, if not to be determined by querying the server's SRV records. Definition at line 853 of file clientbase.h. |
|
|
A list of permanent presence extensions. Definition at line 831 of file clientbase.h. |
|
|
Whether SASL authentication is wanted. Definition at line 851 of file clientbase.h. |
|
|
The currently selected resource. See Client::selectResource() and Client::binRessource(). Definition at line 833 of file clientbase.h. |
|
|
The server to connect to, if different from the JID's server. Definition at line 840 of file clientbase.h. |
|
|
The stream ID. Definition at line 842 of file clientbase.h. |
|
|
The current TLS policy. Definition at line 852 of file clientbase.h. |
|
|
Default value of the xml:lang attribute. Definition at line 839 of file clientbase.h. |
1.4.1