aboutsummaryrefslogtreecommitdiff
path: root/src/QXmppServer.h
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-23 11:38:36 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-23 11:38:36 +0000
commit068cc630f6ef9a0d265b384ea7dc30011f757a9c (patch)
tree82f3d8b603fe97b951cb5bc840e4e5bd318bba18 /src/QXmppServer.h
parent07c7b8b93fd757810cb083aeb3bc0dc5142d2994 (diff)
downloadqxmpp-068cc630f6ef9a0d265b384ea7dc30011f757a9c.tar.gz
add a skeleton for QXmppServer
Diffstat (limited to 'src/QXmppServer.h')
-rw-r--r--src/QXmppServer.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/QXmppServer.h b/src/QXmppServer.h
new file mode 100644
index 00000000..0c686334
--- /dev/null
+++ b/src/QXmppServer.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008-2010 The QXmpp developers
+ *
+ * Author:
+ * Jeremy Lainé
+ *
+ * Source:
+ * http://code.google.com/p/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#ifndef QXMPPSERVER_H
+#define QXMPPSERVER_H
+
+#include <QTcpServer>
+
+class QDomElement;
+class QSslSocket;
+
+class QXmppDialback;
+class QXmppLogger;
+class QXmppOutgoingServer;
+class QXmppPasswordChecker;
+class QXmppServerPrivate;
+class QXmppStanza;
+class QXmppStream;
+
+/// \brief The QXmppServer class represents an XMPP server.
+///
+/// \ingroup Core
+
+class QXmppServer : public QObject
+{
+ Q_OBJECT
+
+public:
+ QXmppServer(QObject *parent = 0);
+ ~QXmppServer();
+
+ QString domain() const;
+ void setDomain(const QString &domain);
+
+ QXmppLogger *logger();
+ void setLogger(QXmppLogger *logger);
+
+ QXmppPasswordChecker *passwordChecker();
+ void setPasswordChecker(QXmppPasswordChecker *checker);
+
+ bool sendElement(const QDomElement &element);
+ bool sendPacket(const QXmppStanza &stanza);
+
+private slots:
+ void slotClientConnection(QSslSocket *socket);
+ void slotClientConnected();
+ void slotClientDisconnected();
+ void slotDialbackRequestReceived(const QXmppDialback &dialback);
+ void slotElementReceived(const QDomElement &element, bool &handled);
+ void slotServerConnection(QSslSocket *socket);
+
+protected:
+ QXmppOutgoingServer *connectToDomain(const QString &domain);
+ // overridable methods
+ virtual void handleStanza(QXmppStream *stream, const QDomElement &element) = 0;
+ virtual void updateStatistics() = 0;
+
+private:
+ QList<QXmppStream*> getStreams(const QString &to);
+ QXmppServerPrivate * const d;
+};
+
+class QXmppSslServerPrivate;
+
+/// \brief The QXmppSslServer class represents an SSL-enabled TCP server.
+///
+
+class QXmppSslServer : public QTcpServer
+{
+ Q_OBJECT
+
+public:
+ QXmppSslServer(QObject *parent = 0);
+ ~QXmppSslServer();
+
+ void addCaCertificates(const QString &caCertificates);
+ void setLocalCertificate(const QString &localCertificate);
+ void setPrivateKey(const QString &privateKey);
+
+signals:
+ void newConnection(QSslSocket *socket);
+
+private:
+ void incomingConnection(int socketDescriptor);
+ QXmppSslServerPrivate * const d;
+};
+
+#endif