NetworkManagerQt

ipv4setting.h
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_IPV4_SETTING_H
8#define NETWORKMANAGERQT_IPV4_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_IP4_CONFIG_SETTING_NAME NM_SETTING_IP4_CONFIG_SETTING_NAME
18#define NMQT_SETTING_IP4_CONFIG_METHOD NM_SETTING_IP_CONFIG_METHOD
19#define NMQT_SETTING_IP4_CONFIG_DNS NM_SETTING_IP_CONFIG_DNS
20#define NMQT_SETTING_IP4_CONFIG_DNS_SEARCH NM_SETTING_IP_CONFIG_DNS_SEARCH
21#define NMQT_SETTING_IP4_CONFIG_ADDRESSES NM_SETTING_IP_CONFIG_ADDRESSES
22#define NMQT_SETTING_IP4_CONFIG_GATEWAY NM_SETTING_IP_CONFIG_GATEWAY
23#define NMQT_SETTING_IP4_CONFIG_ROUTES NM_SETTING_IP_CONFIG_ROUTES
24#define NMQT_SETTING_IP4_CONFIG_ROUTE_METRIC NM_SETTING_IP_CONFIG_ROUTE_METRIC
25#define NMQT_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES
26#define NMQT_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS
27#define NMQT_SETTING_IP4_CONFIG_DHCP_HOSTNAME NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
28#define NMQT_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME
29#define NMQT_SETTING_IP4_CONFIG_NEVER_DEFAULT NM_SETTING_IP_CONFIG_NEVER_DEFAULT
30#define NMQT_SETTING_IP4_CONFIG_MAY_FAIL NM_SETTING_IP_CONFIG_MAY_FAIL
31#define NMQT_SETTING_IP4_CONFIG_DHCP_CLIENT_ID NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID
32#define NMQT_SETTING_IP4_CONFIG_METHOD_AUTO NM_SETTING_IP4_CONFIG_METHOD_AUTO
33#define NMQT_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL
34#define NMQT_SETTING_IP4_CONFIG_METHOD_MANUAL NM_SETTING_IP4_CONFIG_METHOD_MANUAL
35#define NMQT_SETTING_IP4_CONFIG_METHOD_SHARED NM_SETTING_IP4_CONFIG_METHOD_SHARED
36#define NMQT_SETTING_IP4_CONFIG_METHOD_DISABLED NM_SETTING_IP4_CONFIG_METHOD_DISABLED
37#define NMQT_SETTING_IP4_CONFIG_DAD_TIMEOUT NM_SETTING_IP_CONFIG_DAD_TIMEOUT
38#define NMQT_SETTING_IP4_CONFIG_DHCP_FQDN NM_SETTING_IP4_CONFIG_DHCP_FQDN
39#define NMQT_SETTING_IP4_CONFIG_DNS_OPTIONS NM_SETTING_IP_CONFIG_DNS_OPTIONS
40#define NMQT_SETTING_IP4_CONFIG_DNS_PRIORITY NM_SETTING_IP_CONFIG_DNS_PRIORITY
41#define NMQT_SETTING_IP4_CONFIG_GATEWAY NM_SETTING_IP_CONFIG_GATEWAY
42#define NMQT_SETTING_IP4_CONFIG_ROUTE_DATA "route-data"
43#define NMQT_SETTING_IP4_CONFIG_ADDRESS_DATA "address-data"
44
45namespace NetworkManager
46{
47class Ipv4SettingPrivate;
48
49/**
50 * Represents ipv4 setting
51 */
52class NETWORKMANAGERQT_EXPORT Ipv4Setting : public Setting
53{
54public:
56 typedef QList<Ptr> List;
57 enum ConfigMethod {
58 Automatic,
59 LinkLocal,
60 Manual,
61 Shared,
62 Disabled,
63 };
64
65 Ipv4Setting();
66 explicit Ipv4Setting(const Ptr &other);
67 ~Ipv4Setting() override;
68
69 QString name() const override;
70
71 void setMethod(ConfigMethod method);
72 ConfigMethod method() const;
73
74 void setDns(const QList<QHostAddress> &dns);
75 QList<QHostAddress> dns() const;
76
77 void setDnsSearch(const QStringList &domains);
78 QStringList dnsSearch() const;
79
80 void setAddresses(const QList<NetworkManager::IpAddress> &ipv4addresses);
81 QList<NetworkManager::IpAddress> addresses() const;
82
83 void setRoutes(const QList<NetworkManager::IpRoute> &ipv4routes);
84 QList<NetworkManager::IpRoute> routes() const;
85
86 void setRouteMetric(int metric);
87 int routeMetric() const;
88
89 void setIgnoreAutoRoutes(bool ignore);
90 bool ignoreAutoRoutes() const;
91
92 void setIgnoreAutoDns(bool ignore);
93 bool ignoreAutoDns() const;
94
95 void setDhcpClientId(const QString &id);
96 QString dhcpClientId() const;
97
98 void setDhcpSendHostname(bool send);
99 bool dhcpSendHostname() const;
100
101 void setDhcpHostname(const QString &hostname);
102 QString dhcpHostname() const;
103
104 void setNeverDefault(bool neverDefault);
105 bool neverDefault() const;
106
107 void setMayFail(bool mayFail);
108 bool mayFail() const;
109
110 void setDadTimeout(qint32 timeout);
111 qint32 dadTimeout() const;
112
113 void setDhcpFqdn(const QString &fqdn);
114 QString dhcpFqdn() const;
115
116 void setDnsOptions(const QStringList &options);
117 QStringList dnsOptions() const;
118
119 void setDnsPriority(qint32 priority);
120 qint32 dnsPriority() const;
121
122 void setGateway(const QString &gateway);
123 QString gateway() const;
124
125 void setAddressData(const NMVariantMapList &addressData);
126 NMVariantMapList addressData() const;
127
128 void setRouteData(const NMVariantMapList &routeData);
129 NMVariantMapList routeData() const;
130
131 void fromMap(const QVariantMap &setting) override;
132
133 QVariantMap toMap() const override;
134
135protected:
136 Ipv4SettingPrivate *d_ptr;
137
138private:
139 Q_DECLARE_PRIVATE(Ipv4Setting)
140};
141
142NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const Ipv4Setting &setting);
143
144}
145
146#endif // NETWORKMANAGERQT_IPV4_SETTING_H
Represents ipv4 setting.
Definition ipv4setting.h:53
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
NETWORKMANAGERQT_EXPORT QString hostname()
Returns hostname of the machine.
Definition settings.cpp:260
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:19 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.