• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libsolidcontrol

networkipv4config.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright 2008 Will Stephenson <wstephenson@kde.org>
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License as
00006 published by the Free Software Foundation; either version 2 of
00007 the License or (at your option) version 3 or any later version
00008 accepted by the membership of KDE e.V. (or its successor approved
00009 by the membership of KDE e.V.), which shall act as a proxy 
00010 defined in Section 14 of version 3 of the license.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #include "networkipv4config.h"
00023 
00024 namespace Solid
00025 {
00026 namespace Control
00027 {
00028 class IPv4Config::Private
00029 {
00030 public:
00031     Private(const QList<IPv4Address> &theAddresses,
00032         const QList<quint32> &theNameservers,
00033         const QStringList &theDomains, const QList<IPv4Route> &theRoutes)
00034         : addresses(theAddresses), nameservers(theNameservers),
00035         domains(theDomains), routes(theRoutes)
00036     {}
00037     Private()
00038     {}
00039     QList<IPv4Address> addresses;
00040     QList<quint32> nameservers;
00041     QStringList domains;
00042     QList<IPv4Route> routes;
00043 };
00044 
00045 
00046 class IPv4Address::Private
00047 {
00048 public:
00049     Private(quint32 theAddress, quint32 theNetMask, quint32 theGateway)
00050         : address(theAddress), netMask(theNetMask), gateway(theGateway)
00051     {}
00052     Private()
00053         : address(0), netMask(0), gateway(0)
00054     {}
00055     quint32 address;
00056     quint32 netMask;
00057     quint32 gateway;
00058 };
00059 
00060 class IPv4Route::Private
00061 {
00062 public:
00063     Private(quint32 theRoute, quint32 thePrefix, quint32 theNextHop, quint32 theMetric)
00064         : route(theRoute), prefix(thePrefix), nextHop(theNextHop), metric(theMetric)
00065     {}
00066     Private()
00067         : route(0), prefix(0), nextHop(0), metric(0)
00068     {}
00069     quint32 route;
00070     quint32 prefix;
00071     quint32 nextHop;
00072     quint32 metric;
00073 };
00074 }
00075 }
00076 
00077 Solid::Control::IPv4Address::IPv4Address(quint32 address, quint32 netMask, quint32 gateway)
00078 : d(new Private(address, netMask, gateway))
00079 {
00080 }
00081 
00082 Solid::Control::IPv4Address::IPv4Address()
00083 : d(new Private())
00084 {
00085 }
00086 
00087 Solid::Control::IPv4Address::~IPv4Address()
00088 {
00089     delete d;
00090 }
00091 
00092 Solid::Control::IPv4Address::IPv4Address(const IPv4Address &other)
00093 : d(new Private(*other.d))
00094 {
00095 }
00096 
00097 quint32 Solid::Control::IPv4Address::address() const
00098 {
00099     return d->address;
00100 }
00101 
00102 quint32 Solid::Control::IPv4Address::netMask() const
00103 {
00104     return d->netMask;
00105 }
00106 
00107 quint32 Solid::Control::IPv4Address::gateway() const
00108 {
00109     return d->gateway;
00110 }
00111 
00112 Solid::Control::IPv4Address &Solid::Control::IPv4Address::operator=(const Solid::Control::IPv4Address &other)
00113 {
00114     if (this == &other)
00115         return *this;
00116 
00117     *d = *other.d;
00118     return *this;
00119 }
00120 
00121 bool Solid::Control::IPv4Address::isValid() const
00122 {
00123     return d->address != 0;
00124 }
00125 
00126 Solid::Control::IPv4Route::IPv4Route(quint32 route, quint32 prefix, quint32 nextHop, quint32 metric)
00127 : d(new Private(route, prefix, nextHop, metric))
00128 {
00129 }
00130 
00131 Solid::Control::IPv4Route::IPv4Route()
00132 : d(new Private())
00133 {
00134 }
00135 
00136 Solid::Control::IPv4Route::~IPv4Route()
00137 {
00138     delete d;
00139 }
00140 
00141 Solid::Control::IPv4Route::IPv4Route(const IPv4Route &other)
00142 : d(new Private(*other.d))
00143 {
00144 }
00145 
00146 quint32 Solid::Control::IPv4Route::route() const
00147 {
00148     return d->route;
00149 }
00150 
00151 quint32 Solid::Control::IPv4Route::prefix() const
00152 {
00153     return d->prefix;
00154 }
00155 
00156 quint32 Solid::Control::IPv4Route::nextHop() const
00157 {
00158     return d->nextHop;
00159 }
00160 
00161 quint32 Solid::Control::IPv4Route::metric() const
00162 {
00163     return d->metric;
00164 }
00165 
00166 Solid::Control::IPv4Route &Solid::Control::IPv4Route::operator=(const Solid::Control::IPv4Route &other)
00167 {
00168     if (this == &other)
00169         return *this;
00170 
00171     *d = *other.d;
00172     return *this;
00173 }
00174 
00175 bool Solid::Control::IPv4Route::isValid() const
00176 {
00177     return d->route != 0;
00178 }
00179 
00180 
00181 Solid::Control::IPv4Config::IPv4Config(const QList<IPv4Address> &addresses,
00182         const QList<quint32> &nameservers,
00183         const QStringList &domains,
00184         const QList<IPv4Route> &routes)
00185 : d(new Private(addresses, nameservers, domains, routes))
00186 {
00187 }
00188 
00189 Solid::Control::IPv4Config::IPv4Config()
00190 : d(new Private())
00191 {
00192 }
00193 
00194 Solid::Control::IPv4Config::IPv4Config(const Solid::Control::IPv4Config& other)
00195 {
00196     d = new Private(*other.d);
00197 }
00198 
00199 Solid::Control::IPv4Config::~IPv4Config()
00200 {
00201     delete d;
00202 }
00203 
00204 QList<Solid::Control::IPv4Address> Solid::Control::IPv4Config::addresses() const
00205 {
00206     return d->addresses;
00207 }
00208 
00209 QList<quint32> Solid::Control::IPv4Config::nameservers() const
00210 {
00211     return d->nameservers;
00212 }
00213 
00214 QStringList Solid::Control::IPv4Config::domains() const
00215 {
00216     return d->domains;
00217 }
00218 
00219 Solid::Control::IPv4Config &Solid::Control::IPv4Config::operator=(const Solid::Control::IPv4Config& other)
00220 {
00221     if (this == &other)
00222         return *this;
00223 
00224     *d = *other.d;
00225     return *this;
00226 }
00227 
00228 bool Solid::Control::IPv4Config::isValid() const
00229 {
00230     return !d->addresses.isEmpty();
00231 }
00232 

libsolidcontrol

Skip menu "libsolidcontrol"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal