File indexing completed on 2024-05-12 04:58:53

0001 /**
0002  * SPDX-FileCopyrightText: 2015 Vineet Garg <grg.vineet@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef KDECONNECT_SERVER_H
0008 #define KDECONNECT_SERVER_H
0009 
0010 #include <QSslSocket>
0011 #include <QTcpServer>
0012 
0013 #include "kdeconnectcore_export.h"
0014 
0015 // This class overrides QTcpServer to bind QSslSocket to native socket descriptor instead of QTcpSocket
0016 class KDECONNECTCORE_EXPORT Server : public QTcpServer
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     Server(QObject *parent = nullptr);
0022 
0023     QSslSocket *nextPendingConnection() override;
0024     void close();
0025 
0026 Q_SIGNALS:
0027     void closed();
0028 
0029 protected:
0030     void incomingConnection(qintptr socketDescriptor) override;
0031 
0032 private:
0033     void errorFound(QAbstractSocket::SocketError socketError);
0034 };
0035 
0036 #endif // KDECONNECT_SERVER_H