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 
16 namespace governikus
17 {
18 
20 {
21  private:
22  const QString mName;
23  const bool mEnabled;
24 
25  public:
26  FirewallProfile(const QString& pName, bool pEnabled);
27 
28  [[nodiscard]] const QString& getName() const
29  {
30  return mName;
31  }
32 
33 
34  [[nodiscard]] bool getEnabled() const
35  {
36  return mEnabled;
37  }
38 
39 
40 };
41 
43 {
44  private:
45  QString mName;
46  bool mEnabled;
47  bool mUpToDate;
48 
49  public:
50  FirewallSoftware(const QString& pName, bool pEnabled, bool pUpToDate);
51 
52  [[nodiscard]] const QString& getName() const
53  {
54  return mName;
55  }
56 
57 
58  [[nodiscard]] bool getEnabled() const
59  {
60  return mEnabled;
61  }
62 
63 
64  [[nodiscard]] bool getUpToDate() const
65  {
66  return mUpToDate;
67  }
68 
69 
70 };
71 
73  : public QObject
74 {
75  Q_OBJECT
76 
77  private:
78  bool mFirstFirewallRuleExists;
79  bool mFirstFirewallRuleEnabled;
80  bool mSecondFirewallRuleExists;
81  bool mSecondFirewallRuleEnabled;
82  QVector<QSharedPointer<FirewallSoftware>> mDetectedFirewalls;
83  QVector<QSharedPointer<FirewallProfile>> mFirewallProfiles;
84 
85  bool mFirstRuleDone;
86  bool mSecondRuleDone;
87  bool mProfilesDone;
88  bool mInstalledFirewallsDone;
89 
90 #if defined(Q_OS_WIN)
91  QProcess mFirewallFirstRuleProcess;
92  QProcess mFirewallSecondRuleProcess;
93  QProcess mFirewallProfilesProcess;
94  QProcess mInstalledFirewallSoftwareProcess;
95 
96  void checkIfAllInformationReady();
97 
98  private Q_SLOTS:
99  void onFirstRuleDone(int exitCode, QProcess::ExitStatus exitStatus);
100  void onFirstRuleError(QProcess::ProcessError pError);
101  void onSecondRuleDone(int exitCode, QProcess::ExitStatus exitStatus);
102  void onSecondRuleError(QProcess::ProcessError pError);
103  void onProfilesDone(int exitCode, QProcess::ExitStatus exitStatus);
104  void onProfilesError(QProcess::ProcessError pError);
105  void onInstalledFirewallSoftwareDone(int exitCode, QProcess::ExitStatus exitStatus);
106  void onInstalledFirewallSoftwareError(QProcess::ProcessError pError);
107 #endif
108 
109  public:
111  void startDetection();
112 
113  [[nodiscard]] bool getFirstRuleExists() const
114  {
115  return mFirstFirewallRuleExists;
116  }
117 
118 
119  [[nodiscard]] bool getFirstRuleEnabled() const
120  {
121  return mFirstFirewallRuleEnabled;
122  }
123 
124 
125  [[nodiscard]] bool getSecondRuleExists() const
126  {
127  return mSecondFirewallRuleExists;
128  }
129 
130 
131  [[nodiscard]] bool getSecondRuleEnabled() const
132  {
133  return mSecondFirewallRuleEnabled;
134  }
135 
136 
137  [[nodiscard]] const QVector<QSharedPointer<FirewallProfile>>& getFirewallProfiles() const
138  {
139  return mFirewallProfiles;
140  }
141 
142 
143  [[nodiscard]] const QVector<QSharedPointer<FirewallSoftware>>& getDetectedFirewalls() const
144  {
145  return mDetectedFirewalls;
146  }
147 
148  Q_SIGNALS:
150  void fireDetectionFailed();
151 };
152 
153 
154 } // namespace governikus
void startDetection()
Definition: DiagnosisFirewallDetection.cpp:286
bool getFirstRuleEnabled() const
Definition: DiagnosisFirewallDetection.h:119
bool getFirstRuleExists() const
Definition: DiagnosisFirewallDetection.h:113
Definition: DiagnosisFirewallDetection.h:42
FirewallSoftware(const QString &pName, bool pEnabled, bool pUpToDate)
Definition: DiagnosisFirewallDetection.cpp:369
DiagnosisFirewallDetection()
Definition: DiagnosisFirewallDetection.cpp:264
Definition: DiagnosisFirewallDetection.h:72
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:14
bool getSecondRuleEnabled() const
Definition: DiagnosisFirewallDetection.h:131
bool getEnabled() const
Definition: DiagnosisFirewallDetection.h:58
bool getUpToDate() const
Definition: DiagnosisFirewallDetection.h:64
const QString & getName() const
Definition: DiagnosisFirewallDetection.h:28
const QString & getName() const
Definition: DiagnosisFirewallDetection.h:52
const QVector< QSharedPointer< FirewallProfile > > & getFirewallProfiles() const
Definition: DiagnosisFirewallDetection.h:137
Definition: DiagnosisFirewallDetection.h:19
const QVector< QSharedPointer< FirewallSoftware > > & getDetectedFirewalls() const
Definition: DiagnosisFirewallDetection.h:143
FirewallProfile(const QString &pName, bool pEnabled)
Definition: DiagnosisFirewallDetection.cpp:377
bool getEnabled() const
Definition: DiagnosisFirewallDetection.h:34
bool getSecondRuleExists() const
Definition: DiagnosisFirewallDetection.h:125