QXmpp Version: 0.9.3
QXmppServer.h
1/*
2 * Copyright (C) 2008-2014 The QXmpp developers
3 *
4 * Author:
5 * Jeremy Lainé
6 *
7 * Source:
8 * https://github.com/qxmpp-project/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24#ifndef QXMPPSERVER_H
25#define QXMPPSERVER_H
26
27#include <QTcpServer>
28#include <QVariantMap>
29
30#include "QXmppLogger.h"
31
32class QDomElement;
33class QSslCertificate;
34class QSslKey;
35class QSslSocket;
36
37class QXmppDialback;
41class QXmppPresence;
43class QXmppServerPrivate;
44class QXmppSslServer;
45class QXmppStanza;
46class QXmppStream;
47
58
59class QXMPP_EXPORT QXmppServer : public QXmppLoggable
60{
61 Q_OBJECT
62 Q_PROPERTY(QXmppLogger* logger READ logger WRITE setLogger NOTIFY loggerChanged)
63
64public:
65 QXmppServer(QObject *parent = 0);
67
68 void addExtension(QXmppServerExtension *extension);
69 QList<QXmppServerExtension*> extensions();
70
71 QString domain() const;
72 void setDomain(const QString &domain);
73
74 QXmppLogger *logger();
75 void setLogger(QXmppLogger *logger);
76
77 QXmppPasswordChecker *passwordChecker();
78 void setPasswordChecker(QXmppPasswordChecker *checker);
79
80 QVariantMap statistics() const;
81
82 void addCaCertificates(const QString &caCertificates);
83 void setLocalCertificate(const QString &path);
84 void setLocalCertificate(const QSslCertificate &certificate);
85 void setPrivateKey(const QString &path);
86 void setPrivateKey(const QSslKey &key);
87
88 void close();
89 bool listenForClients(const QHostAddress &address = QHostAddress::Any, quint16 port = 5222);
90 bool listenForServers(const QHostAddress &address = QHostAddress::Any, quint16 port = 5269);
91
92 bool sendElement(const QDomElement &element);
93 bool sendPacket(const QXmppStanza &stanza);
94
95 void addIncomingClient(QXmppIncomingClient *stream);
96
97signals:
99 void clientConnected(const QString &jid);
100
102 void clientDisconnected(const QString &jid);
103
106
107public slots:
108 void handleElement(const QDomElement &element);
109
110private slots:
111 void _q_clientConnection(QSslSocket *socket);
112 void _q_clientConnected();
113 void _q_clientDisconnected();
114 void _q_dialbackRequestReceived(const QXmppDialback &dialback);
115 void _q_outgoingServerDisconnected();
116 void _q_serverConnection(QSslSocket *socket);
117 void _q_serverDisconnected();
118
119private:
120 friend class QXmppServerPrivate;
121 QXmppServerPrivate *d;
122};
123
124class QXmppSslServerPrivate;
125
128
129class QXMPP_EXPORT QXmppSslServer : public QTcpServer
130{
131 Q_OBJECT
132
133public:
134 QXmppSslServer(QObject *parent = 0);
136
137 void addCaCertificates(const QList<QSslCertificate> &certificates);
138 void setLocalCertificate(const QSslCertificate &certificate);
139 void setPrivateKey(const QSslKey &key);
140
141signals:
143 void newConnection(QSslSocket *socket);
144
145private:
146 #if QT_VERSION < 0x050000
147 void incomingConnection(int socketDescriptor);
148 #else
149 void incomingConnection(qintptr socketDescriptor);
150 #endif
151 QXmppSslServerPrivate * const d;
152};
153
154#endif
The QXmppDialback class represents a stanza used for the Server Dialback protocol as specified by XEP...
Definition: QXmppDialback.h:35
Interface for password checkers.
Definition: QXmppIncomingClient.h:40
The QXmppLoggable class represents a source of logging messages.
Definition: QXmppLogger.h:112
The QXmppLogger class represents a sink for logging messages.
Definition: QXmppLogger.h:46
The QXmppOutgoingServer class represents an outgoing XMPP stream to another XMPP server.
Definition: QXmppOutgoingServer.h:41
The QXmppPasswordChecker class represents an abstract password checker.
Definition: QXmppPasswordChecker.h:102
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:37
The QXmppServerExtension class is the base class for QXmppServer extensions.
Definition: QXmppServerExtension.h:49
The QXmppServer class represents an XMPP server.
Definition: QXmppServer.h:60
void clientDisconnected(const QString &jid)
This signal is emitted when a client has disconnected.
void clientConnected(const QString &jid)
This signal is emitted when a client has connected.
void loggerChanged(QXmppLogger *logger)
This signal is emitted when the logger changes.
The QXmppSslServer class represents an SSL-enabled TCP server.
Definition: QXmppServer.h:130
void newConnection(QSslSocket *socket)
This signal is emitted when a new connection is established.
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:91
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:42