Loading...
Searching...
No Matches
QXmppServer.h
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPSERVER_H
#define QXMPPSERVER_H
#include "QXmppLogger.h"
#include <QTcpServer>
#include <QVariantMap>
class QDomElement;
class QSslCertificate;
class QSslKey;
class QSslSocket;
class QXmppDialback;
class QXmppIncomingClient;
class QXmppOutgoingServer;
class QXmppPasswordChecker;
class QXmppPresence;
class QXmppServerExtension;
class QXmppServerPrivate;
class QXmppSslServer;
class QXmppStanza;
class QXMPP_EXPORT QXmppServer : public QXmppLoggable
{
Q_OBJECT
Q_PROPERTY(QXmppLogger *logger READ logger WRITE setLogger NOTIFY loggerChanged)
public:
QXmppServer(QObject *parent = nullptr);
~QXmppServer() override;
void addExtension(QXmppServerExtension *extension);
QList<QXmppServerExtension *> extensions();
QString domain() const;
void setDomain(const QString &domain);
// documentation needs to be here, see https://stackoverflow.com/questions/49192523/
QXmppLogger *logger();
void setLogger(QXmppLogger *logger);
QXmppPasswordChecker *passwordChecker();
void setPasswordChecker(QXmppPasswordChecker *checker);
QVariantMap statistics() const;
void addCaCertificates(const QString &caCertificates);
void setLocalCertificate(const QString &path);
void setLocalCertificate(const QSslCertificate &certificate);
void setPrivateKey(const QString &path);
void setPrivateKey(const QSslKey &key);
void close();
bool listenForClients(const QHostAddress &address = QHostAddress::Any, quint16 port = 5222);
bool listenForServers(const QHostAddress &address = QHostAddress::Any, quint16 port = 5269);
bool sendElement(const QDomElement &element);
bool sendPacket(const QXmppStanza &stanza);
void addIncomingClient(QXmppIncomingClient *stream);
Q_SIGNAL void clientConnected(const QString &jid);
Q_SIGNAL void clientDisconnected(const QString &jid);
Q_SIGNAL void loggerChanged(QXmppLogger *logger);
Q_SLOT void handleElement(const QDomElement &element);
private:
Q_SLOT void _q_clientConnection(QSslSocket *socket);
Q_SLOT void _q_clientConnected();
Q_SLOT void _q_clientDisconnected();
Q_SLOT void _q_dialbackRequestReceived(const QXmppDialback &dialback);
Q_SLOT void _q_outgoingServerDisconnected();
Q_SLOT void _q_serverConnection(QSslSocket *socket);
Q_SLOT void _q_serverDisconnected();
const std::unique_ptr<QXmppServerPrivate> d;
friend class QXmppServerPrivate;
};
class QXmppSslServerPrivate;
class QXMPP_EXPORT QXmppSslServer : public QTcpServer
{
Q_OBJECT
public:
QXmppSslServer(QObject *parent = nullptr);
~QXmppSslServer() override;
void addCaCertificates(const QList<QSslCertificate> &certificates);
void setLocalCertificate(const QSslCertificate &certificate);
void setPrivateKey(const QSslKey &key);
Q_SIGNAL void newConnection(QSslSocket *socket);
private:
void incomingConnection(qintptr socketDescriptor) override;
const std::unique_ptr<QXmppSslServerPrivate> d;
};
#endif
QXmppDialback
The QXmppDialback class represents a stanza used for the Server Dialback protocol as specified by XEP...
Definition QXmppDialback.h:16
QXmppIncomingClient
The QXmppIncomingClient class represents an incoming XMPP stream from an XMPP client.
Definition QXmppIncomingClient.h:27
QXmppLoggable::QXmppLoggable
QXmppLoggable(QObject *parent=nullptr)
Definition QXmppLogger.cpp:57
QXmppLogger
The QXmppLogger class represents a sink for logging messages.
Definition QXmppLogger.h:29
QXmppOutgoingServer
The QXmppOutgoingServer class represents an outgoing XMPP stream to another XMPP server.
Definition QXmppOutgoingServer.h:29
QXmppPasswordChecker
The QXmppPasswordChecker class represents an abstract password checker.
Definition QXmppPasswordChecker.h:81
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition QXmppPresence.h:22
QXmppServerExtension
The QXmppServerExtension class is the base class for QXmppServer extensions.
Definition QXmppServerExtension.h:29
QXmppServer::logger
QXmppLogger * logger
The QXmppLogger associated with the server.
Definition QXmppServer.h:44
QXmppServer::logger
QXmppLogger * logger()
Returns the QXmppLogger associated with the server.
QXmppServer::listenForClients
bool listenForClients(const QHostAddress &address=QHostAddress::Any, quint16 port=5222)
Listen for incoming XMPP client connections.
Definition QXmppServer.cpp:506
QXmppServer::setPrivateKey
void setPrivateKey(const QString &path)
Sets the path for the local SSL private key.
Definition QXmppServer.cpp:462
QXmppServer::clientDisconnected
Q_SIGNAL void clientDisconnected(const QString &jid)
This signal is emitted when a client has disconnected.
QXmppServer::extensions
QList< QXmppServerExtension * > extensions()
Returns the list of loaded extensions.
Definition QXmppServer.cpp:322
QXmppServer::close
void close()
Closes the server.
Definition QXmppServer.cpp:540
QXmppServer::listenForServers
bool listenForServers(const QHostAddress &address=QHostAddress::Any, quint16 port=5269)
Listen for incoming XMPP server connections.
Definition QXmppServer.cpp:571
QXmppServer::loggerChanged
Q_SIGNAL void loggerChanged(QXmppLogger *logger)
This signal is emitted when the logger changes.
QXmppServer::QXmppServer
QXmppServer(QObject *parent=nullptr)
Constructs a new XMPP server instance.
Definition QXmppServer.cpp:288
QXmppServer::sendPacket
bool sendPacket(const QXmppStanza &stanza)
Route an XMPP packet.
Definition QXmppServer.cpp:617
QXmppServer::sendElement
bool sendElement(const QDomElement &element)
Route an XMPP stanza.
Definition QXmppServer.cpp:605
QXmppServer::setLogger
void setLogger(QXmppLogger *logger)
Sets the QXmppLogger associated with the server.
Definition QXmppServer.cpp:346
QXmppServer::addCaCertificates
void addCaCertificates(const QString &caCertificates)
Sets the path for additional SSL CA certificates.
Definition QXmppServer.cpp:396
QXmppServer::setDomain
void setDomain(const QString &domain)
Sets the server's domain.
Definition QXmppServer.cpp:335
QXmppServer::handleElement
Q_SLOT void handleElement(const QDomElement &element)
Handle an incoming XML element.
Definition QXmppServer.cpp:752
QXmppServer::setLocalCertificate
void setLocalCertificate(const QString &path)
Sets the path for the local SSL certificate.
Definition QXmppServer.cpp:418
QXmppServer::domain
QString domain() const
Returns the server's domain.
Definition QXmppServer.cpp:329
QXmppServer::addIncomingClient
void addIncomingClient(QXmppIncomingClient *stream)
Definition QXmppServer.cpp:634
QXmppServer::setPasswordChecker
void setPasswordChecker(QXmppPasswordChecker *checker)
Sets the password checker used to verify client credentials.
Definition QXmppServer.cpp:379
QXmppServer::clientConnected
Q_SIGNAL void clientConnected(const QString &jid)
This signal is emitted when a client has connected.
QXmppServer::passwordChecker
QXmppPasswordChecker * passwordChecker()
Returns the password checker used to verify client credentials.
Definition QXmppServer.cpp:373
QXmppServer::addExtension
void addExtension(QXmppServerExtension *extension)
Registers a new extension with the server.
Definition QXmppServer.cpp:301
QXmppServer::statistics
QVariantMap statistics() const
Returns the statistics for the server.
Definition QXmppServer.cpp:385
QXmppSslServer
The QXmppSslServer class represents an SSL-enabled TCP server.
Definition QXmppServer.h:112
QXmppSslServer::addCaCertificates
void addCaCertificates(const QList< QSslCertificate > &certificates)
Definition QXmppServer.cpp:853
QXmppSslServer::newConnection
Q_SIGNAL void newConnection(QSslSocket *socket)
This signal is emitted when a new connection is established.
QXmppSslServer::setLocalCertificate
void setLocalCertificate(const QSslCertificate &certificate)
Sets the local certificate to be used for incoming connections.
Definition QXmppServer.cpp:859
QXmppSslServer::setPrivateKey
void setPrivateKey(const QSslKey &key)
Sets the local private key to be used for incoming connections.
Definition QXmppServer.cpp:865
QXmppSslServer::QXmppSslServer
QXmppSslServer(QObject *parent=nullptr)
Constructs a new SSL server instance.
Definition QXmppServer.cpp:821
QXmppStanza
The QXmppStanza class is the base class for all XMPP stanzas.
Definition QXmppStanza.h:106