5#ifndef QXMPPOUTGOINGCLIENT_P_H 
    6#define QXMPPOUTGOINGCLIENT_P_H 
    8#include "QXmppOutgoingClient.h" 
    9#include "QXmppPromise.h" 
   10#include "QXmppSaslManager_p.h" 
   11#include "QXmppSasl_p.h" 
   12#include "QXmppStreamError_p.h" 
   13#include "QXmppStreamManagement_p.h" 
   15#include "XmppSocket.h" 
   24using namespace QXmpp::Private;
 
   26namespace QXmpp::Private {
 
   28using LegacyError = std::variant<QAbstractSocket::SocketError, QXmpp::TimeoutError, QXmppStanza::Error::Condition>;
 
   35    HandleElementResult handleElement(
const QDomElement &el);
 
   55    using Result = std::variant<BoundAddress, QXmppStanza::Error, ProtocolError>;
 
   57    explicit BindManager(SendDataInterface *socket) : m_socket(socket) { }
 
   60    HandleElementResult handleElement(
const QDomElement &el);
 
   63    SendDataInterface *m_socket;
 
   65    std::optional<QXmppPromise<Result>> m_promise;
 
   68struct NonSaslAuthOptions {
 
   74class NonSaslAuthManager
 
   77    using OptionsResult = std::variant<NonSaslAuthOptions, QXmppError>;
 
   78    using AuthResult = std::variant<Success, QXmppError>;
 
   80    explicit NonSaslAuthManager(SendDataInterface *socket) : m_socket(socket) { }
 
   83    QXmppTask<AuthResult> authenticate(
bool plainText, 
const QString &username, 
const QString &password, 
const QString &resource, 
const QString &streamId);
 
   84    HandleElementResult handleElement(
const QDomElement &el);
 
   97    SendDataInterface *m_socket;
 
   98    std::variant<NoQuery, OptionsQuery, AuthQuery> m_query;
 
  105    explicit PingManager(QXmppOutgoingClient *q);
 
  107    void onDataReceived();
 
  112    QXmppOutgoingClient *q;
 
  114    QTimer *timeoutTimer;
 
  117using IqResult = QXmppOutgoingClient::IqResult;
 
  125class OutgoingIqManager
 
  128    OutgoingIqManager(
QXmppLoggable *l, StreamAckManager &streamAckMananger);
 
  129    ~OutgoingIqManager();
 
  134    bool hasId(
const QString &
id) 
const;
 
  135    bool isIdValid(
const QString &
id) 
const;
 
  138    void finish(
const QString &
id, IqResult &&result);
 
  141    void onSessionOpened(
const SessionBegin &);
 
  142    void onSessionClosed(
const SessionEnd &);
 
  143    bool handleStanza(
const QDomElement &stanza);
 
  146    void warning(
const QString &message);
 
  149    StreamAckManager &m_streamAckManager;
 
  150    std::unordered_map<QString, IqState> m_requests;
 
  155class QXmppOutgoingClientPrivate
 
  160        QXmppOutgoingClient::ConnectionError details;
 
  161        LegacyError legacyError;
 
  164    explicit QXmppOutgoingClientPrivate(QXmppOutgoingClient *q);
 
  165    void connectToHost(
const ServerAddress &);
 
  166    void connectToAddressList(std::vector<ServerAddress> &&);
 
  167    void connectToNextAddress();
 
  172    std::optional<Error> error;
 
  176    StreamAckManager streamAckManager;
 
  177    OutgoingIqManager iqManager;
 
  180    std::vector<ServerAddress> serverAddresses;
 
  181    std::size_t nextServerAddressIndex = 0;
 
  185    } nextAddressState = Current;
 
  190    QString streamVersion;
 
  193    std::optional<StreamErrorElement::SeeOtherHost> redirect;
 
  196    bool isAuthenticated = 
false;
 
  197    bool bindModeAvailable = 
false;
 
  198    bool sessionStarted = 
false;
 
  199    AuthenticationMethod authenticationMethod = AuthenticationMethod::Sasl;
 
  200    std::optional<Bind2Bound> bind2Bound;
 
  202    std::variant<QXmppOutgoingClient *, StarttlsManager, NonSaslAuthManager, SaslManager, Sasl2Manager, C2sStreamManager *, BindManager> listener;
 
  203    FastTokenManager fastTokenManager;
 
  204    C2sStreamManager c2sStreamManager;
 
  205    CarbonManager carbonManager;
 
  206    CsiManager csiManager;
 
  207    PingManager pingManager;
 
  209    template<
typename T, 
typename... Args>
 
  210    T &setListener(Args... args)
 
  212        listener = T { args... };
 
  213        return std::get<T>(listener);
 
  217    QXmppOutgoingClient *q;
 
The QXmppConfiguration class holds configuration options.
Definition QXmppConfiguration.h:37
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:23
The QXmppLoggable class represents a source of logging messages.
Definition QXmppLogger.h:110
Create and update QXmppTask objects to communicate results of asynchronous operations.
Definition QXmppPromise.h:23
Definition QXmppTask.h:62