File indexing completed on 2025-03-23 12:49:51
0001 /* 0002 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org> 0003 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #include "ipconfig.h" 0009 0010 namespace NetworkManager 0011 { 0012 class NetworkManager::IpRoute::Private 0013 { 0014 public: 0015 Private() 0016 : metric(0) 0017 { 0018 } 0019 QHostAddress nextHop; 0020 quint32 metric; 0021 }; 0022 0023 } 0024 0025 NetworkManager::IpRoute::IpRoute() 0026 : d(new Private) 0027 { 0028 } 0029 0030 NetworkManager::IpRoute::~IpRoute() 0031 { 0032 delete d; 0033 } 0034 0035 NetworkManager::IpRoute::IpRoute(const NetworkManager::IpRoute &other) 0036 : QNetworkAddressEntry(other) 0037 , d(new Private) 0038 { 0039 *this = other; 0040 } 0041 0042 void NetworkManager::IpRoute::setNextHop(const QHostAddress &nextHop) const 0043 { 0044 d->nextHop = nextHop; 0045 } 0046 0047 QHostAddress NetworkManager::IpRoute::nextHop() const 0048 { 0049 return d->nextHop; 0050 } 0051 0052 void NetworkManager::IpRoute::setMetric(quint32 metric) 0053 { 0054 d->metric = metric; 0055 } 0056 0057 quint32 NetworkManager::IpRoute::metric() const 0058 { 0059 return d->metric; 0060 } 0061 0062 NetworkManager::IpRoute &NetworkManager::IpRoute::operator=(const NetworkManager::IpRoute &other) 0063 { 0064 if (this == &other) { 0065 return *this; 0066 } 0067 0068 QNetworkAddressEntry::operator=(other); 0069 *d = *other.d; 0070 0071 return *this; 0072 } 0073 0074 bool NetworkManager::IpRoute::isValid() const 0075 { 0076 return !ip().isNull(); 0077 }