1/*
2 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef NETWORKMANAGERQT_IPV6_SETTING_H
8#define NETWORKMANAGERQT_IPV6_SETTING_H
9
10#include "ipconfig.h"
11#include "setting.h"
12#include <networkmanagerqt/networkmanagerqt_export.h>
13
14#include <QHostAddress>
15#include <QStringList>
16
17#define NMQT_SETTING_IP6_CONFIG_SETTING_NAME NM_SETTING_IP6_CONFIG_SETTING_NAME
18#define NMQT_SETTING_IP6_CONFIG_METHOD NM_SETTING_IP_CONFIG_METHOD
19#define NMQT_SETTING_IP6_CONFIG_DNS NM_SETTING_IP_CONFIG_DNS
20#define NMQT_SETTING_IP6_CONFIG_DNS_SEARCH NM_SETTING_IP_CONFIG_DNS_SEARCH
21#define NMQT_SETTING_IP6_CONFIG_ADDRESSES NM_SETTING_IP_CONFIG_ADDRESSES
22#define NMQT_SETTING_IP6_CONFIG_GATEWAY NM_SETTING_IP_CONFIG_GATEWAY
23#define NMQT_SETTING_IP6_CONFIG_ROUTES NM_SETTING_IP_CONFIG_ROUTES
24#define NMQT_SETTING_IP6_CONFIG_ROUTE_METRIC NM_SETTING_IP_CONFIG_ROUTE_METRIC
25#define NMQT_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES
26#define NMQT_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS
27#define NMQT_SETTING_IP6_CONFIG_DHCP_HOSTNAME NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
28#define NMQT_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME
29#define NMQT_SETTING_IP6_CONFIG_NEVER_DEFAULT NM_SETTING_IP_CONFIG_NEVER_DEFAULT
30#define NMQT_SETTING_IP6_CONFIG_MAY_FAIL NM_SETTING_IP_CONFIG_MAY_FAIL
31#define NMQT_SETTING_IP6_CONFIG_DHCP_CLIENT_ID NM_SETTING_IP6_CONFIG_DHCP_CLIENT_ID
32#define NMQT_SETTING_IP6_CONFIG_IP6_PRIVACY NM_SETTING_IP6_CONFIG_IP6_PRIVACY
33#define NMQT_SETTING_IP6_CONFIG_METHOD_IGNORE NM_SETTING_IP6_CONFIG_METHOD_IGNORE
34#define NMQT_SETTING_IP6_CONFIG_METHOD_AUTO NM_SETTING_IP6_CONFIG_METHOD_AUTO
35#define NMQT_SETTING_IP6_CONFIG_METHOD_DHCP NM_SETTING_IP6_CONFIG_METHOD_DHCP
36#define NMQT_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL
37#define NMQT_SETTING_IP6_CONFIG_METHOD_MANUAL NM_SETTING_IP6_CONFIG_METHOD_MANUAL
38#define NMQT_SETTING_IP6_CONFIG_METHOD_SHARED NM_SETTING_IP6_CONFIG_METHOD_SHARED
39#if NM_CHECK_VERSION(1, 20, 0)
40#define NMQT_SETTING_IP6_CONFIG_METHOD_DISABLED NM_SETTING_IP6_CONFIG_METHOD_DISABLED
41#else
42#define NMQT_SETTING_IP6_CONFIG_METHOD_DISABLED "disabled"
43#endif
44#define NMQT_SETTING_IP6_CONFIG_DAD_TIMEOUT NM_SETTING_IP_CONFIG_DAD_TIMEOUT
45#define NMQT_SETTING_IP6_CONFIG_DHCP_TIMEOUT NM_SETTING_IP_CONFIG_DHCP_TIMEOUT
46#define NMQT_SETTING_IP6_CONFIG_DHCP_HOSTNAME NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
47#define NMQT_SETTING_IP6_CONFIG_ADDRESS_GEN_MODE NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE
48#if NM_CHECK_VERSION(1, 12, 0)
49#define NMQT_SETTING_IP6_CONFIG_DHCP_DUID NM_SETTING_IP6_CONFIG_DHCP_DUID
50#else
51#define NMQT_SETTING_IP6_CONFIG_DHCP_DUID "dhcp-duid"
52#endif
53#define NMQT_SETTING_IP6_CONFIG_TOKEN NM_SETTING_IP6_CONFIG_TOKEN
54#define NMQT_SETTING_IP6_CONFIG_DNS_OPTIONS NM_SETTING_IP_CONFIG_DNS_OPTIONS
55#define NMQT_SETTING_IP6_CONFIG_ROUTE_DATA "route-data"
56#define NMQT_SETTING_IP6_CONFIG_ADDRESS_DATA "address-data"
57#if NM_CHECK_VERSION(1, 10, 0)
58#define NMQT_SETTING_IP6_CONFIG_ROUTE_TABLE NM_SETTING_IP_CONFIG_ROUTE_TABLE
59#else
60#define NMQT_SETTING_IP6_CONFIG_ROUTE_TABLE "route-table"
61#endif
62
63namespace NetworkManager
64{
65class Ipv6SettingPrivate;
66
67/**
68 * Represents ipv6 setting
69 */
70class NETWORKMANAGERQT_EXPORT Ipv6Setting : public Setting
71{
72public:
73 typedef QSharedPointer<Ipv6Setting> Ptr;
74 typedef QList<Ptr> List;
75 enum ConfigMethod {
76 Automatic,
77 Dhcp,
78 LinkLocal,
79 Manual,
80 Ignored,
81 ConfigDisabled // FIXME KF6: fix enum naming (possibly move to enum class)
82 };
83 enum IPv6Privacy {
84 Unknown = -1,
85 Disabled,
86 PreferPublic,
87 PreferTemporary,
88 };
89 enum IPv6AddressGenMode {
90 Eui64,
91 StablePrivacy,
92 };
93
94 Ipv6Setting();
95 explicit Ipv6Setting(const Ptr &other);
96 ~Ipv6Setting() override;
97
98 QString name() const override;
99
100 void setMethod(ConfigMethod method);
101 ConfigMethod method() const;
102
103 void setDns(const QList<QHostAddress> &dns);
104 QList<QHostAddress> dns() const;
105
106 void setDnsSearch(const QStringList &domains);
107 QStringList dnsSearch() const;
108
109 void setAddresses(const QList<NetworkManager::IpAddress> ipv6addresses);
110 QList<NetworkManager::IpAddress> addresses() const;
111
112 void setRoutes(const QList<NetworkManager::IpRoute> ipv6routes);
113 QList<NetworkManager::IpRoute> routes() const;
114
115 void setRouteMetric(int metric);
116 int routeMetric() const;
117
118 void setIgnoreAutoRoutes(bool ignore);
119 bool ignoreAutoRoutes() const;
120
121 void setIgnoreAutoDns(bool ignore);
122 bool ignoreAutoDns() const;
123
124 void setNeverDefault(bool neverDefault);
125 bool neverDefault() const;
126
127 void setMayFail(bool mayFail);
128 bool mayFail() const;
129
130 void setPrivacy(IPv6Privacy privacy);
131 IPv6Privacy privacy() const;
132
133 void fromMap(const QVariantMap &setting) override;
134
135 QVariantMap toMap() const override;
136
137 void setDadTimeout(qint32 timeout);
138 qint32 dadTimeout() const;
139
140 void setAddressGenMode(IPv6AddressGenMode mode);
141 IPv6AddressGenMode addressGenMode() const;
142
143 void setDhcpTimeout(qint32 timeout);
144 qint32 dhcpTimeout() const;
145
146 void setDhcpHostname(const QString &hostname);
147 QString dhcpHostname() const;
148
149 void setDhcpDuid(const QString &duid);
150 QString dhcpDuid() const;
151
152 void setToken(const QString &token);
153 QString token() const;
154
155 void setDnsOptions(const QStringList &options);
156 QStringList dnsOptions() const;
157
158 void setAddressData(const NMVariantMapList &addressData);
159 NMVariantMapList addressData() const;
160
161 void setRouteData(const NMVariantMapList &routeData);
162 NMVariantMapList routeData() const;
163
164 void setRouteTable(quint32 routeTable);
165 quint32 routeTable() const;
166
167protected:
168 Ipv6SettingPrivate *const d_ptr;
169
170private:
171 Q_DECLARE_PRIVATE(Ipv6Setting)
172};
173
174NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const Ipv6Setting &setting);
175
176}
177
178#endif // NETWORKMANAGERQT_IPV6_SETTING_H
179

source code of networkmanager-qt/src/settings/ipv6setting.h