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 * \class NetworkManager::IpConfig
26 * \inheaderfile NetworkManagerQt/IpConfig
27 * \inmodule NetworkManagerQt
28 *
29 * \brief This class represents IP configuration.
30 */
31class NETWORKMANAGERQT_EXPORT IpConfig
32{
33public:
34 /*!
35 * Constructs an IP config object with a list of \a addresses, \a nameservers, \a domains and \a routes.
36 */
37 IpConfig(const IpAddresses &addresses, const QList<QHostAddress> &nameservers, const QStringList &domains, const IpRoutes &routes);
38
39 /*!
40 * Constructs an empty IpConfig object.
41 */
42 IpConfig();
43
44 /*!
45 * Destroys this IpConfig object.
46 */
47 ~IpConfig();
48
49 /*!
50 * Constructs an IpConfig object that is a copy of the object \a other.
51 */
52 IpConfig(const IpConfig &other);
53
54 /*!
55 * Configure this class using the information on the following \a path
56 */
57 void setIPv4Path(const QString &path);
58
59 /*!
60 * Configure this class using the information on the following \a path
61 */
62 void setIPv6Path(const QString &path);
63
64 /*!
65 * Returns a list of IP addresses and gateway related to this configuration.
66 * Use IpAddress::ip() to access the IP address and IpAddress::gateway()
67 * to access the gateway address.
68 */
69 NetworkManager::IpAddresses addresses() const;
70
71 /*!
72 * Returns a list of domains related to this configuration.
73 */
74 QStringList domains() const;
75
76 /*!
77 * Returns the gateway in use
78 *
79 * \since 0.9.9.0
80 */
81 QString gateway() const;
82
83 /*!
84 * Returns a list of nameservers related to this configuration.
85 */
86 QList<QHostAddress> nameservers() const;
87
88 /*!
89 * Returns a list of static routes (not the default gateway) related to this configuration.
90 * Use \ addresses() to retrieve the default gateway.
91 */
92 IpRoutes routes() const;
93
94 /*!
95 * Returns a list of DNS searches.
96 *
97 * \since 0.9.9.0
98 */
99 QStringList searches() const;
100
101 /*!
102 * Returns a list of DNS options that modify the behaviour of the DNS resolver.
103 * \since 5.14.0
104 */
105 QStringList dnsOptions() const;
106
107 /*!
108 * Makes a copy of the IpConfig object \a other.
109 */
110 IpConfig &operator=(const IpConfig &other);
111
112 /*!
113 * Returns false if the list of IP addresses is empty
114 */
115 bool isValid() const;
116
117private:
118 class Private;
119 Private *const d;
120};
121
122} // namespace NetworkManager
123
124#endif // NETWORKMANAGERQT_IPCONFIG_H
125

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