1 /* 2 SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com> 3 SPDX-FileCopyrightText: 2015 Vyacheslav Matyushin 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #pragma once 9 10 #include "journaldAnalyzer.h" 11 #include "journaldTypes.h" 12 13 using namespace JournaldTypes; 14 15 #include <QNetworkAccessManager> 16 #include <QNetworkReply> 17 18 class JournaldNetworkAnalyzer : public JournaldAnalyzer 19 { 20 Q_OBJECT 21 22 public: 23 explicit JournaldNetworkAnalyzer(LogMode *mode, const JournaldAnalyzerOptions &options); 24 25 void watchLogFiles(bool enabled) override; 26 27 QStringList units() const override; 28 29 QStringList syslogIdentifiers() const override; 30 31 private Q_SLOTS: 32 void httpFinished(); 33 void httpReadyRead(); 34 void httpError(QNetworkReply::NetworkError code); 35 void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); 36 37 private: 38 enum class RequestType { SyslogIds, Units, EntriesFull, EntriesUpdate }; 39 40 void parseEntries(QByteArray &data, ReadingMode readingMode); 41 void sendRequest(RequestType requestType); 42 43 void updateStatus(const QString &status); 44 45 RequestType mCurrentRequest; 46 QString mBaseUrl; 47 QString mEntriesUrlFull; 48 QString mEntriesUrlUpdating; 49 QString mSyslogIdUrl; 50 QString mSystemdUnitsUrl; 51 52 QStringList mSyslogIdentifiers; 53 QStringList mSystemdUnits; 54 55 QNetworkAccessManager mNetworkManager; 56 QNetworkReply *mReply = nullptr; 57 QString mCursor; 58 JournalAddress mAddress; 59 QString mFilterName; 60 }; 61 62