From b5bdfd2c41c0be5b79831c1b9d5a3f292d129264 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 9 Sep 2012 20:40:11 -0500 Subject: Extend API to include default device(s) --- tdecore/tdenetworkconnections.h | 62 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 6 deletions(-) (limited to 'tdecore/tdenetworkconnections.h') diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h index 04a9e1c79..a193f3f6b 100644 --- a/tdecore/tdenetworkconnections.h +++ b/tdecore/tdenetworkconnections.h @@ -99,6 +99,23 @@ namespace TDENetworkConnectionType { }; }; +namespace TDENetworkConnectionErrorFlags { + enum TDENetworkConnectionErrorFlags { + NoError = 0x00000000, + InvalidConnectionSetting = 0x00000001, + InvalidIPv4Setting = 0x00000002, + InvalidIPv6Setting = 0x00000004, + InvalidEAPSetting = 0x00000008, + InvalidEAPKey = 0x00000010, + InvalidWirelessSetting = 0x00000020, + InvalidWirelessKey = 0x00000040 + }; + + CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkConnectionErrorFlags) +}; + +typedef TQMap TDENetworkErrorStringMap; + namespace TDENetworkInfinibandTransportMode { enum TDENetworkInfinibandTransportMode { Datagram, @@ -301,6 +318,7 @@ namespace TDENetworkWiFiConnectionCipher { namespace TDENetworkWepKeyType { enum TDENetworkWepKeyType { Hexadecimal, + Ascii, Passphrase }; }; @@ -1017,9 +1035,13 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject /** * @param connection a pointer to a TDENetworkConnection object containing a * connection for which to verify integrity of all settings. + * @param type a pointer to an TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags + * which will be filled with the generic error type code if provided. + * @param reason a pointer to a TDENetworkErrorStringMap which will be filled with translated + * strings containing the reason for the failure if provided. * @return true on success, false if invalid settings are detected. */ - virtual bool verifyConnectionSettings(TDENetworkConnection* connection) = 0; + virtual bool verifyConnectionSettings(TDENetworkConnection* connection, TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags* type=NULL, TDENetworkErrorStringMap* reason=NULL) = 0; /** * Initiates a connection with UUID @param uuid. @@ -1055,7 +1077,8 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject virtual TDENetworkHWNeighborList* siteSurvey() = 0; /** - * @return a TQStringList containing the UUIDs of all physical devices used by this connection + * @return a TQStringList containing the UUIDs of all physical devices used by the connection + * with UUID @param uuid. * This function may return an empty list if the connection is inactive, this behaviour is * dependend on the specific network backend in use. */ @@ -1088,6 +1111,12 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject */ virtual bool wiFiEnabled() = 0; + /** + * @return a list of UUIDs of the default network devices, or an empty list if no such devices exist. + * The default network devices are normally the devices holding the highest priority default route. + */ + virtual TQStringList defaultNetworkDevices() = 0; + signals: /** * Emitted whenever the state of the system's connection changes @@ -1147,7 +1176,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject /** * @return a pointer to a TDENetworkDevice object with the specified @param uuid, - * or a NULL pointer if no such connection exists. + * or a NULL pointer if no such device exists. * * Note that the returned object is internally managed and must not be deleted! */ @@ -1166,6 +1195,16 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject */ static TQString friendlyConnectionTypeName(TDENetworkConnectionType::TDENetworkConnectionType type); + /** + * @return true if @param address is valid, false if not + */ + static bool validateIPAddress(TQHostAddress address); + + /** + * @return true if @param netmask is valid, false if not + */ + static bool validateIPNeworkMask(TQHostAddress netmask); + protected: /** * @internal Safely clears out the master connection list and deletes all member objects @@ -1275,9 +1314,13 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject /** * @param connection a pointer to a TDENetworkConnection object containing a * connection for which to verify integrity of all settings. + * @param type a pointer to an TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags + * which will be filled with the generic error type code if provided. + * @param reason a pointer to a TDENetworkErrorStringMap which will be filled with translated + * strings containing the reason for the failure if provided. * @return true on success, false if invalid settings are detected. */ - virtual bool verifyConnectionSettings(TDENetworkConnection* connection); + virtual bool verifyConnectionSettings(TDENetworkConnection* connection, TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags* type=NULL, TDENetworkErrorStringMap* reason=NULL); /** * Initiates a connection with UUID @param uuid. @@ -1311,7 +1354,8 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject virtual TDENetworkHWNeighborList* siteSurvey(); /** - * @return a TQStringList containing the UUIDs of all physical devices used by this connection + * @return a TQStringList containing the UUIDs of all physical devices used by the connection + * with UUID @param uuid. * This function may return an empty list if the connection is inactive, this behaviour is * dependend on the specific network backend in use. */ @@ -1344,6 +1388,12 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject */ virtual bool wiFiEnabled(); + /** + * @return a list of UUIDs of the default network devices, or an empty list if no such devices exist. + * The default network devices are normally the devices holding the highest priority default route. + */ + virtual TQStringList defaultNetworkDevices(); + signals: /** * Emitted whenever the state of the system's connection changes @@ -1397,7 +1447,7 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject /** * @return a pointer to a TDENetworkDevice object with the specified @param uuid, - * or a NULL pointer if no such connection exists. + * or a NULL pointer if no such device exists. * * Note that the returned object is internally managed and must not be deleted! */ -- cgit v1.2.1