AusweisApp2
DiagnosisFirewallDetection.h
gehe zur Dokumentation dieser Datei
1 
5 #pragma once
6 
7 #include <QObject>
8 #include <QSharedPointer>
9 #include <QVector>
10 
11 #if defined(Q_OS_WIN)
12  #include <QProcess>
13 #endif
14 
15 class test_DiagnosisFirewallDetection;
16 
17 namespace governikus
18 {
19 
21 {
22  private:
23  const QString mName;
24  const bool mEnabled;
25 
26  public:
27  FirewallProfile(const QString& pName, bool pEnabled);
28 
29  [[nodiscard]] const QString& getName() const
30  {
31  return mName;
32  }
33 
34 
35  [[nodiscard]] bool getEnabled() const
36  {
37  return mEnabled;
38  }
39 
40 
41 };
42 
44 {
45  private:
46  QString mName;
47  bool mEnabled;
48  bool mUpToDate;
49 
50  public:
51  FirewallSoftware(const QString& pName, bool pEnabled, bool pUpToDate);
52 
53  [[nodiscard]] const QString& getName() const
54  {
55  return mName;
56  }
57 
58 
59  [[nodiscard]] bool getEnabled() const
60  {
61  return mEnabled;
62  }
63 
64 
65  [[nodiscard]] bool getUpToDate() const
66  {
67  return mUpToDate;
68  }
69 
70 
71 };
72 
74  : public QObject
75 {
76  Q_OBJECT
77  friend class ::test_DiagnosisFirewallDetection;
78 
79  private:
80  bool mFirstFirewallRuleExists;
81  bool mFirstFirewallRuleEnabled;
82  bool mSecondFirewallRuleExists;
83  bool mSecondFirewallRuleEnabled;
84  QVector<QSharedPointer<FirewallSoftware>> mDetectedFirewalls;
85  QVector<QSharedPointer<FirewallProfile>> mFirewallProfiles;
86 
87  bool mFirstRuleDone;
88  bool mSecondRuleDone;
89  bool mProfilesDone;
90  bool mInstalledFirewallsDone;
91 
92 #if defined(Q_OS_WIN)
93  QProcess mFirewallFirstRuleProcess;
94  QProcess mFirewallSecondRuleProcess;
95  QProcess mFirewallProfilesProcess;
96  QProcess mInstalledFirewallSoftwareProcess;
97 
98  void checkIfAllInformationReady();
99  void parseFirewallFirstRuleInfos(const QString& pFirewallFirstRuleInfos);
100  void parseFirewallSecondRuleInfos(const QString& pFirewallSecondRuleInfos);
101  void parseFirewallProfileInfos(const QString& pFirewallProfileInfos);
102  void parseFirewallSoftwareInfos(const QString& pFirewallSoftwareInfos);
103 
104  private Q_SLOTS:
105  void onFirstRuleDone(int exitCode, QProcess::ExitStatus exitStatus);
106  void onFirstRuleError(QProcess::ProcessError pError);
107  void onSecondRuleDone(int exitCode, QProcess::ExitStatus exitStatus);
108  void onSecondRuleError(QProcess::ProcessError pError);
109  void onProfilesDone(int exitCode, QProcess::ExitStatus exitStatus);
110  void onProfilesError(QProcess::ProcessError pError);
111  void onInstalledFirewallSoftwareDone(int exitCode, QProcess::ExitStatus exitStatus);
112  void onInstalledFirewallSoftwareError(QProcess::ProcessError pError);
113 #endif
114 
115  public:
117  void startDetection();
118 
119  [[nodiscard]] bool getFirstRuleExists() const
120  {
121  return mFirstFirewallRuleExists;
122  }
123 
124 
125  [[nodiscard]] bool getFirstRuleEnabled() const
126  {
127  return mFirstFirewallRuleEnabled;
128  }
129 
130 
131  [[nodiscard]] bool getSecondRuleExists() const
132  {
133  return mSecondFirewallRuleExists;
134  }
135 
136 
137  [[nodiscard]] bool getSecondRuleEnabled() const
138  {
139  return mSecondFirewallRuleEnabled;
140  }
141 
142 
143  [[nodiscard]] const QVector<QSharedPointer<FirewallProfile>>& getFirewallProfiles() const
144  {
145  return mFirewallProfiles;
146  }
147 
148 
149  [[nodiscard]] const QVector<QSharedPointer<FirewallSoftware>>& getDetectedFirewalls() const
150  {
151  return mDetectedFirewalls;
152  }
153 
154  Q_SIGNALS:
157 };
158 
159 
160 } // namespace governikus
Definition: DiagnosisFirewallDetection.h:75
void startDetection()
Definition: DiagnosisFirewallDetection.cpp:308
bool getFirstRuleEnabled() const
Definition: DiagnosisFirewallDetection.h:125
const QVector< QSharedPointer< FirewallProfile > > & getFirewallProfiles() const
Definition: DiagnosisFirewallDetection.h:143
bool getSecondRuleEnabled() const
Definition: DiagnosisFirewallDetection.h:137
DiagnosisFirewallDetection()
Definition: DiagnosisFirewallDetection.cpp:286
bool getSecondRuleExists() const
Definition: DiagnosisFirewallDetection.h:131
const QVector< QSharedPointer< FirewallSoftware > > & getDetectedFirewalls() const
Definition: DiagnosisFirewallDetection.h:149
bool getFirstRuleExists() const
Definition: DiagnosisFirewallDetection.h:119
Definition: DiagnosisFirewallDetection.h:21
FirewallProfile(const QString &pName, bool pEnabled)
Definition: DiagnosisFirewallDetection.cpp:399
const QString & getName() const
Definition: DiagnosisFirewallDetection.h:29
bool getEnabled() const
Definition: DiagnosisFirewallDetection.h:35
Definition: DiagnosisFirewallDetection.h:44
FirewallSoftware(const QString &pName, bool pEnabled, bool pUpToDate)
Definition: DiagnosisFirewallDetection.cpp:391
bool getEnabled() const
Definition: DiagnosisFirewallDetection.h:59
const QString & getName() const
Definition: DiagnosisFirewallDetection.h:53
bool getUpToDate() const
Definition: DiagnosisFirewallDetection.h:65
A simple template renderer.
Definition: ActivationContext.h:15