From 32e6eba8731f7f3328ae287d0493d941dadec06f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 23 Aug 2012 18:19:49 -0500 Subject: Initial skeleton for network manager support --- tdecore/CMakeLists.txt | 15 +- .../network-manager/dbus/CMakeLists.txt | 88 +++++ .../network-manager/introspection/Makefile.am | 18 + .../introspection/nm-access-point.xml | 92 +++++ .../introspection/nm-active-connection.xml | 57 +++ .../introspection/nm-device-802-11-wireless.xml | 104 ++++++ .../introspection/nm-device-802-3-ethernet.xml | 33 ++ .../introspection/nm-device-cdma.xml | 15 + .../introspection/nm-device-gsm.xml | 15 + .../network-manager/introspection/nm-device.xml | 126 +++++++ .../introspection/nm-exported-connection.xml | 108 ++++++ .../introspection/nm-ip4-config.xml | 25 ++ .../introspection/nm-manager-client.xml | 63 ++++ .../network-manager/introspection/nm-manager.xml | 227 ++++++++++++ .../introspection/nm-ppp-manager.xml | 22 ++ .../network-manager/introspection/nm-settings.xml | 32 ++ .../introspection/nm-vpn-connection-only.xml | 136 +++++++ .../introspection/nm-vpn-connection.xml | 163 +++++++++ .../introspection/nm-vpn-manager.xml | 46 +++ .../introspection/nm-vpn-plugin.xml | 132 +++++++ .../network-manager/network-manager.cpp | 73 ++++ .../network-manager/network-manager.h | 48 +++ tdecore/tdehardwaredevices.cpp | 29 +- tdecore/tdehardwaredevices.h | 15 +- tdecore/tdenetworkconnections.cpp | 129 +++++++ tdecore/tdenetworkconnections.h | 398 +++++++++++++++++++++ 26 files changed, 2203 insertions(+), 6 deletions(-) create mode 100644 tdecore/networkbackends/network-manager/dbus/CMakeLists.txt create mode 100644 tdecore/networkbackends/network-manager/introspection/Makefile.am create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-access-point.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-active-connection.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-device-802-11-wireless.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-device-802-3-ethernet.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-device-cdma.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-device-gsm.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-device.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-exported-connection.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-ip4-config.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-manager-client.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-manager.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-ppp-manager.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-settings.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-vpn-connection-only.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-vpn-connection.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-vpn-manager.xml create mode 100644 tdecore/networkbackends/network-manager/introspection/nm-vpn-plugin.xml create mode 100644 tdecore/networkbackends/network-manager/network-manager.cpp create mode 100644 tdecore/networkbackends/network-manager/network-manager.h create mode 100644 tdecore/tdenetworkconnections.cpp create mode 100644 tdecore/tdenetworkconnections.h (limited to 'tdecore') diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 4fa1e4cca..a684dc59c 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -14,11 +14,18 @@ add_subdirectory( network ) add_subdirectory( kconfig_compiler ) add_subdirectory( hwlibdata ) + if( WITH_LIBART ) add_subdirectory( svgicons ) set( KDESVGICONS kdesvgicons-static ) endif( WITH_LIBART ) +if( WITH_NETWORK_MANAGER_BACKEND ) + add_subdirectory( networkbackends/network-manager/dbus ) + set ( TDENM_LIBRARIES tdenm_dbus-static ) + set ( TDENM_BACKEND_SOURCES networkbackends/network-manager/network-manager.cpp ) +endif( WITH_NETWORK_MANAGER_BACKEND ) + include_directories( ${TQT_INCLUDE_DIRS} @@ -42,7 +49,6 @@ link_directories( ${GAMIN_LIBDIR} ) - ##### headers ################################### install( FILES @@ -70,6 +76,7 @@ install( FILES kmanagerselection.h kmountpoint.h kuser.h klockfile.h kidna.h ktempdir.h kshell.h fixx11h.h kxerrorhandler.h tdelibs_export.h kde_file.h ktimezones.h tdehardwaredevices.h + tdenetworkconnections.h ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h DESTINATION ${INCLUDE_INSTALL_DIR} ) @@ -125,14 +132,16 @@ set( ${target}_SRCS ktempdir.cpp kshell.cpp kmountpoint.cpp kcalendarsystemjalali.cpp kprotocolinfo_tdecore.cpp kprotocolinfofactory.cpp kxerrorhandler.cpp kuser.cpp kconfigskeleton.cpp kconfigdialogmanager.cpp klockfile.cpp - kqiodevicegzip_p.cpp ktimezones.cpp tdehardwaredevices.cpp ksimpledirwatch.cpp + kqiodevicegzip_p.cpp ktimezones.cpp tdehardwaredevices.cpp tdenetworkconnections.cpp + ksimpledirwatch.cpp + ${TDENM_BACKEND_SOURCES} ) tde_add_library( ${target} SHARED AUTOMOC SOURCES ${${target}_SRCS} VERSION 4.2.0 EMBED tdecorenetwork-static - LINK ltdlc-static ${KDESVGICONS} DCOP-shared tdefx-shared ${ZLIB_LIBRARIES} ${LIBIDN_LIBRARIES} ${XCOMPOSITE_LIBRARIES} ICE SM udev ${GAMIN_LIBRARIES} + LINK ltdlc-static ${KDESVGICONS} DCOP-shared tdefx-shared ${ZLIB_LIBRARIES} ${LIBIDN_LIBRARIES} ${XCOMPOSITE_LIBRARIES} ICE SM udev ${GAMIN_LIBRARIES} ${TDENM_LIBRARIES} DEPENDENCIES dcopidl dcopidl2cpp DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt b/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt new file mode 100644 index 000000000..70371c6ad --- /dev/null +++ b/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt @@ -0,0 +1,88 @@ +################################################# +# +# (C) 2010 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} +) + + +##### tdenm_dbus (static) ######################### + +set( INTROSPECTIONPATH "${CMAKE_SOURCE_DIR}/tdecore/networkbackends/network-manager/introspection" ) + +# options: +# p - generate proxy files +# i - generate interface files +# n - generate node files + +function( add_dbus_xml option basename classname namespace xmlfile ) + if( classname ) + set( classname -c ${classname} ) + endif( ) + add_custom_command( OUTPUT ${basename}.cpp ${basename}.h + COMMAND ${DBUSXML2QT3_EXECUTABLE} -${option} ${basename} ${classname} -N ${namespace} ${INTROSPECTIONPATH}/${xmlfile} 2>/dev/null + DEPENDS ${INTROSPECTIONPATH}/${xmlfile} ) +endfunction( ) + +add_dbus_xml( p networkmanagerproxy NetworkManagerProxy DBus nm-manager.xml ) +add_dbus_xml( p networkmanagervpnproxy NetworkManagerVPNProxy DBus nm-vpn-manager.xml ) +add_dbus_xml( p deviceproxy DeviceProxy DBus nm-device.xml ) +add_dbus_xml( p wirelessproxy WirelessDeviceProxy DBus nm-device-802-11-wireless.xml ) +add_dbus_xml( p wiredproxy WiredDeviceProxy DBus nm-device-802-3-ethernet.xml ) +add_dbus_xml( p gsmproxy GSMDeviceProxy DBus nm-device-gsm.xml ) +add_dbus_xml( p cdmaproxy CDMADeviceProxy DBus nm-device-cdma.xml ) +add_dbus_xml( p accesspointproxy AccessPointProxy DBus nm-access-point.xml ) +add_dbus_xml( p activeconnectionproxy ActiveConnectionProxy DBus nm-active-connection.xml ) +add_dbus_xml( p vpnconnectionproxy VPNConnectionProxy DBus nm-vpn-connection-only.xml ) +add_dbus_xml( p vpnpluginproxy VPNPluginProxy DBus nm-vpn-plugin.xml ) +add_dbus_xml( i networkmanagersettings SettingsInterface DBus nm-settings.xml ) +add_dbus_xml( i connection "" DBus nm-exported-connection.xml ) + +add_custom_command( OUTPUT connectionnode.cpp connectionnode.h introspectableinterface.cpp introspectableinterface.h + COMMAND ${DBUSXML2QT3_EXECUTABLE} -n connectionnode -c ConnectionNode -N DBus ${INTROSPECTIONPATH}/nm-exported-connection.xml 2>/dev/null + COMMAND sed s/\#include\\ \\"secrets.h\\"// connectionnode.cpp > connectionnode.cpp_tmp + COMMAND sed s/\#include\\ \\"introspectable.h\\"/\#include\\ \\"introspectableinterface.h\\"/ connectionnode.cpp_tmp > connectionnode.cpp + COMMAND rm -f connectionnode.cpp_tmp + DEPENDS ${INTROSPECTIONPATH}/nm-exported-connection.xml ) + + +# generate moc files + +set( MOCHEADERS accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagervpnproxy.h wiredproxy.h + wirelessproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h gsmproxy.h cdmaproxy.h ) + +foreach( _header_file ${MOCHEADERS} ) + get_filename_component( _basename "${_header_file}" NAME_WE ) + set( _moc_file ${_basename}.moc ) + list( APPEND _moc_files ${_moc_file} ) + add_custom_command( OUTPUT ${_moc_file} + COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file} + DEPENDS ${_header_file} ) +endforeach( ) + +add_custom_command( OUTPUT mocfiles.cpp + COMMAND cat ${_moc_files} > mocfiles.cpp + DEPENDS ${_moc_files} ) + + +# build the library + +tde_add_library( tdenm_dbus STATIC_PIC + SOURCES + networkmanagerproxy.cpp networkmanagervpnproxy.cpp + deviceproxy.cpp wiredproxy.cpp wirelessproxy.cpp + accesspointproxy.cpp networkmanagersettings.cpp + connection.cpp connectionnode.cpp introspectableinterface.cpp + mocfiles.cpp activeconnectionproxy.cpp vpnconnectionproxy.cpp + vpnpluginproxy.cpp gsmproxy.cpp cdmaproxy.cpp +) diff --git a/tdecore/networkbackends/network-manager/introspection/Makefile.am b/tdecore/networkbackends/network-manager/introspection/Makefile.am new file mode 100644 index 000000000..b16f0aed3 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/Makefile.am @@ -0,0 +1,18 @@ +EXTRA_DIST = \ + nm-access-point.xml \ + nm-active-connection.xml \ + nm-device-802-11-wireless.xml \ + nm-device-802-3-ethernet.xml \ + nm-device-cdma.xml \ + nm-device-gsm.xml \ + nm-device.xml \ + nm-exported-connection.xml \ + nm-ip4-config.xml \ + nm-manager.xml \ + nm-manager-client.xml \ + nm-ppp-manager.xml \ + nm-settings.xml \ + nm-vpn-manager.xml \ + nm-vpn-plugin.xml \ + nm-vpn-connection.xml + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-access-point.xml b/tdecore/networkbackends/network-manager/introspection/nm-access-point.xml new file mode 100644 index 000000000..5a42f9552 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-access-point.xml @@ -0,0 +1,92 @@ + + + + + + Flags describing the capabilities of the access point. + + + Flags describing the access point's capabilities according to WPA (Wifi Protected Access). + + + Flags describing the access point's capabilities according to the RSN (Robust Secure Network) protocol. + + + The Service Set Identifier identifying the access point. + + + The radio channel frequency in use by the access point, in MHz. + + + The hardware address of the access point. + + + + Describes the operating mode of the access point. + + + The maximum bitrate this access point is capable of, in kilobits/second (Kb/s). + + + The current signal strength received from this access point. + + + + + + A dictionary mapping property names to variant boxed values + + + + + + Flags describing the general capabilities of the access point. + + + Null capability - says nothing about the access point. + + + Access point supports privacy measures. + + + + + Flags describing the security capabilities of the access point. + + + Null flag. + + + Access point supports pairwise 40-bit WEP encryption. + + + Access point supports pairwise 104-bit WEP encryption. + + + Access point supports pairwise TKIP encryption. + + + Access point supports pairwise CCMP encryption. + + + Access point supports a group 40-bit WEP cypher. + + + Access point supports a group 104-bit WEP cypher. + + + Access point supports a group TKIP cypher. + + + Access point supports a group CCMP cypher. + + + Access point supports PSK key management. + + + Access point supports 802.1x key management. + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-active-connection.xml b/tdecore/networkbackends/network-manager/introspection/nm-active-connection.xml new file mode 100644 index 000000000..f69d2f6fd --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-active-connection.xml @@ -0,0 +1,57 @@ + + + + + + The D-Bus service name providing this connection. + + + The path of the connection. + + + A specific object associated with the active connection. + + + The D-Bus service name that provides a connection with which this active connection is shared. + + + The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared. + + + Array of object paths representing devices which are part of this active connection. + + + The state of this active connection. + + + Whether this active connection is the default connection, i.e. whether it currently owns the default route. + + + + + + A dictionary mapping property names to variant boxed values + + + + + + + + The active connection is in an unknown state. + + + + + The connection is activating. + + + + + The connection is activated. + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-device-802-11-wireless.xml b/tdecore/networkbackends/network-manager/introspection/nm-device-802-11-wireless.xml new file mode 100644 index 000000000..6b31b3a83 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-device-802-11-wireless.xml @@ -0,0 +1,104 @@ + + + + + + + + + List of access point object paths + + + + Get the list of access points visible to this device. + + + + + + The hardware address of the device. + + + + + The operating mode of the wireless device. + + + + + + The bit rate currently used by the wireless device, in kilobits/second (Kb/s). + + + + + Object path of the access point currently used by the wireless device. + + + + + The capabilities of the wireless device. + + + + + + + A dictionary containing the FIXME: check changed parameters. + + + + Emitted when the wireless device's properties changed. + + + + + + + The object path of the newly found access point. + + + + Emitted when a new access point is found by the device. + + + + + + + The object path of the access point that has disappeared. + + + + Emitted when an access point disappears from view of the device. + + + + + + Flags describing the capabilities of a wireless device. + + + Null capability - syntactic sugar for no capabilities supported. Do not AND this with other capabilities! + + + The device supports the 40-bit WEP cypher. + + + The device supports the 104-bit WEP cypher. + + + The device supports the TKIP cypher. + + + The device supports the CCMP cypher. + + + The device supports the WPA encryption/authentication protocol. + + + The device supports the RSN encryption/authentication protocol. + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-device-802-3-ethernet.xml b/tdecore/networkbackends/network-manager/introspection/nm-device-802-3-ethernet.xml new file mode 100644 index 000000000..cccae99b8 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-device-802-3-ethernet.xml @@ -0,0 +1,33 @@ + + + + + + + + Hardware address of the device. + + + + + + Design speed of the device. + + + + + + Indicates whether the physical carrier is found (e.g. whether a cable is plugged in or not). + + + + + + + A dictionary mapping property names to variant boxed values + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-device-cdma.xml b/tdecore/networkbackends/network-manager/introspection/nm-device-cdma.xml new file mode 100644 index 000000000..2b43f8fdc --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-device-cdma.xml @@ -0,0 +1,15 @@ + + + + + + + + + A dictionary mapping property names to variant boxed values + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-device-gsm.xml b/tdecore/networkbackends/network-manager/introspection/nm-device-gsm.xml new file mode 100644 index 000000000..650d656a7 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-device-gsm.xml @@ -0,0 +1,15 @@ + + + + + + + + + A dictionary mapping property names to variant boxed values + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-device.xml b/tdecore/networkbackends/network-manager/introspection/nm-device.xml new file mode 100644 index 000000000..848942abb --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-device.xml @@ -0,0 +1,126 @@ + + + + + + + HAL UDI for the device. + + + + + The network interface offered by the device. + + + + + The driver handling the device. + + + + + Flags describing the capabilities of the device. + + + + + The IPv4 address bound to the device. FIXME: what about devices with >1 IP address? + + + + + The current state of the device. + + + + + Object path of the Ip4Config object describing the configuration of the device. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state. + + + + + Whether or not this device is managed by NetworkManager. + + + + + + + + + + + + + + The new state of the device. + + + + + + + + The device is in an unknown state. + + + + + The device is down. + + + + + The device is not connected. + + + + + The device is preparing to connect. + + + + + The device is being configured. + + + + + The device is awaiting authorization credentials. + + + + + The IP address of the device is being configured. + + + + + The device is active. + + + + + The device is in a failure state following an attempt to activate it. + + + + + The previous activation attempt on this device was cancelled. + + + + + + Null capability. + + + The device is supported by NetworkManager. + + + The device supports carrier detection. + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-exported-connection.xml b/tdecore/networkbackends/network-manager/introspection/nm-exported-connection.xml new file mode 100644 index 000000000..251ccafd4 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-exported-connection.xml @@ -0,0 +1,108 @@ + + + + + + + Represents a single network connection configuration. + + + + Obtain the ID of this connection. + + + + + The ID of this connection. + + + + + + + Update the connection. + + + + + New connection properties. + + + + + + + Delete the connection. + + + + + + + Get the settings maps describing this object. + + + + + The nested settings maps describing this object. + + + + + + + Emitted when some settings changed. + + + + Contains the changed settings. + + + + + + + Emitted when this settings object was removed. FIXME: Is this emitted after it was removed or when it is about to be removed? If after removed, then different semantics to Device removed. if prior to removal, should be called AboutToBeRemoved. + + + + + + + + Secrets have a separate interface so that they can be locked down. + + + + + Get the secrets encapsulated in this object. + + + + + + Name of the setting to return. + + + + + Array of strings of key names in the Setting for which NM thinks + a secrets may be required. + + + + + Indicates whether new secrets should be requested or if the request can be fulfilled from storage. + + + + + + Nested settings maps containing secrets. Each setting MUST contain at least the 'name' field, containing the name of the setting, and one or more secrets. + + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-ip4-config.xml b/tdecore/networkbackends/network-manager/introspection/nm-ip4-config.xml new file mode 100644 index 000000000..8e3bf573c --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-ip4-config.xml @@ -0,0 +1,25 @@ + + + + + + Tuples of IPv4 address/netmask/gateway. The gateway is optional, if not given should be 0. + + + The hostname associated with this IPv4 address. FIXME: what about multiple hostnames? + + + The nameservers in use. + + + A list of domains this address belongs to. + + + The NIS domain this address belongs to. + + + The NIS servers associated with this address. + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-manager-client.xml b/tdecore/networkbackends/network-manager/introspection/nm-manager-client.xml new file mode 100644 index 000000000..cf8961143 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-manager-client.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-manager.xml b/tdecore/networkbackends/network-manager/introspection/nm-manager.xml new file mode 100644 index 000000000..a93ee5897 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-manager.xml @@ -0,0 +1,227 @@ + + + + + + + + + Get the list of network devices. + + + + + List of object paths of network devices known to the system. + + + + + + + + + Activate a connection using the supplied device. + + + + The D-Bus service name of the settings service that provides this connection. + + + + + The connection to activate the devices with. + + + + + The device to be activated. + + + + + The path of a device-type-specific object this activation should use, for example a WiFi access point. + + + + + The path of the active connection object representing this active connection. + + + + + + + + Another connection is already activating or the same connection is already active. FIXME: check if the error name is correct. FIXME: split into 2 errors? + + + The connection is invalid for this device. + + + + + + + Deactivate an active connection. + + + + + The currently active connection to deactivate. + + + + + + + + Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated. When awake, devices are available to be activated. + + + + Indicates whether the NetworkManager daemon should sleep or wake. + + + + + + + Indicates if wireless is currently enabled or not. + + + + + + Indicates if the wireless hardware is currently enabled, i.e. the state of the RF kill switch. + + + + + + List of active connection object paths. + + + + + + The overall state of the NetworkManager daemon. + + + + + + NetworkManager's state changed. + + + + The new state of NetworkManager. + + + + + + + NetworkManager's properties changed. + + + + The changed properties. + + + + + + + A device was added to the system + + + + The object path of the newly added device. + + + + + + + A device was removed from the system, and is no longer available. + + + + The object path of the device that was just removed. + + + + + + + Describes the overall state of the daemon. + + + + The NetworkManager daemon is in an unknown state. + + + + + The NetworkManager daemon is asleep and all interfaces managed by it are inactive. + + + + + The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting? + + + + + The NetworkManager daemon is connected. + + + + + The NetworkManager daemon is disconnected. + + + + + + + + + DEPRECATED. NetworkManager's state changed. Use the 'StateChanged' signal instead. + + + + The new state of NetworkManager. + + + + + + + DEPRECATED. Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated. + + + + + + + DEPRECATED. Control the NetworkManager daemon's sleep state. When awake, all known interfaces are available to be activated. + + + + + + + DEPRECATED. The overall state of the NetworkManager daemon. + + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-ppp-manager.xml b/tdecore/networkbackends/network-manager/introspection/nm-ppp-manager.xml new file mode 100644 index 000000000..9e2dfdb1c --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-ppp-manager.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-settings.xml b/tdecore/networkbackends/network-manager/introspection/nm-settings.xml new file mode 100644 index 000000000..5e072f264 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-settings.xml @@ -0,0 +1,32 @@ + + + + + + The NetworkManagerSettings interface is provided by the service which provides connections to NetworkManager. + + + + + List the connections stored by this Settings object. + + + + + List of connections. + + + + + + + Emitted when a new connection has been configured. + + + + Object path of the new connection. + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection-only.xml b/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection-only.xml new file mode 100644 index 000000000..8feee0335 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection-only.xml @@ -0,0 +1,136 @@ + + + + + + Represents an active connection to a Virtual Private Network. + + + + + + A dictionary mapping property names to variant boxed values + + + + + + The VPN-specific state of the connection. + + + The banner string of the VPN connection. + + + + + Emitted when the state of the VPN connection has changed. + + + + The new state of the VPN connection. + + + + + Reason code describing the change to the new state. + + + + + + + + The state of the VPN connection is unknown. + + + + + The VPN connection is preparing to connect. + + + + + The VPN connection needs authorization credentials. + + + + + The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED. + + + + + The VPN connection is getting an IP address. FIXME: Should be an -ING + + + + + The VPN connection is active. + + + + + The VPN connection failed. + + + + + The VPN connection is disconnected. + + + + + + + The reason for the VPN connection state change is unknown. + + + + + No reason was given for the VPN connection state change. + + + + + The VPN connection changed state because the user disconnected it. + + + + + The VPN connection changed state because the device it was using was disconnected. + + + + + The service providing the VPN connection was stopped. + + + + + The IP config of the VPN connection was invalid. + + + + + The connection attempt to the VPN service timed out. + + + + + A timeout occurred while starting the service providing the VPN connection. + + + + + Starting the service starting the service providing the VPN connection failed. + + + + + Necessary secrets for the VPN connection were not provided. + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection.xml b/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection.xml new file mode 100644 index 000000000..e5f74e142 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-vpn-connection.xml @@ -0,0 +1,163 @@ + + + + + + The D-Bus service name providing this connection. + + + The path of the connection. + + + A specific object associated with the active connection. + + + The D-Bus service name that provides a connection with which this active connection is shared. + + + The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared. + + + Array of object paths representing devices which are part of this active connection. + + + The state of this active connection. + + + Whether this active connection is the default connection, i.e. whether it currently owns the default route. + + + + + + Represents an active connection to a Virtual Private Network. + + + + + + A dictionary mapping property names to variant boxed values + + + + + + The VPN-specific state of the connection. + + + The banner string of the VPN connection. + + + + + Emitted when the state of the VPN connection has changed. + + + + The new state of the VPN connection. + + + + + Reason code describing the change to the new state. + + + + + + + + The state of the VPN connection is unknown. + + + + + The VPN connection is preparing to connect. + + + + + The VPN connection needs authorization credentials. + + + + + The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED. + + + + + The VPN connection is getting an IP address. FIXME: Should be an -ING + + + + + The VPN connection is active. + + + + + The VPN connection failed. + + + + + The VPN connection is disconnected. + + + + + + + The reason for the VPN connection state change is unknown. + + + + + No reason was given for the VPN connection state change. + + + + + The VPN connection changed state because the user disconnected it. + + + + + The VPN connection changed state because the device it was using was disconnected. + + + + + The service providing the VPN connection was stopped. + + + + + The IP config of the VPN connection was invalid. + + + + + The connection attempt to the VPN service timed out. + + + + + A timeout occurred while starting the service providing the VPN connection. + + + + + Starting the service starting the service providing the VPN connection failed. + + + + + Necessary secrets for the VPN connection were not provided. + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-vpn-manager.xml b/tdecore/networkbackends/network-manager/introspection/nm-vpn-manager.xml new file mode 100644 index 000000000..57665f61a --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-vpn-manager.xml @@ -0,0 +1,46 @@ + + + + + + + Establish a VPN connection. + + + + + String describing the connection type. + + + + + Object path of the network connection to establish the VPN connection on. + + + + + Object path of the device to establish the VPN connection on. + + + + + Object path of the newly created VPN connection. + + + + + + + Get the list of active VPN connections. + + + + + List of object paths of active VPN connections. + + + + + + + diff --git a/tdecore/networkbackends/network-manager/introspection/nm-vpn-plugin.xml b/tdecore/networkbackends/network-manager/introspection/nm-vpn-plugin.xml new file mode 100644 index 000000000..e7647e1d6 --- /dev/null +++ b/tdecore/networkbackends/network-manager/introspection/nm-vpn-plugin.xml @@ -0,0 +1,132 @@ + + + + + + This interface is provided by plugins providing VPN services to the NetworkManager daemon. + + + + Tells the plugin to connect. + + + + + Describes the connection to be established. + + + + + + + + + + + + + + Asks the plugin whether the provided connection will require secrets to connect successfully. + + + + + Describes the connection that may need secrets. + + + + + The setting name within the provided connection that requires secrets, if any. + + + + + + + + + + Disconnect the plugin. + + + + + + + + + + + Set IPv4 details on the connection. + + + + + Ip4Config details for the conneciton. + + + + + + + Indicate a failure to the plugin. + + + + + The reason for the failure. + + + + + + + The state of the plugin. + + + + + + Emitted when the plugin state changes. + + + + The new state of the plugin. + + + + + + + The plugin obtained an IPv4 configuration. + + + + The IPv4 configuration. + + + + + + + Emitted when the plugin receives a login banner from the VPN service. + + + + The login banner string. + + + + + + + Emitted when a failure in the VPN plugin occurs. + + + + Reason code for the failure. + + + + + diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp new file mode 100644 index 000000000..fcd2f8abc --- /dev/null +++ b/tdecore/networkbackends/network-manager/network-manager.cpp @@ -0,0 +1,73 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson + + 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. +*/ + +#include "network-manager.h" + +TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) { + // +} + +TDENetworkConnectionManager_BackendNM::~TDENetworkConnectionManager_BackendNM() { + // +} + +TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnectionManager_BackendNM::connectionType() { + // +} + +TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags TDENetworkConnectionManager_BackendNM::backendStatus() { + // +} + +TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInformation() { + // +} + +void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { + // +} + +bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection connection) { + // +} + +bool TDENetworkConnectionManager_BackendNM::deleteConnection(TQString uuid) { + // +} + +TDENetworkConnectionList* TDENetworkConnectionManager_BackendNM::connections() { + // +} + +TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::initiateConnection(TQString uuid) { + // +} + +TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::checkConnectionStatus(TQString uuid) { + // +} + +TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::deactivateConnection(TQString uuid) { + // +} + +TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() { + // +} + +#include "network-manager.moc" \ No newline at end of file diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h new file mode 100644 index 000000000..40dc725d4 --- /dev/null +++ b/tdecore/networkbackends/network-manager/network-manager.h @@ -0,0 +1,48 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson + + 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 _TDENETWORKBACKEND_NETWORKMANAGER_H +#define _TDENETWORKBACKEND_NETWORKMANAGER_H + +#include "tdenetworkconnections.h" + +class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkConnectionManager +{ + Q_OBJECT + + public: + TDENetworkConnectionManager_BackendNM(TQString macAddress); + ~TDENetworkConnectionManager_BackendNM(); + + virtual TDENetworkConnectionType::TDENetworkConnectionType connectionType(); + virtual TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus(); + virtual TDENetworkDeviceInformation deviceInformation(); + + virtual void loadConnectionInformation(); + virtual bool saveConnection(TDENetworkConnection connection); + virtual bool deleteConnection(TQString uuid); + + virtual TDENetworkConnectionList* connections(); + + virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid); + virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid); + virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus deactivateConnection(TQString uuid); + + virtual TDENetworkHWNeighborList* siteSurvey(); +}; + +#endif // _TDENETWORKBACKEND_NETWORKMANAGER_H \ No newline at end of file diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index 8fdbcf07e..ab3c06e91 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -16,6 +16,8 @@ Boston, MA 02110-1301, USA. */ +#define USE_NETWORKMANAGER_NETWORK_BACKEND + #include #include @@ -56,6 +58,13 @@ #include #include +// Network connection manager +#include "tdenetworkconnections.h" + +#ifdef USE_NETWORKMANAGER_NETWORK_BACKEND +#include "networkbackends/network-manager/network-manager.h" +#endif // USE_NETWORKMANAGER_NETWORK_BACKEND + // BEGIN BLOCK // Copied from include/linux/genhd.h #define GENHD_FL_REMOVABLE 1 @@ -1314,6 +1323,7 @@ TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt m_txbytes = -1; m_rxpackets = -1; m_txpackets = -1; + m_connectionManager = NULL; } TDENetworkDevice::~TDENetworkDevice() { @@ -1447,6 +1457,20 @@ void TDENetworkDevice::internalSetTxPackets(double tx) { m_txpackets = tx; } +TDENetworkConnectionManager* TDENetworkDevice::connectionManager() { +#ifdef USE_NETWORKMANAGER_NETWORK_BACKEND + if (!m_connectionManager) { + m_connectionManager = new TDENetworkConnectionManager_BackendNM(m_macAddress); + } +#endif // USE_NETWORKMANAGER_NETWORK_BACKEND + + return m_connectionManager; +} + +void TDENetworkDevice::internalSetConnectionManager(TDENetworkConnectionManager* mgr) { + m_connectionManager = mgr; +} + TDEBacklightDevice::TDEBacklightDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { } @@ -2837,8 +2861,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD } // Many devices do not provide their vendor/model ID via udev - // Go after it manually... - if (devicevendorid.isNull() || devicemodelid.isNull()) { + // Worse, sometimes udev provides an invalid model ID! + // Go after it manually if needed... + if (devicevendorid.isNull() || devicemodelid.isNull() || devicemodelid.contains("/")) { if (devicemodalias != TQString::null) { // For added fun the device string lengths differ between pci and usb if (devicemodalias.startsWith("pci")) { diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h index db94b31cc..819dfd85b 100644 --- a/tdecore/tdehardwaredevices.h +++ b/tdecore/tdehardwaredevices.h @@ -39,6 +39,8 @@ * @author Timothy Pearson */ +class TDENetworkConnectionManager; + // Keep readGenericDeviceTypeFromString(), getFriendlyDeviceTypeStringFromType(), and getDeviceTypeIconFromType() in tdehardwaredevices.cpp in sync with this enum namespace TDEGenericDeviceType { enum TDEGenericDeviceType { @@ -1172,6 +1174,11 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice */ double txPackets(); + /** + * @return a pointer to a TDENetworkConnectionManager object, if available + */ + TDENetworkConnectionManager* connectionManager(); + protected: /** * @param ma a TQString containing the network device's MAC address @@ -1269,6 +1276,11 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice */ void internalSetTxPackets(double tx); + /** + * @param mgr a pointer to a TDENetworkConnectionManager object, if available + */ + void internalSetConnectionManager(TDENetworkConnectionManager* mgr); + private: TQString m_macAddress; TQString m_state; @@ -1286,6 +1298,7 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice double m_txbytes; double m_rxpackets; double m_txpackets; + TDENetworkConnectionManager* m_connectionManager; friend class TDEHardwareDevices; }; @@ -2032,4 +2045,4 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject friend class TDECPUDevice; }; -#endif +#endif // _TDEHARDWAREDEVICES_H diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp new file mode 100644 index 000000000..e137457ed --- /dev/null +++ b/tdecore/tdenetworkconnections.cpp @@ -0,0 +1,129 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson + + 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. +*/ + +#include "tdehardwaredevices.h" +#include "tdenetworkconnections.h" + +/*================================================================================================*/ +/* TDENetworkIPConfiguration */ +/*================================================================================================*/ + +TDENetworkIPConfiguration::TDENetworkIPConfiguration() { + valid = false; + connectionFlags = TDENetworkIPConfigurationFlags::Invalid; +} + +TDENetworkIPConfiguration::~TDENetworkIPConfiguration() { + // +} + +/*================================================================================================*/ +/* TDENetworkWiFiDeviceInfo */ +/*================================================================================================*/ + +TDENetworkWiFiDeviceInfo::TDENetworkWiFiDeviceInfo() { + valid = false; +} + +TDENetworkWiFiDeviceInfo::~TDENetworkWiFiDeviceInfo() { + // +} + +/*================================================================================================*/ +/* TDENetworkDeviceInformation */ +/*================================================================================================*/ + +TDENetworkDeviceInformation::TDENetworkDeviceInformation() { + valid = false; + statusFlags = TDENetworkConnectionStatus::Invalid; + capabilityFlags = TDENetworkDeviceCapabilityFlags::None; +} + +TDENetworkDeviceInformation::~TDENetworkDeviceInformation() { + // +} + +/*================================================================================================*/ +/* TDENetworkHWNeighbor */ +/*================================================================================================*/ + +TDENetworkHWNeighbor::TDENetworkHWNeighbor() { + valid = false; +} + +TDENetworkHWNeighbor::~TDENetworkHWNeighbor() { + // +} + +/*================================================================================================*/ +/* TDENetworkWiFiAPInfo */ +/*================================================================================================*/ + +TDENetworkWiFiAPInfo::TDENetworkWiFiAPInfo() : TDENetworkHWNeighbor() { + // +} + +TDENetworkWiFiAPInfo::~TDENetworkWiFiAPInfo() { + // +} + +/*================================================================================================*/ +/* TDENetworkConnection */ +/*================================================================================================*/ + +TDENetworkConnection::TDENetworkConnection() : TQObject() { + // +} + +TDENetworkConnection::~TDENetworkConnection() { + // +} + +/*================================================================================================*/ +/* TDEWiFiConnection */ +/*================================================================================================*/ + +TDEWiFiConnection::TDEWiFiConnection() : TDENetworkConnection() { + // +} + +TDEWiFiConnection::~TDEWiFiConnection() { + // +} + +/*================================================================================================*/ +/* TDENetworkConnectionManager */ +/*================================================================================================*/ + +TDENetworkConnectionManager::TDENetworkConnectionManager(TQString macAddress) : TQObject(), m_connectionList(NULL), m_macAddress(macAddress) { + // +} + +TDENetworkConnectionManager::~TDENetworkConnectionManager() { + // +} + +TQString TDENetworkConnectionManager::deviceMACAddress() { + return m_macAddress; +} + +/*================================================================================================*/ +/* End */ +/*================================================================================================*/ + +#include "tdenetworkconnections.moc" \ No newline at end of file diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h new file mode 100644 index 000000000..05c4bb591 --- /dev/null +++ b/tdecore/tdenetworkconnections.h @@ -0,0 +1,398 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson + + 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 +#include +#include +#include +#include "kiconloader.h" +#include "tdelibs_export.h" + +#define CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(x) \ + inline x operator|(x a, x b) \ + { \ + return static_cast(static_cast(a) | static_cast(b)); \ + } \ + \ + inline x operator&(x a, x b) \ + { \ + return static_cast(static_cast(a) & static_cast(b)); \ + } \ + \ + inline x operator~(x a) \ + { \ + return static_cast(~static_cast(a)); \ + } + +namespace TDENetworkConnectionType { +enum TDENetworkConnectionType { + 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 TDENetworkConnectionStatus { + enum TDENetworkConnectionStatus { + Invalid = 0x00000000, + Disconnected = 0x00000001, + Connected = 0x00000002, + LinkUnavailable = 0x00000004, + EstablishingLink = 0x00000008, + ConfiguringProtocols = 0x00000010, + Reconnecting = 0x00000020, + LinkLost = 0x00000040, + LinkLocalAccess = 0x00000080, + SiteLocalAccess = 0x00000100, + GlobalAccess = 0x00000200, + UnManaged = 0x00000400, + NeedAuthorization = 0x00000800, + Failed = 0x00001000, + VerifyingProtocols = 0x00002000, + DependencyWait = 0x00004000 + }; + + CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkConnectionStatus) +}; + +namespace TDENetworkIPConfigurationFlags { + enum TDENetworkIPConfigurationFlags { + Invalid = 0x00000000, + IPV4 = 0x00000001, + IPV6 = 0x00000002, + DHCP = 0x00000004, + StaticIP = 0x00000008 + }; + + CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIPConfigurationFlags) +}; + +class TDECORE_EXPORT TDENetworkIPConfiguration +{ + public: + TDENetworkIPConfiguration(); + ~TDENetworkIPConfiguration(); + + public: + bool valid; + TDENetworkIPConfigurationFlags::TDENetworkIPConfigurationFlags connectionFlags; + TQString ipAddress; + TQString networkMask; + TQString gateway; + TQString broadcast; + TQString destination; +}; + +class TDECORE_EXPORT TDENetworkWiFiDeviceInfo +{ + public: + TDENetworkWiFiDeviceInfo(); + ~TDENetworkWiFiDeviceInfo(); + + public: + bool valid; + TQString hwAddress; + TQString 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 wirelessInfo; +}; + +class TDECORE_EXPORT TDENetworkHWNeighbor +{ + public: + TDENetworkHWNeighbor(); + ~TDENetworkHWNeighbor(); + + public: + bool valid; +}; + +class TDECORE_EXPORT TDENetworkWiFiAPInfo : public TDENetworkHWNeighbor +{ + public: + TDENetworkWiFiAPInfo(); + ~TDENetworkWiFiAPInfo(); + + public: + TQString SSID; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags; + unsigned int frequency; + TQString BSSID; + unsigned int maxBitrate; + double signalQuality; +}; + +typedef TQPtrList< TDENetworkHWNeighbor > TDENetworkHWNeighborList; + +class TDECORE_EXPORT TDENetworkConnection : public TQObject +{ + Q_OBJECT + + public: + TDENetworkConnection(); + ~TDENetworkConnection(); + + public: + TQString UUID; + TQString friendlyName; + TDENetworkIPConfiguration ipConfig; + bool autoConnect; +}; + +class TDECORE_EXPORT TDEWiFiConnection : public TDENetworkConnection +{ + Q_OBJECT + + public: + TDEWiFiConnection(); + ~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 + */ + 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 + */ + virtual void loadConnectionInformation() = 0; + + /** + * @param connection 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; + + /** + * @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() = 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; + + private: + TDENetworkConnectionList* m_connectionList; + TQString m_macAddress; +}; + +#endif // _TDENETWORKCONNECTIONS_H \ No newline at end of file -- cgit v1.2.1