1 | /* |
2 | SPDX-FileCopyrightText: 2018 Aleksander Morgado <aleksander@aleksander.es> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #include "ipconfig.h" |
8 | |
9 | #include <arpa/inet.h> |
10 | |
11 | #include "dnsdomain.h" |
12 | |
13 | namespace NetworkManager |
14 | { |
15 | class NetworkManager::DnsDomain::Private |
16 | { |
17 | public: |
18 | Private(const QString &theName, const QList<QHostAddress> &theServers, const QStringList &theOptions) |
19 | : name(theName) |
20 | , servers(theServers) |
21 | , options(theOptions) |
22 | { |
23 | } |
24 | Private() |
25 | { |
26 | } |
27 | QString name; |
28 | QList<QHostAddress> servers; |
29 | QStringList options; |
30 | }; |
31 | |
32 | } |
33 | |
34 | NetworkManager::DnsDomain::DnsDomain(const QString &name, const QList<QHostAddress> &servers, const QStringList &options) |
35 | : d(new Private(name, servers, options)) |
36 | { |
37 | } |
38 | |
39 | NetworkManager::DnsDomain::DnsDomain() |
40 | : d(new Private()) |
41 | { |
42 | } |
43 | |
44 | NetworkManager::DnsDomain::DnsDomain(const DnsDomain &other) |
45 | : d(new Private) |
46 | { |
47 | *this = other; |
48 | } |
49 | |
50 | NetworkManager::DnsDomain::~DnsDomain() |
51 | { |
52 | delete d; |
53 | } |
54 | |
55 | QString NetworkManager::DnsDomain::name() const |
56 | { |
57 | return d->name; |
58 | } |
59 | |
60 | void NetworkManager::DnsDomain::setName(const QString &name) |
61 | { |
62 | d->name = name; |
63 | } |
64 | |
65 | QList<QHostAddress> NetworkManager::DnsDomain::servers() const |
66 | { |
67 | return d->servers; |
68 | } |
69 | |
70 | void NetworkManager::DnsDomain::setServers(const QList<QHostAddress> &servers) |
71 | { |
72 | d->servers = servers; |
73 | } |
74 | |
75 | QStringList NetworkManager::DnsDomain::options() const |
76 | { |
77 | return d->options; |
78 | } |
79 | |
80 | void NetworkManager::DnsDomain::setOptions(const QStringList &options) |
81 | { |
82 | d->options = options; |
83 | } |
84 | |
85 | NetworkManager::DnsDomain &NetworkManager::DnsDomain::operator=(const DnsDomain &other) |
86 | { |
87 | if (this == &other) { |
88 | return *this; |
89 | } |
90 | |
91 | *d = *other.d; |
92 | return *this; |
93 | } |
94 | |