libsolidcontrol
networkipv4config.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 quint32 theBroadcast, const QString &theHostname, const QList<quint32> &theNameservers,
00033 const QStringList &theDomains, const QString &theNisDomain, const QList<quint32> &theNisServers)
00034 : addresses(theAddresses), broadcast(theBroadcast),
00035 hostname(theHostname), nameservers(theNameservers), domains(theDomains),
00036 nisDomain(theNisDomain), nisServers(theNisServers)
00037 {}
00038 Private()
00039 : broadcast(0)
00040 {}
00041 QList<IPv4Address> addresses;
00042 quint32 broadcast;
00043 QString hostname;
00044 QList<quint32> nameservers;
00045 QStringList domains;
00046 QString nisDomain;
00047 QList<quint32> nisServers;
00048 };
00049
00050
00051 class IPv4Address::Private
00052 {
00053 public:
00054 Private(quint32 theAddress, quint32 theNetMask, quint32 theGateway)
00055 : address(theAddress), netMask(theNetMask), gateway(theGateway)
00056 {}
00057 Private()
00058 : address(0), netMask(0), gateway(0)
00059 {}
00060 quint32 address;
00061 quint32 netMask;
00062 quint32 gateway;
00063 };
00064 }
00065 }
00066
00067 Solid::Control::IPv4Address::IPv4Address(quint32 address, quint32 netMask, quint32 gateway)
00068 : d(new Private(address, netMask, gateway))
00069 {
00070 }
00071
00072 Solid::Control::IPv4Address::IPv4Address()
00073 : d(new Private())
00074 {
00075 }
00076
00077 Solid::Control::IPv4Address::~IPv4Address()
00078 {
00079 delete d;
00080 }
00081
00082 Solid::Control::IPv4Address::IPv4Address(const IPv4Address &other)
00083 : d(new Private(*other.d))
00084 {
00085 }
00086
00087 quint32 Solid::Control::IPv4Address::address() const
00088 {
00089 return d->address;
00090 }
00091
00092 quint32 Solid::Control::IPv4Address::netMask() const
00093 {
00094 return d->netMask;
00095 }
00096
00097 quint32 Solid::Control::IPv4Address::gateway() const
00098 {
00099 return d->gateway;
00100 }
00101
00102 Solid::Control::IPv4Address &Solid::Control::IPv4Address::operator=(const Solid::Control::IPv4Address &other)
00103 {
00104 if (this == &other)
00105 return *this;
00106
00107 *d = *other.d;
00108 return *this;
00109 }
00110
00111 bool Solid::Control::IPv4Address::isValid() const
00112 {
00113 return d->address != 0;
00114 }
00115
00116
00117 Solid::Control::IPv4Config::IPv4Config(const QList<IPv4Address> &addresses,
00118 quint32 broadcast, const QString &hostname, const QList<quint32> &nameservers,
00119 const QStringList &domains, const QString &nisDomain, const QList<quint32> &nisServers)
00120 : d(new Private(addresses, broadcast, hostname, nameservers, domains,
00121 nisDomain, nisServers))
00122 {
00123 }
00124
00125 Solid::Control::IPv4Config::IPv4Config()
00126 : d(new Private())
00127 {
00128 }
00129
00130 Solid::Control::IPv4Config::IPv4Config(const Solid::Control::IPv4Config& other)
00131 {
00132 d = new Private(*other.d);
00133 }
00134
00135 Solid::Control::IPv4Config::~IPv4Config()
00136 {
00137 delete d;
00138 }
00139
00140 QList<Solid::Control::IPv4Address> Solid::Control::IPv4Config::addresses() const
00141 {
00142 return d->addresses;
00143 }
00144
00145 quint32 Solid::Control::IPv4Config::broadcast() const
00146 {
00147 return d->broadcast;
00148 }
00149
00150 QString Solid::Control::IPv4Config::hostname() const
00151 {
00152 return d->hostname;
00153 }
00154
00155 QList<quint32> Solid::Control::IPv4Config::nameservers() const
00156 {
00157 return d->nameservers;
00158 }
00159
00160 QStringList Solid::Control::IPv4Config::domains() const
00161 {
00162 return d->domains;
00163 }
00164
00165 QString Solid::Control::IPv4Config::nisDomain() const
00166 {
00167 return d->nisDomain;
00168 }
00169
00170 QList<quint32> Solid::Control::IPv4Config::nisServers() const
00171 {
00172 return d->nisServers;
00173 }
00174
00175 Solid::Control::IPv4Config &Solid::Control::IPv4Config::operator=(const Solid::Control::IPv4Config& other)
00176 {
00177 if (this == &other)
00178 return *this;
00179
00180 *d = *other.d;
00181 return *this;
00182 }
00183
00184 bool Solid::Control::IPv4Config::isValid() const
00185 {
00186 return !d->addresses.isEmpty();
00187 }
00188