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 | #include "ipconfig.h" |
9 | |
10 | namespace NetworkManager |
11 | { |
12 | class NetworkManager::IpRoute::Private |
13 | { |
14 | public: |
15 | Private() |
16 | : metric(0) |
17 | { |
18 | } |
19 | QHostAddress nextHop; |
20 | quint32 metric; |
21 | }; |
22 | |
23 | } |
24 | |
25 | NetworkManager::IpRoute::IpRoute() |
26 | : d(new Private) |
27 | { |
28 | } |
29 | |
30 | NetworkManager::IpRoute::~IpRoute() |
31 | { |
32 | delete d; |
33 | } |
34 | |
35 | NetworkManager::IpRoute::IpRoute(const NetworkManager::IpRoute &other) |
36 | : QNetworkAddressEntry(other) |
37 | , d(new Private) |
38 | { |
39 | *this = other; |
40 | } |
41 | |
42 | void NetworkManager::IpRoute::setNextHop(const QHostAddress &nextHop) const |
43 | { |
44 | d->nextHop = nextHop; |
45 | } |
46 | |
47 | QHostAddress NetworkManager::IpRoute::nextHop() const |
48 | { |
49 | return d->nextHop; |
50 | } |
51 | |
52 | void NetworkManager::IpRoute::setMetric(quint32 metric) |
53 | { |
54 | d->metric = metric; |
55 | } |
56 | |
57 | quint32 NetworkManager::IpRoute::metric() const |
58 | { |
59 | return d->metric; |
60 | } |
61 | |
62 | NetworkManager::IpRoute &NetworkManager::IpRoute::operator=(const NetworkManager::IpRoute &other) |
63 | { |
64 | if (this == &other) { |
65 | return *this; |
66 | } |
67 | |
68 | QNetworkAddressEntry::operator=(other); |
69 | *d = *other.d; |
70 | |
71 | return *this; |
72 | } |
73 | |
74 | bool NetworkManager::IpRoute::isValid() const |
75 | { |
76 | return !ip().isNull(); |
77 | } |
78 | |