2 Copyright 2008 Will Stephenson <wstephenson@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), which shall act as a proxy
10 defined in Section 14 of version 3 of the license.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "networkipv4config.h"
28 class IPv4Config::Private
31 Private(const QList
<IPv4Address
> &theAddresses
,
32 const QList
<quint32
> &theNameservers
,
33 const QStringList
&theDomains
, const QList
<IPv4Route
> &theRoutes
)
34 : addresses(theAddresses
), nameservers(theNameservers
),
35 domains(theDomains
), routes(theRoutes
)
39 QList
<IPv4Address
> addresses
;
40 QList
<quint32
> nameservers
;
42 QList
<IPv4Route
> routes
;
46 class IPv4Address::Private
49 Private(quint32 theAddress
, quint32 theNetMask
, quint32 theGateway
)
50 : address(theAddress
), netMask(theNetMask
), gateway(theGateway
)
53 : address(0), netMask(0), gateway(0)
60 class IPv4Route::Private
63 Private(quint32 theRoute
, quint32 thePrefix
, quint32 theNextHop
, quint32 theMetric
)
64 : route(theRoute
), prefix(thePrefix
), nextHop(theNextHop
), metric(theMetric
)
67 : route(0), prefix(0), nextHop(0), metric(0)
77 Solid::Control::IPv4Address::IPv4Address(quint32 address
, quint32 netMask
, quint32 gateway
)
78 : d(new Private(address
, netMask
, gateway
))
82 Solid::Control::IPv4Address::IPv4Address()
87 Solid::Control::IPv4Address::~IPv4Address()
92 Solid::Control::IPv4Address::IPv4Address(const IPv4Address
&other
)
93 : d(new Private(*other
.d
))
97 quint32
Solid::Control::IPv4Address::address() const
102 quint32
Solid::Control::IPv4Address::netMask() const
107 quint32
Solid::Control::IPv4Address::gateway() const
112 Solid::Control::IPv4Address
&Solid::Control::IPv4Address::operator=(const Solid::Control::IPv4Address
&other
)
121 bool Solid::Control::IPv4Address::isValid() const
123 return d
->address
!= 0;
126 Solid::Control::IPv4Route::IPv4Route(quint32 route
, quint32 prefix
, quint32 nextHop
, quint32 metric
)
127 : d(new Private(route
, prefix
, nextHop
, metric
))
131 Solid::Control::IPv4Route::IPv4Route()
136 Solid::Control::IPv4Route::~IPv4Route()
141 Solid::Control::IPv4Route::IPv4Route(const IPv4Route
&other
)
142 : d(new Private(*other
.d
))
146 quint32
Solid::Control::IPv4Route::route() const
151 quint32
Solid::Control::IPv4Route::prefix() const
156 quint32
Solid::Control::IPv4Route::nextHop() const
161 quint32
Solid::Control::IPv4Route::metric() const
166 Solid::Control::IPv4Route
&Solid::Control::IPv4Route::operator=(const Solid::Control::IPv4Route
&other
)
175 bool Solid::Control::IPv4Route::isValid() const
177 return d
->route
!= 0;
181 Solid::Control::IPv4Config::IPv4Config(const QList
<IPv4Address
> &addresses
,
182 const QList
<quint32
> &nameservers
,
183 const QStringList
&domains
,
184 const QList
<IPv4Route
> &routes
)
185 : d(new Private(addresses
, nameservers
, domains
, routes
))
189 Solid::Control::IPv4Config::IPv4Config()
194 Solid::Control::IPv4Config::IPv4Config(const Solid::Control::IPv4Config
& other
)
196 d
= new Private(*other
.d
);
199 Solid::Control::IPv4Config::~IPv4Config()
204 QList
<Solid::Control::IPv4Address
> Solid::Control::IPv4Config::addresses() const
209 QList
<quint32
> Solid::Control::IPv4Config::nameservers() const
211 return d
->nameservers
;
214 QStringList
Solid::Control::IPv4Config::domains() const
219 Solid::Control::IPv4Config
&Solid::Control::IPv4Config::operator=(const Solid::Control::IPv4Config
& other
)
228 bool Solid::Control::IPv4Config::isValid() const
230 return !d
->addresses
.isEmpty();