File indexing completed on 2024-06-16 04:54:11

0001 /*
0002    Copyright (C) 2013 Christian Mollekopf <mollekopf@kolabsys.com>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #ifndef SSLSERVER_H
0020 #define SSLSERVER_H
0021 
0022 #include <QTcpServer>
0023 #include <QSslSocket>
0024 
0025 class SslServer: public QTcpServer
0026 {
0027     Q_OBJECT
0028 public:
0029     SslServer(QSsl::SslProtocol, bool startTls);
0030     virtual void incomingConnection(qintptr handle) Q_DECL_OVERRIDE;
0031 
0032 private Q_SLOTS:
0033     void sslErrors(const QList<QSslError> &errors);
0034     void error(QAbstractSocket::SocketError);
0035 
0036 private:
0037     QSsl::SslProtocol mProtocol;
0038     QSslSocket mSocket;
0039     const bool mStartTls;
0040 };
0041 
0042 #endif