NetworkManagerQt

connectionsettings.h
1/*
2 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
3 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef NETWORKMANAGERQT_CONNECTION_SETTINGS_H
9#define NETWORKMANAGERQT_CONNECTION_SETTINGS_H
10
11#include "setting.h"
12#include <networkmanagerqt/networkmanagerqt_export.h>
13
14#undef signals
15#include <libnm/NetworkManager.h>
16#define signals Q_SIGNALS
17
18#include <QDateTime>
19#include <QHash>
20#include <QString>
21
22namespace NetworkManager
23{
24class ConnectionSettingsPrivate;
25
26/**
27 * Represents collection of all connection settings
28 */
29class NETWORKMANAGERQT_EXPORT ConnectionSettings
30{
31 Q_ENUMS(ConnectionType)
32public:
34 typedef QList<Ptr> List;
35 enum ConnectionType {
36 Unknown = 0,
37 Adsl,
38 Bluetooth,
39 Bond,
40 Bridge,
41 Cdma,
42 Gsm,
43 Infiniband,
44 OLPCMesh,
45 Pppoe,
46 Vlan,
47 Vpn,
48 Wimax,
49 Wired,
50 Wireless,
51 Team,
52 Generic,
53 Tun,
54 IpTunnel,
55 WireGuard,
56 Loopback,
57 };
58
59 enum AutoconnectSlaves {
60 SlavesDefault = -1,
61 DoNotConnectSlaves = 0,
62 ConnectAllSlaves = 1,
63 };
64
65 enum Lldp {
66 LldpDefault = -1,
67 LldpDisable = 0,
68 LldpEnableRx = 1,
69 };
70
71 // FIXME same enum as in device.h, unfortunately it's not possible to use that one
72 // maybe in future move all enums into one header so they can be used across all classes
73 enum Metered {
74 MeteredUnknown = 0,
75 MeteredYes = 1,
76 MeteredNo = 2,
77 MeteredGuessYes = 3,
78 MeteredGuessNo = 4,
79 };
80
81 enum Mdns {
82 MdnsDefault = -1,
83 MdnsNo = 0,
84 MdnsResolve = 1,
85 MdnsResolveAndRespond = 2
86 };
87
88 static ConnectionType typeFromString(const QString &typeString);
89 static QString typeAsString(const ConnectionType type);
90 static QString createNewUuid();
91
93 explicit ConnectionSettings(ConnectionType type, NMBluetoothCapabilities bt_cap = NM_BT_CAPABILITY_DUN);
94 explicit ConnectionSettings(const ConnectionSettings::Ptr &other);
95 explicit ConnectionSettings(const NMVariantMapMap &map);
96 virtual ~ConnectionSettings();
97
98 QString name() const;
99
100 void fromMap(const NMVariantMapMap &map);
101 void fromMeCard(const QVariantMap &map);
102
103 NMVariantMapMap toMap() const;
104
105 void setId(const QString &id);
106 QString id() const;
107
108 void setUuid(const QString &uuid);
109 QString uuid() const;
110
111 void setInterfaceName(const QString &interfaceName);
112 QString interfaceName() const;
113
114 void setConnectionType(ConnectionType type, NMBluetoothCapabilities bt_cap = NM_BT_CAPABILITY_DUN);
115 ConnectionType connectionType() const;
116
117 void addToPermissions(const QString &user, const QString &type);
118 void setPermissions(const QHash<QString, QString> &perm);
119 QHash<QString, QString> permissions() const;
120
121 void setAutoconnect(bool autoconnect);
122 bool autoconnect() const;
123
124 void setAutoconnectPriority(int priority);
125 int autoconnectPriority() const;
126
127 void setTimestamp(const QDateTime &timestamp);
128 QDateTime timestamp() const;
129
130 void setReadOnly(bool readonly);
131 bool readOnly() const;
132
133 void setZone(const QString &zone);
134 QString zone() const;
135
136 bool isSlave() const;
137
138 void setMaster(const QString &master);
139 QString master() const;
140
141 void setSlaveType(const QString &type);
142 QString slaveType() const;
143
144 void setSecondaries(const QStringList &secondaries);
145 QStringList secondaries() const;
146
147 void setGatewayPingTimeout(quint32 timeout);
148 quint32 gatewayPingTimeout() const;
149
150 void setAutoconnectRetries(int retries);
151 int autoconnectRetries() const;
152
153 void setAutoconnectSlaves(AutoconnectSlaves autoconnectSlaves);
154 AutoconnectSlaves autoconnectSlaves() const;
155
156 void setLldp(Lldp lldp);
157 Lldp lldp() const;
158
159 void setMetered(Metered metered);
160 Metered metered() const;
161
162 void setMdns(Mdns mdns);
163 Mdns mdns() const;
164
165 void setStableId(const QString &stableId);
166 QString stableId() const;
167
168 Setting::Ptr setting(Setting::SettingType type) const;
169 Setting::Ptr setting(const QString &type) const;
170
171 Setting::List settings() const;
172
173protected:
174 ConnectionSettingsPrivate *d_ptr;
175
176private:
177 Q_DECLARE_PRIVATE(ConnectionSettings)
178};
179
180NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const ConnectionSettings &setting);
181
182}
183
184#endif // NETWORKMANAGERQT_CONNECTION_SETTINGS_H
Represents collection of all connection settings.
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
NETWORKMANAGERQT_EXPORT NetworkManager::Device::MeteredStatus metered()
Definition manager.cpp:1160
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.