1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2007 Kevin Ottens <ervin@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #ifndef SOLID_NETWORK_H
22 #define SOLID_NETWORK_H
24 #include <QtCore/QObject>
25 #include <QtCore/QStringList>
26 #include <QtNetwork/QNetworkAddressEntry>
28 #include <solid/control/solid_control_export.h>
34 class NetworkInterface
;
35 class NetworkInterfacePrivate
;
39 * This interface represents a generic Internet Protocol (IP) network which we may be connected to.
41 class SOLIDCONTROL_EXPORT Network
: public QObject
44 Q_DECLARE_PRIVATE(Network
)
48 * Creates a new Network object.
50 * @param backendObject the network object provided by the backend
52 Network(QObject
*backendObject
= 0);
55 * Constructs a copy of a network.
57 * @param network the network to copy
59 Network(const Network
&network
);
62 * Destroys a Network object.
67 * Indicates if this network is valid.
68 * A network is considered valid if it's available to the system.
70 * @return true if this network is available, false otherwise
75 * Retrieves the Unique Network Identifier (UNI) of the Network.
76 * This identifier is unique for each network and network interface in the system.
78 * @returns the Unique Network Identifier of the current network
85 * Retrieves the addresses that the device has on this network.
87 * @return the list of addresses
89 QList
<QNetworkAddressEntry
> addressEntries() const;
92 * Retrieves the route we must follow when using this network. It's
93 * in particular used for VPN.
95 * @return the route address is available, QString() otherwise
97 QString
route() const;
100 * Retrieves the list of DNS servers to use on this network.
102 * @return the dns servers
104 QList
<QHostAddress
> dnsServers() const;
107 * Retrieves the activation status of this network. For ethernets, this will always be true.
109 * @return true if this network is active, false otherwise
111 bool isActive() const;
114 * Activates or deactivates this network. For ethernets, this has no effect.
116 * @param activated true to activate this network, false otherwise
118 void setActivated(bool activated
);
122 * This signal is emitted when the settings of this network have changed.
124 void ipDetailsChanged();
127 * This signal is emitted when the activation state of this network
130 * @param activated true if the network is activated, false otherwise
132 void activationStateChanged(bool activated
);
138 Network(NetworkPrivate
&dd
, QObject
*backendObject
);
143 Network(NetworkPrivate
&dd
, const Network
&network
);
145 NetworkPrivate
*d_ptr
;
148 friend class NetworkInterface
;
149 friend class NetworkInterfacePrivate
;
150 //HACK: to make NetworkList polymorphic (containing both wired and wireless networks, I used Network * here - Will.
152 typedef QList
<Network
*> NetworkList
;