You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
835 lines
24 KiB
835 lines
24 KiB
/* This file is part of the TDE libraries
|
|
Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public
|
|
License version 2 as published by the Free Software Foundation.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Boston, MA 02110-1301, USA.
|
|
*/
|
|
#ifndef _TDENETWORKCONNECTIONS_H
|
|
#define _TDENETWORKCONNECTIONS_H
|
|
|
|
// TDE includes
|
|
#include <tqobject.h>
|
|
#include <tqstring.h>
|
|
#include <tqptrlist.h>
|
|
#include <tqstringlist.h>
|
|
#include <tqhostaddress.h>
|
|
#include "kiconloader.h"
|
|
#include "tdelibs_export.h"
|
|
|
|
#define CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(x) \
|
|
inline x operator|(x a, x b) \
|
|
{ \
|
|
return static_cast<x>(static_cast<int>(a) | static_cast<int>(b)); \
|
|
} \
|
|
\
|
|
inline x operator&(x a, x b) \
|
|
{ \
|
|
return static_cast<x>(static_cast<int>(a) & static_cast<int>(b)); \
|
|
} \
|
|
\
|
|
inline x operator~(x a) \
|
|
{ \
|
|
return static_cast<x>(~static_cast<int>(a)); \
|
|
} \
|
|
\
|
|
inline x &operator|=(x& a, const x& b) \
|
|
{ \
|
|
a = static_cast<x>(static_cast<int>(a) | static_cast<int>(b)); \
|
|
return a; \
|
|
} \
|
|
\
|
|
inline x &operator&=(x& a, const x& b) \
|
|
{ \
|
|
a = static_cast<x>(static_cast<int>(a) & static_cast<int>(b)); \
|
|
return a; \
|
|
}
|
|
|
|
typedef TQValueList<TQ_UINT8> TDENetworkByteList;
|
|
typedef TQValueList<TQHostAddress> TDENetworkAddressList;
|
|
|
|
namespace TDENetworkConnectionType {
|
|
enum TDENetworkConnectionType {
|
|
BackendOnly,
|
|
WiredEthernet,
|
|
WiFi,
|
|
Bluetooth,
|
|
OLPCMesh,
|
|
WiMax,
|
|
Modem,
|
|
Infiniband,
|
|
Bond,
|
|
VLAN,
|
|
ADSL,
|
|
Other,
|
|
Last = Other
|
|
};
|
|
};
|
|
|
|
namespace TDEWiFiMode {
|
|
enum TDEWiFiMode {
|
|
AdHoc,
|
|
Infrastructure,
|
|
Other,
|
|
Last = Other
|
|
};
|
|
};
|
|
|
|
namespace TDENetworkGlobalManagerFlags {
|
|
enum TDENetworkGlobalManagerFlags {
|
|
Unknown = 0x00000000,
|
|
Disconnected = 0x00000001,
|
|
Connected = 0x00000002,
|
|
EstablishingLink = 0x00000004,
|
|
DeactivatingLink = 0x00000008,
|
|
LinkLocalAccess = 0x00000010,
|
|
SiteLocalAccess = 0x00000020,
|
|
GlobalAccess = 0x00000040,
|
|
Sleeping = 0x00000080,
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkGlobalManagerFlags)
|
|
};
|
|
|
|
namespace TDENetworkDeviceCapabilityFlags {
|
|
enum TDENetworkDeviceCapabilityFlags {
|
|
None = 0x00000000,
|
|
Supported = 0x00000001,
|
|
CanDetectLink = 0x00000002
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkDeviceCapabilityFlags)
|
|
};
|
|
|
|
namespace TDENetworkWiFiAPFlags {
|
|
enum TDENetworkWiFiAPFlags {
|
|
None = 0x00000000,
|
|
PrivacySupport = 0x00000001,
|
|
PairWEP40 = 0x00000002,
|
|
PairWEP104 = 0x00000004,
|
|
PairTKIP = 0x00000008,
|
|
PairCCMP = 0x00000010,
|
|
GroupWEP40 = 0x00000020,
|
|
GroupWEP104 = 0x00000040,
|
|
GroupTKIP = 0x00000080,
|
|
GroupCCMP = 0x00000100,
|
|
KeyManagementPSK = 0x00000200,
|
|
KeyManagement80211 = 0x00000400
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiAPFlags)
|
|
};
|
|
|
|
namespace TDENetworkWiFiClientFlags {
|
|
enum TDENetworkWiFiClientFlags {
|
|
None = 0x00000000,
|
|
CipherWEP40 = 0x00000002,
|
|
CipherWEP104 = 0x00000004,
|
|
CipherTKIP = 0x00000008,
|
|
CipherCCMP = 0x00000010,
|
|
CipherWPA = 0x00000020,
|
|
CipherRSN = 0x00000040
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiClientFlags)
|
|
};
|
|
|
|
namespace TDENetworkWiFiConnectionCipher {
|
|
enum TDENetworkWiFiConnectionCipher {
|
|
None,
|
|
CipherWEP40,
|
|
CipherWEP104,
|
|
CipherTKIP,
|
|
CipherCCMP,
|
|
CipherWPA,
|
|
CipherRSN
|
|
};
|
|
};
|
|
|
|
namespace TDENetworkIEEE8021xType {
|
|
enum TDENetworkIEEE8021xType {
|
|
None,
|
|
LEAP,
|
|
MD5,
|
|
PAP,
|
|
CHAP,
|
|
MSCHAP,
|
|
MSCHAPV2,
|
|
Fast,
|
|
PSK,
|
|
PAX,
|
|
SAKE,
|
|
GPSK,
|
|
TLS,
|
|
PEAP,
|
|
TTLS,
|
|
SIM,
|
|
GTC,
|
|
OTP
|
|
};
|
|
};
|
|
|
|
namespace TDENetworkIEEE8021xFastFlags {
|
|
enum TDENetworkIEEE8021xFastFlags {
|
|
None = 0x00000000,
|
|
AllowUnauthenticated = 0x00000001,
|
|
AllowAuthenticated = 0x00000002
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIEEE8021xFastFlags)
|
|
};
|
|
|
|
namespace TDENetworkPasswordHandlingFlags {
|
|
enum TDENetworkPasswordHandlingFlags {
|
|
None = 0x00000000,
|
|
NoSave = 0x00000001,
|
|
NoPrompt = 0x00000002,
|
|
ExternalStorage = 0x00000004
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkPasswordHandlingFlags)
|
|
};
|
|
|
|
namespace TDENetworkConnectionStatus {
|
|
enum TDENetworkConnectionStatus {
|
|
Invalid = 0x00000000,
|
|
Disconnected = 0x00000001,
|
|
Connected = 0x00000002,
|
|
LinkUnavailable = 0x00000004,
|
|
EstablishingLink = 0x00000008,
|
|
DeactivatingLink = 0x00000010,
|
|
ConfiguringProtocols = 0x00000020,
|
|
Reconnecting = 0x00000040,
|
|
LinkLost = 0x00000080,
|
|
LinkLocalAccess = 0x00000100,
|
|
SiteLocalAccess = 0x00000200,
|
|
GlobalAccess = 0x00000400,
|
|
UnManaged = 0x00000800,
|
|
NeedAuthorization = 0x00001000,
|
|
Failed = 0x00002000,
|
|
VerifyingProtocols = 0x00004000,
|
|
DependencyWait = 0x00008000
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkConnectionStatus)
|
|
};
|
|
|
|
namespace TDENetworkIPConfigurationFlags {
|
|
enum TDENetworkIPConfigurationFlags {
|
|
None = 0x00000000,
|
|
IPV4DHCPIP = 0x00000001,
|
|
IPV4DHCPDNS = 0x00000002,
|
|
IPV4DHCPRoutes = 0x00000004,
|
|
IPV4LocalOnly = 0x00000008,
|
|
IPV4StartConnectionSharingServer = 0x00000010,
|
|
IPV4Disabled = 0x00000020,
|
|
IPV4MayUseAsDefaultRoute = 0x00000040,
|
|
IPV6DHCPIP = 0x00000080,
|
|
IPV6DHCPDNS = 0x00000100,
|
|
IPV6DHCPRoutes = 0x00000200,
|
|
IPV6LocalOnly = 0x00000400,
|
|
IPV6StartConnectionSharingServer = 0x00000800,
|
|
IPV6Disabled = 0x00001000,
|
|
IPV6MayUseAsDefaultRoute = 0x00002000
|
|
};
|
|
|
|
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIPConfigurationFlags)
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkSearchDomain
|
|
{
|
|
public:
|
|
TDENetworkSearchDomain();
|
|
TDENetworkSearchDomain(TQString domain, bool ipv6=false);
|
|
~TDENetworkSearchDomain();
|
|
|
|
TQString searchDomain();
|
|
void setSearchDomain(TQString domain, bool ipv6=false);
|
|
|
|
bool isIPv4();
|
|
bool isIPv6();
|
|
|
|
private:
|
|
TQString m_domain;
|
|
bool m_isIPV6;
|
|
};
|
|
|
|
typedef TQValueList<TDENetworkSearchDomain> TDENetworkSearchDomainList;
|
|
|
|
class TDECORE_EXPORT TDENetMask
|
|
{
|
|
public:
|
|
TDENetMask();
|
|
TDENetMask(TQ_UINT32 netmask);
|
|
TDENetMask(TQ_UINT8* netmask);
|
|
~TDENetMask();
|
|
|
|
void fromCIDRMask(unsigned char mask, bool ipv6=false);
|
|
unsigned char toCIDRMask();
|
|
void fromString(TQString mask);
|
|
TQString toString();
|
|
|
|
bool isIPv4();
|
|
bool isIPv6();
|
|
|
|
private:
|
|
TQ_UINT32 m_ipv4NetMask;
|
|
TQHostAddress m_ipv6NetMask;
|
|
bool m_isIPV6;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDEMACAddress
|
|
{
|
|
public:
|
|
TDEMACAddress();
|
|
TDEMACAddress(TDENetworkByteList address);
|
|
~TDEMACAddress();
|
|
|
|
TDENetworkByteList address();
|
|
void setAddress(TDENetworkByteList address);
|
|
TQString toString();
|
|
void fromString(TQString address);
|
|
bool isValid();
|
|
|
|
private:
|
|
bool m_isValid;
|
|
TDENetworkByteList m_macAddress;
|
|
|
|
friend bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
|
|
};
|
|
|
|
bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
|
|
|
|
class TDECORE_EXPORT TDENetworkSingleIPConfiguration
|
|
{
|
|
public:
|
|
TDENetworkSingleIPConfiguration();
|
|
~TDENetworkSingleIPConfiguration();
|
|
|
|
bool isIPv4();
|
|
bool isIPv6();
|
|
|
|
public:
|
|
bool valid;
|
|
TQHostAddress ipAddress;
|
|
TDENetMask networkMask;
|
|
TQHostAddress gateway;
|
|
};
|
|
|
|
typedef TQValueList<TDENetworkSingleIPConfiguration> TDENetworkSingleIPConfigurationList;
|
|
|
|
class TDECORE_EXPORT TDENetworkSingleRouteConfiguration
|
|
{
|
|
public:
|
|
TDENetworkSingleRouteConfiguration();
|
|
~TDENetworkSingleRouteConfiguration();
|
|
|
|
bool isIPv4();
|
|
bool isIPv6();
|
|
|
|
public:
|
|
bool valid;
|
|
TQHostAddress ipAddress;
|
|
TDENetMask networkMask;
|
|
TQHostAddress gateway;
|
|
TQ_UINT32 metric;
|
|
};
|
|
|
|
typedef TQValueList<TDENetworkSingleRouteConfiguration> TDENetworkSingleRouteConfigurationList;
|
|
|
|
class TDENetworkIEEE8021xConfiguration
|
|
{
|
|
public:
|
|
TDENetworkIEEE8021xConfiguration();
|
|
~TDENetworkIEEE8021xConfiguration();
|
|
|
|
public:
|
|
bool valid;
|
|
bool secretsValid;
|
|
TDENetworkIEEE8021xType::TDENetworkIEEE8021xType type;
|
|
TQString userName;
|
|
TQString anonymousUserName;
|
|
TQString pacFileName;
|
|
TQByteArray caCertificate;
|
|
TQString additionalCAFilesPath;
|
|
TQString authServerCertSubjectMatch;
|
|
TQStringList alternateAuthServerCertSubjectMatch;
|
|
TQByteArray clientCertificate;
|
|
TQString forcePEAPVersion;
|
|
TQString forcePEAPLabel;
|
|
TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags fastProvisioningFlags;
|
|
TQString phase2NonEAPAuthMethod;
|
|
TQString phase2EAPAuthMethod;
|
|
TQByteArray phase2CaCertificate;
|
|
TQString phase2CaFilesPath;
|
|
TQString phase2AuthServerCertSubjectMatch;
|
|
TQStringList phase2AlternateAuthServerCertSubjectMatch;
|
|
TQByteArray phase2ClientCertificate;
|
|
TQString password;
|
|
TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags;
|
|
TQByteArray binaryPassword;
|
|
TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags binaryPasswordFlags;
|
|
TQByteArray privateKey;
|
|
TQString privateKeyPassword;
|
|
TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags privateKeyPasswordFlags;
|
|
TQByteArray phase2PrivateKey;
|
|
TQString phase2PrivateKeyPassword;
|
|
TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags phase2PrivateKeyPasswordFlags;
|
|
bool forceSystemCaCertificates;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkIPConfiguration
|
|
{
|
|
public:
|
|
TDENetworkIPConfiguration();
|
|
~TDENetworkIPConfiguration();
|
|
|
|
public:
|
|
bool valid;
|
|
TDENetworkIPConfigurationFlags::TDENetworkIPConfigurationFlags connectionFlags;
|
|
TDENetworkSingleIPConfigurationList ipConfigurations;
|
|
TDENetworkSingleRouteConfigurationList routeConfigurations;
|
|
TQHostAddress broadcast;
|
|
TQHostAddress destination;
|
|
TDENetworkAddressList resolvers;
|
|
TDENetworkSearchDomainList searchDomains;
|
|
TQString dhcpClientIdentifier;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkWiFiDeviceInfo
|
|
{
|
|
public:
|
|
TDENetworkWiFiDeviceInfo();
|
|
~TDENetworkWiFiDeviceInfo();
|
|
|
|
public:
|
|
bool valid;
|
|
TDEMACAddress hwAddress;
|
|
TDEMACAddress permanentHWAddress;
|
|
TDEWiFiMode::TDEWiFiMode operatingMode;
|
|
unsigned int bitrate;
|
|
TQString activeAccessPointBSSID;
|
|
TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags wirelessFlags;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkDeviceInformation
|
|
{
|
|
public:
|
|
TDENetworkDeviceInformation();
|
|
~TDENetworkDeviceInformation();
|
|
|
|
public:
|
|
bool valid;
|
|
TDENetworkConnectionStatus::TDENetworkConnectionStatus statusFlags;
|
|
TQString UUID;
|
|
TQString backendDriver;
|
|
TQString backendDriverVersion;
|
|
TQString firmwareVersion;
|
|
TDENetworkDeviceCapabilityFlags::TDENetworkDeviceCapabilityFlags capabilityFlags;
|
|
TDENetworkIPConfiguration ipConfiguration;
|
|
bool managed;
|
|
bool autoConnect;
|
|
bool firmwareMissing;
|
|
TDENetworkConnectionType::TDENetworkConnectionType deviceType;
|
|
TDENetworkWiFiDeviceInfo wiFiInfo;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkHWNeighbor
|
|
{
|
|
public:
|
|
TDENetworkHWNeighbor();
|
|
~TDENetworkHWNeighbor();
|
|
|
|
public:
|
|
bool valid;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor
|
|
{
|
|
public:
|
|
TDENetworkWiFiAPInfo();
|
|
~TDENetworkWiFiAPInfo();
|
|
|
|
public:
|
|
TQByteArray SSID;
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags wpaFlags;
|
|
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags rsnFlags;
|
|
unsigned int frequency;
|
|
TQString BSSID;
|
|
unsigned int maxBitrate;
|
|
double signalQuality;
|
|
};
|
|
|
|
typedef TQPtrList< TDENetworkHWNeighbor > TDENetworkHWNeighborList;
|
|
|
|
class TDECORE_EXPORT TDENetworkConnection
|
|
{
|
|
public:
|
|
TDENetworkConnection();
|
|
virtual ~TDENetworkConnection();
|
|
|
|
public:
|
|
TQString UUID;
|
|
TQString friendlyName;
|
|
TDENetworkIPConfiguration ipConfig;
|
|
TDEMACAddress lockedHWAddress;
|
|
TDEMACAddress manualHWAddress;
|
|
bool autoConnect;
|
|
bool fullDuplex;
|
|
bool requireIPV4;
|
|
bool requireIPV6;
|
|
TQ_UINT32 mtu;
|
|
TDENetworkIEEE8021xConfiguration eapConfig;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDEWiredEthernetConnection : public TDENetworkConnection
|
|
{
|
|
public:
|
|
TDEWiredEthernetConnection();
|
|
virtual ~TDEWiredEthernetConnection();
|
|
};
|
|
|
|
class TDECORE_EXPORT TDEWiFiConnection : public TDENetworkConnection
|
|
{
|
|
public:
|
|
TDEWiFiConnection();
|
|
virtual ~TDEWiFiConnection();
|
|
|
|
public:
|
|
TQString SSID;
|
|
TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher cipher;
|
|
TQString key1;
|
|
TQString key2;
|
|
TQString key3;
|
|
TQString key4;
|
|
};
|
|
|
|
typedef TQPtrList< TDENetworkConnection > TDENetworkConnectionList;
|
|
|
|
class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
/**
|
|
* Constructor.
|
|
* @param macAddress The MAC address of the hardware device
|
|
* If an empty MAC address is passed, this object will make global networking backend
|
|
* methods available exclusively (TDENetworkConnectionType::BackendOnly).
|
|
*/
|
|
TDENetworkConnectionManager(TQString macAddress);
|
|
|
|
/**
|
|
* Destructor.
|
|
*/
|
|
~TDENetworkConnectionManager();
|
|
|
|
/**
|
|
* @return the MAC address of this device
|
|
*/
|
|
TQString deviceMACAddress();
|
|
|
|
/**
|
|
* @return the type of connection supported by this device
|
|
*/
|
|
virtual TDENetworkConnectionType::TDENetworkConnectionType connectionType() = 0;
|
|
|
|
/**
|
|
* @return A TDENetworkGlobalManagerFlags enum value with the current status of the networking backend.
|
|
*/
|
|
virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus() = 0;
|
|
|
|
/**
|
|
* @return A TDENetworkDeviceInformation object containing the current status of the network device.
|
|
*/
|
|
virtual TDENetworkDeviceInformation deviceInformation() = 0;
|
|
|
|
/**
|
|
* Loads all connection information from the configuration backend
|
|
* Secret information must be loaded separately via a call to
|
|
* loadConnectionSecrets(TQString uuid) after this method has been
|
|
* executed at least once.
|
|
*/
|
|
virtual void loadConnectionInformation() = 0;
|
|
|
|
/**
|
|
* @param uuid a TQString conntaining the UUID of a connection for which to
|
|
* load secrets from the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool loadConnectionSecrets(TQString uuid) = 0;
|
|
|
|
/**
|
|
* @param connection a pointer to a TDENetworkConnection object containing a
|
|
* connection to save to the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool saveConnection(TDENetworkConnection* connection) = 0;
|
|
|
|
/**
|
|
* @param uuid a TQString conntaining the UUID of a connection to
|
|
* delete from the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool deleteConnection(TQString uuid) = 0;
|
|
|
|
/**
|
|
* Initiates a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
* The client application should poll for status updates using checkConnectionStatus()
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid) = 0;
|
|
|
|
/**
|
|
* Checks the status of a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid) = 0;
|
|
|
|
/**
|
|
* Disconnects a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
* The client application should poll for status updates using checkConnectionStatus()
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus deactivateConnection(TQString uuid) = 0;
|
|
|
|
/**
|
|
* @return a TDENetworkHWNeighborList object containing the result of a site survey;
|
|
* i.e. all nearby access points or devices. This function only returns valid information
|
|
* if the underlying network device supports site surveys.
|
|
*
|
|
* Note that the returned list is internally managed and must not be deleted!
|
|
* Also note that pointers in the list may become invalid on subsequent calls to
|
|
* siteSurvey().
|
|
*/
|
|
virtual TDENetworkHWNeighborList* siteSurvey() = 0;
|
|
|
|
/**
|
|
* @return true if networking is enabled, false if not.
|
|
*/
|
|
virtual bool networkingEnabled() = 0;
|
|
|
|
/**
|
|
* @return true if WiFi hardware is enabled, false if not.
|
|
*/
|
|
virtual bool wiFiHardwareEnabled() = 0;
|
|
|
|
/**
|
|
* @param enable true to enable WiFi, false to disable it.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool enableWiFi(bool enable) = 0;
|
|
|
|
/**
|
|
* @return true if WiFi is enabled, false if not.
|
|
*/
|
|
virtual bool wiFiEnabled() = 0;
|
|
|
|
signals:
|
|
/**
|
|
* Emitted whenever the state of the system's connection changes
|
|
* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
|
|
*/
|
|
void networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags previousState);
|
|
|
|
/**
|
|
* Emitted whenever the state of a device changes
|
|
* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
|
|
* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
|
|
* of the networking hardware that has changed state.
|
|
*/
|
|
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);
|
|
|
|
public:
|
|
/**
|
|
* @return a TDENetworkConnectionList object containing a list of all
|
|
* possible connections this connection manager is aware of, regardless
|
|
* of current state or availability.
|
|
*
|
|
* loadConnectionInformation() should be called at least once before calling
|
|
* this method, in order to update internal connection information from the
|
|
* configuration backend.
|
|
*
|
|
* Note that the returned list is internally managed and must not be deleted!
|
|
* Also note that pointers in the list may become invalid on subsequent calls to
|
|
* loadConnectionInformation(), saveConnection(), deleteConnection(), or connections().
|
|
*/
|
|
virtual TDENetworkConnectionList* connections();
|
|
|
|
/**
|
|
* @return a pointer to a TDENetworkConnection object with the specified @param uuid,
|
|
* or a NULL pointer if no such connection exists.
|
|
*
|
|
* Note that the returned object is internally managed and must not be deleted!
|
|
*/
|
|
TDENetworkConnection* findConnectionByUUID(TQString uuid);
|
|
|
|
protected:
|
|
void clearTDENetworkConnectionList();
|
|
void clearTDENetworkHWNeighborList();
|
|
void internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState);
|
|
void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null);
|
|
|
|
protected:
|
|
TDENetworkConnectionList* m_connectionList;
|
|
TDENetworkHWNeighborList* m_hwNeighborList;
|
|
TQString m_macAddress;
|
|
TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags m_prevConnectionStatus;
|
|
TQMap<TQString, TDENetworkConnectionStatus::TDENetworkConnectionStatus> m_prevDeviceStatus;
|
|
};
|
|
|
|
class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
/**
|
|
* Constructor.
|
|
*/
|
|
TDEGlobalNetworkManager();
|
|
|
|
/**
|
|
* Destructor.
|
|
*/
|
|
~TDEGlobalNetworkManager();
|
|
|
|
/**
|
|
* @return A TDENetworkGlobalManagerFlags enum value with the current status of the networking backend.
|
|
*/
|
|
virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus();
|
|
|
|
/**
|
|
* Loads all connection information from the configuration backend
|
|
* Secret information must be loaded separately via a call to
|
|
* loadConnectionSecrets(TQString uuid) after this method has been
|
|
* executed at least once.
|
|
*/
|
|
virtual void loadConnectionInformation();
|
|
|
|
/**
|
|
* @param uuid a TQString conntaining the UUID of a connection for which to
|
|
* load secrets from the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool loadConnectionSecrets(TQString uuid);
|
|
|
|
/**
|
|
* @param connection a pointer to a TDENetworkConnection object containing a
|
|
* connection to save to the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool saveConnection(TDENetworkConnection* connection);
|
|
|
|
/**
|
|
* @param uuid a TQString conntaining the UUID of a connection to
|
|
* delete from the configuration backend.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool deleteConnection(TQString uuid);
|
|
|
|
/**
|
|
* Initiates a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
* The client application should poll for status updates using checkConnectionStatus()
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid);
|
|
|
|
/**
|
|
* Checks the status of a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid);
|
|
|
|
/**
|
|
* Disconnects a connection with UUID @param uuid.
|
|
* @return A TDENetworkConnectionStatus enum value with the current connection status
|
|
* The client application should poll for status updates using checkConnectionStatus()
|
|
*/
|
|
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus deactivateConnection(TQString uuid);
|
|
|
|
/**
|
|
* @return a TDENetworkHWNeighborList object containing the result of a site survey;
|
|
* i.e. all nearby access points or devices. This function only returns valid information
|
|
* if the underlying network device supports site surveys.
|
|
*
|
|
* Note that the returned list is internally managed and must not be deleted!
|
|
* Also note that pointers in the list may become invalid on subsequent calls to
|
|
* siteSurvey().
|
|
*/
|
|
virtual TDENetworkHWNeighborList* siteSurvey();
|
|
|
|
/**
|
|
* @return true if networking is enabled, false if not.
|
|
*/
|
|
virtual bool networkingEnabled();
|
|
|
|
/**
|
|
* @return true if WiFi hardware is enabled, false if not.
|
|
*/
|
|
virtual bool wiFiHardwareEnabled();
|
|
|
|
/**
|
|
* @param enable true to enable WiFi, false to disable it.
|
|
* @return true on success, false on failure.
|
|
*/
|
|
virtual bool enableWiFi(bool enable);
|
|
|
|
/**
|
|
* @return true if WiFi is enabled, false if not.
|
|
*/
|
|
virtual bool wiFiEnabled();
|
|
|
|
signals:
|
|
/**
|
|
* Emitted whenever the state of the system's connection changes
|
|
* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
|
|
*/
|
|
void networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags previousState);
|
|
|
|
/**
|
|
* Emitted whenever the state of a device changes
|
|
* If previous state data was unavailable, @param previousState will contain TDENetworkConnectionStatus::Invalid
|
|
* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
|
|
* of the networking hardware that has changed state.
|
|
*/
|
|
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress);
|
|
|
|
public:
|
|
/**
|
|
* @return a TDENetworkConnectionList object containing a list of all
|
|
* possible connections this connection manager is aware of, regardless
|
|
* of current state or availability.
|
|
*
|
|
* loadConnectionInformation() should be called at least once before calling
|
|
* this method, in order to update internal connection information from the
|
|
* configuration backend.
|
|
*
|
|
* Note that the returned list is internally managed and must not be deleted!
|
|
* Also note that pointers in the list may become invalid on subsequent calls to
|
|
* loadConnectionInformation(), saveConnection(), deleteConnection(), or connections().
|
|
*/
|
|
virtual TDENetworkConnectionList* connections();
|
|
|
|
/**
|
|
* @return a pointer to a TDENetworkConnection object with the specified @param uuid,
|
|
* or a NULL pointer if no such connection exists.
|
|
*
|
|
* Note that the returned object is internally managed and must not be deleted!
|
|
*/
|
|
TDENetworkConnection* findConnectionByUUID(TQString uuid);
|
|
|
|
private:
|
|
TDENetworkConnectionManager* m_internalConnectionManager;
|
|
};
|
|
|
|
#endif // _TDENETWORKCONNECTIONS_H
|