| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2017 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef FDRECEIVER_H |
| 8 | #define FDRECEIVER_H |
| 9 | |
| 10 | #include <QObject> |
| 11 | |
| 12 | class QSocketNotifier; |
| 13 | class FdReceiver : public QObject |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | |
| 17 | public: |
| 18 | explicit FdReceiver(const std::string &path, QObject *parent = nullptr); |
| 19 | ~FdReceiver() override; |
| 20 | |
| 21 | bool isListening() const; |
| 22 | int fileDescriptor() const; |
| 23 | |
| 24 | private: |
| 25 | Q_SLOT void receiveFileDescriptor(); |
| 26 | |
| 27 | QSocketNotifier *m_readNotifier; |
| 28 | std::string m_path; |
| 29 | int m_socketDes; |
| 30 | int m_fileDes; |
| 31 | }; |
| 32 | |
| 33 | #endif |
| 34 | |