1/*
2 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org>
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_IPCONFIG_H
9#define NETWORKMANAGERQT_IPCONFIG_H
10
11#include "ipaddress.h"
12#include "iproute.h"
13#include <networkmanagerqt/networkmanagerqt_export.h>
14
15// To prevent signals in glib2 be defined by QT
16#undef signals
17#include <libnm/NetworkManager.h>
18#define signals Q_SIGNALS
19
20#include <QStringList>
21
22namespace NetworkManager
23{
24/**
25 * This class represents IP configuration
26 */
27class NETWORKMANAGERQT_EXPORT IpConfig
28{
29public:
30 /**
31 * Constructs an IP config object with a list of @p addresses, @p nameservers, @p domains and @p routes.
32 */
33 IpConfig(const IpAddresses &addresses, const QList<QHostAddress> &nameservers, const QStringList &domains, const IpRoutes &routes);
34
35 /**
36 * Constructs an empty IpConfig object.
37 */
38 IpConfig();
39
40 /**
41 * Destroys this IpConfig object.
42 */
43 ~IpConfig();
44
45 /**
46 * Constructs an IpConfig object that is a copy of the object @p other.
47 */
48 IpConfig(const IpConfig &other);
49
50 /**
51 * Configure this class using the information on the following @p path
52 */
53 void setIPv4Path(const QString &path);
54
55 /**
56 * Configure this class using the information on the following @p path
57 */
58 void setIPv6Path(const QString &path);
59
60 /**
61 * Returns a list of IP addresses and gateway related to this configuration.
62 * Use IpAddress::ip() to access the IP address and IpAddress::gateway()
63 * to access the gateway address.
64 */
65 NetworkManager::IpAddresses addresses() const;
66
67 /**
68 * Returns a list of domains related to this configuration.
69 */
70 QStringList domains() const;
71
72 /**
73 * Returns the gateway in use
74 *
75 * @since 0.9.9.0
76 */
77 QString gateway() const;
78
79 /**
80 * Returns a list of nameservers related to this configuration.
81 */
82 QList<QHostAddress> nameservers() const;
83
84 /**
85 * Returns a list of static routes (not the default gateway) related to this configuration.
86 * Use @ref addresses() to retrieve the default gateway.
87 */
88 IpRoutes routes() const;
89
90 /**
91 * Returns a list of DNS searches.
92 *
93 * @since 0.9.9.0
94 */
95 QStringList searches() const;
96
97 /**
98 * Returns a list of DNS options that modify the behaviour of the DNS resolver.
99 * @since 5.14.0
100 */
101 QStringList dnsOptions() const;
102
103 /**
104 * Makes a copy of the IpConfig object @p other.
105 */
106 IpConfig &operator=(const IpConfig &other);
107
108 /**
109 * Returns false if the list of IP addresses is empty
110 */
111 bool isValid() const;
112
113private:
114 class Private;
115 Private *const d;
116};
117
118} // namespace NetworkManager
119
120#endif // NETWORKMANAGERQT_IPCONFIG_H
121

source code of networkmanager-qt/src/ipconfig.h