NetworkManagerQt

vpnconnection.h
1 /*
2  SPDX-FileCopyrightText: 2011 Ilia Kats <[email protected]>
3  SPDX-FileCopyrightText: 2011-2013 Lamarque V. Souza <[email protected]>
4  SPDX-FileCopyrightText: 2013 Jan Grulich <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #ifndef NETWORKMANAGERQT_VPNCONNECTION_H
10 #define NETWORKMANAGERQT_VPNCONNECTION_H
11 
12 #include <networkmanagerqt/networkmanagerqt_export.h>
13 
14 #include "activeconnection.h"
15 
16 #include <QDBusObjectPath>
17 #include <QObject>
18 
19 namespace NetworkManager
20 {
21 class Device;
22 class VpnConnectionPrivate;
23 
24 /**
25  * An active VPN connection
26  */
27 class NETWORKMANAGERQT_EXPORT VpnConnection : public ActiveConnection
28 {
29  Q_OBJECT
30 
31 public:
33  typedef QList<Ptr> List;
34  /**
35  * Enum describing the possible VPN connection states
36  */
37  enum State {
38  Unknown = 0, /**< The state of the VPN connection is unknown. */
39  Prepare, /**< The VPN connection is preparing to connect. */
40  NeedAuth, /**< The VPN connection needs authorization credentials. */
41  Connecting, /**< The VPN connection is being established. */
42  GettingIpConfig, /**< The VPN connection is getting an IP address. */
43  Activated, /**< The VPN connection is active. */
44  Failed, /**< The VPN connection failed. */
45  Disconnected, /**< The VPN connection is disconnected. */
46  };
47  Q_ENUM(State)
48 
50  UnknownReason = 0, /**< The reason for the VPN connection state change is unknown.*/
51  NoneReason, /**< No reason was given for the VPN connection state change. */
52  UserDisconnectedReason, /**< The VPN connection changed state because the user disconnected it. */
53  DeviceDisconnectedReason, /**< The VPN connection changed state because the device it was using was disconnected. */
54  ServiceStoppedReason, /**< The service providing the VPN connection was stopped. */
55  IpConfigInvalidReason, /**< The IP config of the VPN connection was invalid. */
56  ConnectTimeoutReason, /**< The connection attempt to the VPN service timed out. */
57  ServiceStartTimeoutReason, /**< A timeout occurred while starting the service providing the VPN connection. */
58  ServiceStartFailedReason, /**< Starting the service starting the service providing the VPN connection failed. */
59  NoSecretsReason, /**< Necessary secrets for the VPN connection were not provided. */
60  LoginFailedReason, /**< Authentication to the VPN server failed. */
61  ConnectionRemovedReason, /**< The connection was deleted from settings. */
62  };
63  Q_ENUM(StateChangeReason)
64 
65  /**
66  * Creates a new VpnConnection object.
67  *
68  * @param path the DBus path of the device
69  */
70  explicit VpnConnection(const QString &path, QObject *parent = nullptr);
71  /**
72  * Destroys a VpnConnection object.
73  */
74  ~VpnConnection() override;
75  /**
76  * Return the current login banner
77  */
78  QString banner() const;
79  /**
80  * returns the current state
81  */
83  /**
84  * operator for casting an ActiveConnection into a VpnConnection. Returns 0 if this
85  * object is not a VPN connection. Introduced to make it possible to create a VpnConnection
86  * object for every active connection, without creating an ActiveConnection object, checking
87  * if it's a VPN connection, deleting the ActiveConnection and creating a VpnConnection
88  */
89  operator VpnConnection *();
90 
91 Q_SIGNALS:
92  /**
93  * This signal is emitted when the connection @p banner has changed
94  */
95  void bannerChanged(const QString &banner);
96  /**
97  * This signal is emitted when the VPN connection @p state has changed
98  */
100 
101 private:
102  Q_DECLARE_PRIVATE(VpnConnection)
103 };
104 
105 } // namespace NetworkManager
106 #endif // NETWORKMANAGERQT_VPNCONNECTION_H
@ ServiceStartFailedReason
Starting the service starting the service providing the VPN connection failed.
Definition: vpnconnection.h:58
@ NoSecretsReason
Necessary secrets for the VPN connection were not provided.
Definition: vpnconnection.h:59
@ LoginFailedReason
Authentication to the VPN server failed.
Definition: vpnconnection.h:60
@ ConnectionRemovedReason
The connection was deleted from settings.
Definition: vpnconnection.h:61
@ NeedAuth
The VPN connection needs authorization credentials.
Definition: vpnconnection.h:40
@ Failed
The VPN connection failed.
Definition: vpnconnection.h:44
@ GettingIpConfig
The VPN connection is getting an IP address.
Definition: vpnconnection.h:42
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition: accesspoint.h:20
@ UserDisconnectedReason
The VPN connection changed state because the user disconnected it.
Definition: vpnconnection.h:52
@ NoneReason
No reason was given for the VPN connection state change.
Definition: vpnconnection.h:51
@ Disconnected
The VPN connection is disconnected.
Definition: vpnconnection.h:45
An active VPN connection.
Definition: vpnconnection.h:27
@ ServiceStoppedReason
The service providing the VPN connection was stopped.
Definition: vpnconnection.h:54
@ Prepare
The VPN connection is preparing to connect.
Definition: vpnconnection.h:39
State
Enum describing the possible VPN connection states.
Definition: vpnconnection.h:37
@ ServiceStartTimeoutReason
A timeout occurred while starting the service providing the VPN connection.
Definition: vpnconnection.h:57
@ ConnectTimeoutReason
The connection attempt to the VPN service timed out.
Definition: vpnconnection.h:56
@ Unknown
the networking system is not active or unable to report its status - proceed with caution
Definition: manager.h:33
@ Activated
The VPN connection is active.
Definition: vpnconnection.h:43
@ Connecting
The VPN connection is being established.
Definition: vpnconnection.h:41
@ IpConfigInvalidReason
The IP config of the VPN connection was invalid.
Definition: vpnconnection.h:55
@ DeviceDisconnectedReason
The VPN connection changed state because the device it was using was disconnected.
Definition: vpnconnection.h:53
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 03:57:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.