Messagelib

createphishingurldatabasejob.h
1 /*
2  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QNetworkReply>
10 #include <QObject>
11 #include <QSslError>
12 
13 #include "webengineviewer_export.h"
14 namespace WebEngineViewer
15 {
16 struct UpdateDataBaseInfo;
17 class CreatePhishingUrlDataBaseJobPrivate;
18 /* https://developers.google.com/safe-browsing/v4/update-api */
19 /**
20  * @brief The CreatePhishingUrlDataBaseJob class
21  * @author Laurent Montel <[email protected]>
22  */
23 class WEBENGINEVIEWER_EXPORT CreatePhishingUrlDataBaseJob : public QObject
24 {
25  Q_OBJECT
26 public:
27  enum DataBaseDownloadType { FullDataBase = 0, UpdateDataBase = 1 };
28 
29  enum DataBaseDownloadResult { InvalidData = 0, ValidData = 1, UnknownError = 2, BrokenNetwork = 3 };
30 
31  enum ContraintsCompressionType { RawCompression = 0, RiceCompression = 1 };
32 
33  explicit CreatePhishingUrlDataBaseJob(QObject *parent = nullptr);
34  ~CreatePhishingUrlDataBaseJob() override;
35 
36  void start();
37 
38  void setDataBaseState(const QString &value);
39 
40  void setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadType type);
41 
42  Q_REQUIRED_RESULT QByteArray jsonRequest() const;
43 
44  void parseResult(const QByteArray &value);
45 
46  void setContraintsCompressionType(CreatePhishingUrlDataBaseJob::ContraintsCompressionType type);
47 
48 Q_SIGNALS:
49  void finished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase, WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status);
50  void debugJsonResult(const QByteArray &ba);
51  void debugJson(const QByteArray &ba);
52 
53 private:
54  void slotDownloadDataBaseFinished(QNetworkReply *reply);
55  void slotSslErrors(QNetworkReply *reply, const QList<QSslError> &error);
56  void slotError(QNetworkReply::NetworkError error);
57 
58  std::unique_ptr<CreatePhishingUrlDataBaseJobPrivate> const d;
59 };
60 }
61 Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadType)
62 Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult)
63 Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::ContraintsCompressionType)
PartitionTable::TableType type
The CreatePhishingUrlDataBaseJob class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:16:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.