diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-23 18:19:49 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-23 18:19:49 -0500 |
commit | 32e6eba8731f7f3328ae287d0493d941dadec06f (patch) | |
tree | ac81ffbe137bb27cbd5681f25324f2ae340cd294 | |
parent | 38f05d1e1d61ac758d820a3923e2922337d9908e (diff) | |
download | tdelibs-32e6eba8731f7f3328ae287d0493d941dadec06f.tar.gz tdelibs-32e6eba8731f7f3328ae287d0493d941dadec06f.zip |
Initial skeleton for network manager support
27 files changed, 2229 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ceaa5eb6f..78d72aa9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,7 @@ OPTION( WITH_PCRE "Enable pcre regex support for kjs" ON ) OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) OPTION( WITH_INOTIFY "Enable inotify support for kio" ON ) OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} ) +OPTION( WITH_NETWORK_MANAGER_BACKEND "Enable network-manager support" OFF ) OPTION( WITH_ASPELL "Enable aspell support" ${WITH_ALL_OPTIONS} ) OPTION( WITH_HSPELL "Enable hspell support" ${WITH_ALL_OPTIONS} ) @@ -767,6 +768,31 @@ if( WITH_PCRE ) endif( ) +if( WITH_NETWORK_MANAGER_BACKEND ) + ##### check for dbus-1 ########################### + pkg_search_module( DBUS dbus-1 ) + if( NOT DBUS_FOUND ) + tde_message_fatal( "dbus-1 are required, but not found on your system" ) + endif( ) + + + ##### check for dbus-1-tqt ########################### + pkg_search_module( DBUS_TQT dbus-1-tqt ) + if( DBUS_TQT_FOUND ) + find_program( DBUSXML2QT3_EXECUTABLE NAMES dbusxml2qt3 ) + else() + tde_message_fatal( "dbus-1-tqt are required, but not found on your system" ) + endif( ) + + + ##### check for libnm-util ########################### + pkg_search_module( NM_UTIL libnm-util ) + if( NOT NM_UTIL_FOUND ) + tde_message_fatal( "libnm-util are required, but not found on your system" ) + endif( ) +endif( WITH_NETWORK_MANAGER_BACKEND ) + + ##### check for gcc visibility support ######### # FIXME # This should check for [T]Qt3 visibility support 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.AccessPoint"> + <property name="Flags" type="u" access="read" tp:type="NM_802_11_AP_FLAGS"> + <tp:docstring>Flags describing the capabilities of the access point.</tp:docstring> + </property> + <property name="WpaFlags" type="u" access="read" tp:type="NM_802_11_AP_SEC"> + <tp:docstring>Flags describing the access point's capabilities according to WPA (Wifi Protected Access).</tp:docstring> + </property> + <property name="RsnFlags" type="u" access="read" tp:type="NM_802_11_AP_SEC"> + <tp:docstring>Flags describing the access point's capabilities according to the RSN (Robust Secure Network) protocol.</tp:docstring> + </property> + <property name="Ssid" type="ay" access="read"> + <tp:docstring>The Service Set Identifier identifying the access point.</tp:docstring> + </property> + <property name="Frequency" type="u" access="read"> + <tp:docstring>The radio channel frequency in use by the access point, in MHz.</tp:docstring> + </property> + <property name="HwAddress" type="s" access="read"> + <tp:docstring>The hardware address of the access point.</tp:docstring> + </property> + + <property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE"> + <tp:docstring>Describes the operating mode of the access point.</tp:docstring> + </property> + <property name="MaxBitrate" type="u" access="read"> + <tp:docstring>The maximum bitrate this access point is capable of, in kilobits/second (Kb/s).</tp:docstring> + </property> + <property name="Strength" type="y" access="read"> + <tp:docstring>The current signal strength received from this access point.</tp:docstring> + </property> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + <tp:flags name="NM_802_11_AP_FLAGS" value-prefix="NM_802_11_AP_FLAGS" type="u"> + <tp:docstring> + Flags describing the general capabilities of the access point. + </tp:docstring> + <tp:flag suffix="NONE" value="0x0"> + <tp:docstring>Null capability - says nothing about the access point.</tp:docstring> + </tp:flag> + <tp:flag suffix="PRIVACY" value="0x1"> + <tp:docstring>Access point supports privacy measures.</tp:docstring> + </tp:flag> + </tp:flags> + <tp:flags name="NM_802_11_AP_SEC" value-prefix="NM_802_11_AP_SEC" type="u"> + <tp:docstring> + Flags describing the security capabilities of the access point. + </tp:docstring> + <tp:flag suffix="NONE" value="0x0"> + <tp:docstring>Null flag.</tp:docstring> + </tp:flag> + <tp:flag suffix="PAIR_WEP40" value="0x1"> + <tp:docstring>Access point supports pairwise 40-bit WEP encryption.</tp:docstring> + </tp:flag> + <tp:flag suffix="PAIR_WEP104" value="0x2"> + <tp:docstring>Access point supports pairwise 104-bit WEP encryption.</tp:docstring> + </tp:flag> + <tp:flag suffix="PAIR_TKIP" value="0x4"> + <tp:docstring>Access point supports pairwise TKIP encryption.</tp:docstring> + </tp:flag> + <tp:flag suffix="PAIR_CCMP" value="0x8"> + <tp:docstring>Access point supports pairwise CCMP encryption.</tp:docstring> + </tp:flag> + <tp:flag suffix="GROUP_WEP40" value="0x10"> + <tp:docstring>Access point supports a group 40-bit WEP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="GROUP_WEP104" value="0x20"> + <tp:docstring>Access point supports a group 104-bit WEP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="GROUP_TKIP" value="0x40"> + <tp:docstring>Access point supports a group TKIP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="GROUP_CCMP" value="0x80"> + <tp:docstring>Access point supports a group CCMP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="KEY_MGMT_PSK" value="0x100"> + <tp:docstring>Access point supports PSK key management.</tp:docstring> + </tp:flag> + <tp:flag suffix="KEY_MGMT_802_1X" value="0x200"> + <tp:docstring>Access point supports 802.1x key management.</tp:docstring> + </tp:flag> + </tp:flags> + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Connection.Active"> + <property name="ServiceName" type="s" access="read"> + <tp:docstring>The D-Bus service name providing this connection.</tp:docstring> + </property> + <property name="Connection" type="o" access="read"> + <tp:docstring>The path of the connection.</tp:docstring> + </property> + <property name="SpecificObject" type="o" access="read"> + <tp:docstring>A specific object associated with the active connection.</tp:docstring> + </property> + <property name="SharedServiceName" type="s" access="read"> + <tp:docstring>The D-Bus service name that provides a connection with which this active connection is shared.</tp:docstring> + </property> + <property name="SharedConnection" type="o" access="read"> + <tp:docstring>The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared.</tp:docstring> + </property> + <property name="Devices" type="ao" access="read"> + <tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring> + </property> + <property name="State" type="u" access="read" tp:type="NM_ACTIVE_DEVICE_STATE"> + <tp:docstring>The state of this active connection.</tp:docstring> + </property> + <property name="Default" type="b" access="read"> + <tp:docstring>Whether this active connection is the default connection, i.e. whether it currently owns the default route.</tp:docstring> + </property> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + <tp:enum name="NM_ACTIVE_CONNECTION_STATE" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The active connection is in an unknown state. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ACTIVATING" value="1"> + <tp:docstring> + The connection is activating. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ACTIVATED" value="2"> + <tp:docstring> + The connection is activated. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Device.Wireless"> + <method name="GetAccessPoints"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_get_access_points"/> + <arg name="access_points" type="ao" direction="out"> + <tp:docstring> + List of access point object paths + </tp:docstring> + </arg> + <tp:docstring> + Get the list of access points visible to this device. + </tp:docstring> + </method> + + <property name="HwAddress" type="s" access="read"> + <tp:docstring> + The hardware address of the device. + </tp:docstring> + </property> + <property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE"> + <tp:docstring> + The operating mode of the wireless device. + </tp:docstring> + </property> + + <property name="Bitrate" type="u" access="read"> + <tp:docstring> + The bit rate currently used by the wireless device, in kilobits/second (Kb/s). + </tp:docstring> + </property> + <property name="ActiveAccessPoint" type="o" access="read"> + <tp:docstring> + Object path of the access point currently used by the wireless device. + </tp:docstring> + </property> + <property name="WirelessCapabilities" type="u" access="read" tp:type="NM_802_11_DEVICE_CAP"> + <tp:docstring> + The capabilities of the wireless device. + </tp:docstring> + </property> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary containing the FIXME: check changed parameters. + </tp:docstring> + </arg> + <tp:docstring> + Emitted when the wireless device's properties changed. + </tp:docstring> + </signal> + + <signal name="AccessPointAdded"> + <arg name="access_point" type="o"> + <tp:docstring> + The object path of the newly found access point. + </tp:docstring> + </arg> + <tp:docstring> + Emitted when a new access point is found by the device. + </tp:docstring> + </signal> + + <signal name="AccessPointRemoved"> + <arg name="access_point" type="o"> + <tp:docstring> + The object path of the access point that has disappeared. + </tp:docstring> + </arg> + <tp:docstring> + Emitted when an access point disappears from view of the device. + </tp:docstring> + </signal> + + <tp:flags name="NM_802_11_DEVICE_CAP" type="u"> + <tp:docstring> + Flags describing the capabilities of a wireless device. + </tp:docstring> + <tp:flag suffix="NONE" value="0x0"> + <tp:docstring>Null capability - syntactic sugar for no capabilities supported. Do not AND this with other capabilities!</tp:docstring> + </tp:flag> + <tp:flag suffix="CIPHER_WEP40" value="0x1"> + <tp:docstring>The device supports the 40-bit WEP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="CIPHER_WEP104" value="0x2"> + <tp:docstring>The device supports the 104-bit WEP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="CIPHER_TKIP" value="0x4"> + <tp:docstring>The device supports the TKIP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="CIPHER_CCMP" value="0x8"> + <tp:docstring>The device supports the CCMP cypher.</tp:docstring> + </tp:flag> + <tp:flag suffix="WPA" value="0x10"> + <tp:docstring>The device supports the WPA encryption/authentication protocol.</tp:docstring> + </tp:flag> + <tp:flag suffix="RSN" value="0x20"> + <tp:docstring>The device supports the RSN encryption/authentication protocol.</tp:docstring> + </tp:flag> + </tp:flags> + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Device.Wired"> + + <property name="HwAddress" type="s" access="read"> + <tp:docstring> + Hardware address of the device. + </tp:docstring> + </property> + + <property name="Speed" type="u" access="read"> + <tp:docstring> + Design speed of the device. + </tp:docstring> + </property> + + <property name="Carrier" type="b" access="read"> + <tp:docstring> + Indicates whether the physical carrier is found (e.g. whether a cable is plugged in or not). + </tp:docstring> + </property> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Device.Cdma"> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Device.Gsm"> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Device"> + <property name="Udi" type="s" access="read"> + <tp:docstring> + HAL UDI for the device. + </tp:docstring> + </property> + <property name="Interface" type="s" access="read"> + <tp:docstring> + The network interface offered by the device. + </tp:docstring> + </property> + <property name="Driver" type="s" access="read"> + <tp:docstring> + The driver handling the device. + </tp:docstring> + </property> + <property name="Capabilities" type="u" access="read" tp:type="NM_DEVICE_CAP"> + <tp:docstring> + Flags describing the capabilities of the device. + </tp:docstring> + </property> + <property name="Ip4Address" type="i" access="read"> + <tp:docstring> + The IPv4 address bound to the device. FIXME: what about devices with >1 IP address? + </tp:docstring> + </property> + <property name="State" type="u" access="read" tp:type="NM_DEVICE_STATE"> + <tp:docstring> + The current state of the device. + </tp:docstring> + </property> + <property name="Ip4Config" type="o" access="read"> + <tp:docstring> + 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. + </tp:docstring> + </property> + <property name="Managed" type="b" access="read"> + <tp:docstring> + Whether or not this device is managed by NetworkManager. + </tp:docstring> + </property> + + <!-- Ugh, but I see no other way of getting the type on the caller + based on dbus object path only --> + <property name="DeviceType" type="u" access="read"> + <tp:docstring> + </tp:docstring> + </property> + + + <signal name="StateChanged"> + <arg name="state" type="u" tp:type="NM_DEVICE_STATE"> + <tp:docstring> + The new state of the device. + </tp:docstring> + </arg> + </signal> + + <tp:enum name="NM_DEVICE_STATE" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The device is in an unknown state. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DOWN" value="1"> + <tp:docstring> + The device is down. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DISCONNECTED" value="2"> + <tp:docstring> + The device is not connected. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="PREPARE" value="3"> + <tp:docstring> + The device is preparing to connect. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONFIG" value="4"> + <tp:docstring> + The device is being configured. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NEED_AUTH" value="5"> + <tp:docstring> + The device is awaiting authorization credentials. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="IP_CONFIG" value="6"> + <tp:docstring> + The IP address of the device is being configured. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ACTIVATED" value="7"> + <tp:docstring> + The device is active. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="FAILED" value="8"> + <tp:docstring> + The device is in a failure state following an attempt to activate it. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CANCELLED" value="9"> + <tp:docstring> + The previous activation attempt on this device was cancelled. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + <tp:flags name="NM_DEVICE_CAP" value-prefix="NM_DEVICE_CAP" type="u"> + <tp:flag suffix="NONE" value="0x0"> + <tp:docstring>Null capability.</tp:docstring> + </tp:flag> + <tp:flag suffix="NM_SUPPORTED" value="0x1"> + <tp:docstring>The device is supported by NetworkManager.</tp:docstring> + </tp:flag> + <tp:flag suffix="CARRIER_DETECT" value="0x2"> + <tp:docstring>The device supports carrier detection.</tp:docstring> + </tp:flag> + </tp:flags> + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + + <interface name="org.freedesktop.NetworkManagerSettings.Connection"> + <tp:docstring> + Represents a single network connection configuration. + </tp:docstring> + <method name="GetID"> + <tp:docstring> + Obtain the ID of this connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_id"/> + <arg name="id" type="s" direction="out"> + <tp:docstring> + The ID of this connection. + </tp:docstring> + </arg> + </method> + + <method name="Update"> + <tp:docstring> + Update the connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_update"/> + <arg name="properties" type="a{sa{sv}}" direction="in"> + <tp:docstring> + New connection properties. + </tp:docstring> + </arg> + </method> + + <method name="Delete"> + <tp:docstring> + Delete the connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_delete"/> + </method> + + <method name="GetSettings"> + <tp:docstring> + Get the settings maps describing this object. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_settings"/> + <arg name="settings" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map"> + <tp:docstring> + The nested settings maps describing this object. + </tp:docstring> + </arg> + </method> + + <signal name="Updated"> + <tp:docstring> + Emitted when some settings changed. + </tp:docstring> + <arg name="settings" type="a{sa{sv}}" tp:type="String_String_Variant_Map_Map"> + <tp:docstring> + Contains the changed settings. + </tp:docstring> + </arg> + </signal> + + <signal name="Removed"> + <tp:docstring> + 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. + </tp:docstring> + </signal> + + </interface> + + <interface name="org.freedesktop.NetworkManagerSettings.Connection.Secrets"> + <tp:docstring> + Secrets have a separate interface so that they can be locked down. + </tp:docstring> + + <method name="GetSecrets"> + <tp:docstring> + Get the secrets encapsulated in this object. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_secrets"/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg name="setting_name" type="s" direction="in"> + <tp:docstring> + Name of the setting to return. + </tp:docstring> + </arg> + <arg name="hints" type="as" direction="in"> + <tp:docstring> + Array of strings of key names in the Setting for which NM thinks + a secrets may be required. + </tp:docstring> + </arg> + <arg name="request_new" type="b" direction="in"> + <tp:docstring> + Indicates whether new secrets should be requested or if the request can be fulfilled from storage. + </tp:docstring> + </arg> + + <arg name="secrets" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map"> + <tp:docstring> + 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. + </tp:docstring> + </arg> + </method> + + </interface> + +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.IP4Config"> + <property name="Addresses" type="aau" access="read"> + <tp:docstring>Tuples of IPv4 address/netmask/gateway. The gateway is optional, if not given should be 0.</tp:docstring> + </property> + <property name="Hostname" type="s" access="read"> + <tp:docstring>The hostname associated with this IPv4 address. FIXME: what about multiple hostnames?</tp:docstring> + </property> + <property name="Nameservers" type="au" access="read"> + <tp:docstring>The nameservers in use.</tp:docstring> + </property> + <property name="Domains" type="as" access="read"> + <tp:docstring>A list of domains this address belongs to.</tp:docstring> + </property> + <property name="NisDomain" type="s" access="read"> + <tp:docstring>The NIS domain this address belongs to.</tp:docstring> + </property> + <property name="NisServers" type="au" access="read"> + <tp:docstring>The NIS servers associated with this address.</tp:docstring> + </property> + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- +READ ME! READ ME! READ ME! READ ME! READ ME! + +This file needs to be kept in sync with nm-manager.xml with the exception of +the legacy methods at the end of nm-manager.xml. + +This file is only used to ensure that a few legacy 0.6 D-DBus methods that +NM supports don't leak into libnm-glib, but are only exposed by the NMManager +object. dbus-glib generates the same bound function names for D-Bus the methods +"sleep" and "Sleep", unfortunately. +--> + +<node name="/"> + <interface name="org.freedesktop.NetworkManager"> + <method name="GetDevices"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_devices"/> + <arg name="devices" type="ao" direction="out"/> + </method> + + <method name="ActivateConnection"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_activate_connection"/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg name="service_name" type="s" direction="in"/> + <arg name="connection" type="o" direction="in"/> + <arg name="device" type="o" direction="in"/> + <arg name="specific_object" type="o" direction="in"/> + <arg name="active_connection" type="o" direction="out"/> + </method> + + <method name="DeactivateConnection"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/> + <arg name="active_connection" type="o" direction="in"/> + </method> + + <method name="Sleep"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/> + <arg name="sleep" type="b" direction="in"/> + </method> + + <property name="WirelessEnabled" type="b" access="readwrite"/> + <property name="WirelessHardwareEnabled" type="b" access="read"/> + <property name="ActiveConnections" type="ao" access="read"/> + <property name="State" type="u" access="read"/> + + <signal name="StateChanged"> + <arg name="state" type="u"/> + </signal> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}"/> + </signal> + + <signal name="DeviceAdded"> + <arg name="state" type="o"/> + </signal> + + <signal name="DeviceRemoved"> + <arg name="state" type="o"/> + </signal> + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + READ ME! READ ME! READ ME! READ ME! READ ME! + + This file needs to be kept in sync with nm-manager-client.xml with the exception of + the legacy methods at the end of this file. +--> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager"> + <method name="GetDevices"> + <tp:docstring> + Get the list of network devices. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_devices"/> + <arg name="devices" type="ao" direction="out"> + <tp:docstring> + List of object paths of network devices known to the system. + </tp:docstring> + </arg> + </method> + + <method name="ActivateConnection"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_activate_connection"/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <tp:docstring> + Activate a connection using the supplied device. + </tp:docstring> + <arg name="service_name" type="s" direction="in"> + <tp:docstring> + The D-Bus service name of the settings service that provides this connection. + </tp:docstring> + </arg> + <arg name="connection" type="o" direction="in"> + <tp:docstring> + The connection to activate the devices with. + </tp:docstring> + </arg> + <arg name="device" type="o" direction="in"> + <tp:docstring> + The device to be activated. + </tp:docstring> + </arg> + <arg name="specific_object" type="o" direction="in"> + <tp:docstring> + The path of a device-type-specific object this activation should use, for example a WiFi access point. + </tp:docstring> + </arg> + <arg name="active_connection" type="o" direction="out"> + <tp:docstring> + The path of the active connection object representing this active connection. + </tp:docstring> + </arg> + <tp:possible-errors> + <tp:error name="org.freedesktop.NetworkManager.Error.UnknownConnection"/> + <tp:error name="org.freedesktop.NetworkManager.Error.UnknownDevice"/> + <tp:error name="org.freedesktop.NetworkManager.Error.InvalidService"/> + <tp:error name="org.freedesktop.NetworkManager.Error.ConnectionActivating"> + <tp:docstring>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?</tp:docstring> + </tp:error> + <tp:error name="org.freedesktop.NetworkManager.Error.ConnectionInvalid"> + <tp:docstring>The connection is invalid for this device.</tp:docstring> + </tp:error> + </tp:possible-errors> + </method> + + <method name="DeactivateConnection"> + <tp:docstring> + Deactivate an active connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/> + <arg name="active_connection" type="o" direction="in"> + <tp:docstring> + The currently active connection to deactivate. + </tp:docstring> + </arg> + </method> + + <method name="Sleep"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/> + <tp:docstring> + Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated. When awake, devices are available to be activated. + </tp:docstring> + <arg name="sleep" type="b" direction="in"> + <tp:docstring> + Indicates whether the NetworkManager daemon should sleep or wake. + </tp:docstring> + </arg> + </method> + + <property name="WirelessEnabled" type="b" access="readwrite"> + <tp:docstring> + Indicates if wireless is currently enabled or not. + </tp:docstring> + </property> + + <property name="WirelessHardwareEnabled" type="b" access="read"> + <tp:docstring> + Indicates if the wireless hardware is currently enabled, i.e. the state of the RF kill switch. + </tp:docstring> + </property> + + <property name="ActiveConnections" type="ao" access="read"> + <tp:docstring> + List of active connection object paths. + </tp:docstring> + </property> + + <property name="State" type="u" access="read" tp:type="NM_STATE"> + <tp:docstring> + The overall state of the NetworkManager daemon. + </tp:docstring> + </property> + + <signal name="StateChanged"> + <tp:docstring> + NetworkManager's state changed. + </tp:docstring> + <arg name="state" type="u" tp:type="NM_STATE"> + <tp:docstring> + The new state of NetworkManager. + </tp:docstring> + </arg> + </signal> + + <signal name="PropertiesChanged"> + <tp:docstring> + NetworkManager's properties changed. + </tp:docstring> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + The changed properties. + </tp:docstring> + </arg> + </signal> + + <signal name="DeviceAdded"> + <tp:docstring> + A device was added to the system + </tp:docstring> + <arg name="device_path" type="o"> + <tp:docstring> + The object path of the newly added device. + </tp:docstring> + </arg> + </signal> + + <signal name="DeviceRemoved"> + <tp:docstring> + A device was removed from the system, and is no longer available. + </tp:docstring> + <arg name="device_path" type="o"> + <tp:docstring> + The object path of the device that was just removed. + </tp:docstring> + </arg> + </signal> + + <tp:enum name="NM_STATE" type="u"> + <tp:docstring> + Describes the overall state of the daemon. + </tp:docstring> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The NetworkManager daemon is in an unknown state. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ASLEEP" value="1"> + <tp:docstring> + The NetworkManager daemon is asleep and all interfaces managed by it are inactive. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECTING" value="2"> + <tp:docstring> + The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting? + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECTED" value="3"> + <tp:docstring> + The NetworkManager daemon is connected. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DISCONNECTED" value="4"> + <tp:docstring> + The NetworkManager daemon is disconnected. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + + <!-- Legacy methods to maintain backwards compatibility for 0.6 branch. --> + + <signal name="StateChange"> + <tp:docstring> + DEPRECATED. NetworkManager's state changed. Use the 'StateChanged' signal instead. + </tp:docstring> + <arg name="state" type="u" tp:type="NM_STATE"> + <tp:docstring> + The new state of NetworkManager. + </tp:docstring> + </arg> + </signal> + + <method name="sleep"> + <tp:docstring> + DEPRECATED. Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_sleep"/> + </method> + + <method name="wake"> + <tp:docstring> + DEPRECATED. Control the NetworkManager daemon's sleep state. When awake, all known interfaces are available to be activated. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_wake"/> + </method> + + <method name="state"> + <tp:docstring> + DEPRECATED. The overall state of the NetworkManager daemon. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_state"/> + <arg name="state" type="u" direction="out" tp:type="NM_STATE"/> + </method> + + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/"> + <interface name="org.freedesktop.NetworkManager.PPP"> + <method name="NeedSecrets"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_need_secrets"/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg name="username" type="s" direction="out"/> + <arg name="password" type="s" direction="out"/> + </method> + + <method name="SetIp4Config"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_set_ip4_config"/> + <arg name="config" type="a{sv}" direction="in"/> + </method> + + <method name="SetState"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_set_state"/> + <arg name="state" type="u" direction="in"/> + </method> + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManagerSettings"> + <tp:docstring> + The NetworkManagerSettings interface is provided by the service which provides connections to NetworkManager. + </tp:docstring> + + <method name="ListConnections"> + <tp:docstring> + List the connections stored by this Settings object. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_list_connections"/> + <arg name="connections" type="ao" direction="out"> + <tp:docstring> + List of connections. + </tp:docstring> + </arg> + </method> + + <signal name="NewConnection"> + <tp:docstring> + Emitted when a new connection has been configured. + </tp:docstring> + <arg name="connection" type="o"> + <tp:docstring> + Object path of the new connection. + </tp:docstring> + </arg> + </signal> + </interface> +</node> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.VPN.Connection"> + <tp:docstring> + Represents an active connection to a Virtual Private Network. + </tp:docstring> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + <property name="VpnState" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring>The VPN-specific state of the connection.</tp:docstring> + </property> + <property name="Banner" type="s" access="read"> + <tp:docstring>The banner string of the VPN connection.</tp:docstring> + </property> + + <signal name="VpnStateChanged"> + <tp:docstring> + Emitted when the state of the VPN connection has changed. + </tp:docstring> + <arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring> + The new state of the VPN connection. + </tp:docstring> + </arg> + <arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON"> + <tp:docstring> + Reason code describing the change to the new state. + </tp:docstring> + </arg> + </signal> + + <tp:enum name="NM_VPN_CONNECTION_STATE" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The state of the VPN connection is unknown. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="PREPARE" value="1"> + <tp:docstring> + The VPN connection is preparing to connect. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NEED_AUTH" value="2"> + <tp:docstring> + The VPN connection needs authorization credentials. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECT" value="3"> + <tp:docstring> + The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="IP_CONFIG_GET" value="4"> + <tp:docstring> + The VPN connection is getting an IP address. FIXME: Should be an -ING + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ACTIVATED" value="5"> + <tp:docstring> + The VPN connection is active. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="FAILED" value="6"> + <tp:docstring> + The VPN connection failed. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DISCONNECTED" value="7"> + <tp:docstring> + The VPN connection is disconnected. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + <tp:enum name="NM_VPN_CONNECTION_STATE_REASON" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The reason for the VPN connection state change is unknown. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NONE" value="1"> + <tp:docstring> + No reason was given for the VPN connection state change. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="USER_DISCONNECTED" value="2"> + <tp:docstring> + The VPN connection changed state because the user disconnected it. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DEVICE_DISCONNECTED" value="3"> + <tp:docstring> + The VPN connection changed state because the device it was using was disconnected. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_STOPPED" value="4"> + <tp:docstring> + The service providing the VPN connection was stopped. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="IP_CONFIG_INVALID" value="5"> + <tp:docstring> + The IP config of the VPN connection was invalid. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECT_TIMEOUT" value="6"> + <tp:docstring> + The connection attempt to the VPN service timed out. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_START_TIMEOUT" value="7"> + <tp:docstring> + A timeout occurred while starting the service providing the VPN connection. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_START_FAILED" value="8"> + <tp:docstring> + Starting the service starting the service providing the VPN connection failed. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NO_SECRETS" value="9"> + <tp:docstring> + Necessary secrets for the VPN connection were not provided. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Connection.Active"> + <property name="ServiceName" type="s" access="read"> + <tp:docstring>The D-Bus service name providing this connection.</tp:docstring> + </property> + <property name="Connection" type="o" access="read"> + <tp:docstring>The path of the connection.</tp:docstring> + </property> + <property name="SpecificObject" type="o" access="read"> + <tp:docstring>A specific object associated with the active connection.</tp:docstring> + </property> + <property name="SharedServiceName" type="s" access="read"> + <tp:docstring>The D-Bus service name that provides a connection with which this active connection is shared.</tp:docstring> + </property> + <property name="SharedConnection" type="o" access="read"> + <tp:docstring>The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared.</tp:docstring> + </property> + <property name="Devices" type="ao" access="read"> + <tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring> + </property> + <property name="State" type="u" access="read" tp:type="NM_ACTIVE_DEVICE_STATE"> + <tp:docstring>The state of this active connection.</tp:docstring> + </property> + <property name="Default" type="b" access="read"> + <tp:docstring>Whether this active connection is the default connection, i.e. whether it currently owns the default route.</tp:docstring> + </property> + </interface> + + <interface name="org.freedesktop.NetworkManager.VPN.Connection"> + <tp:docstring> + Represents an active connection to a Virtual Private Network. + </tp:docstring> + + <signal name="PropertiesChanged"> + <arg name="properties" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + A dictionary mapping property names to variant boxed values + </tp:docstring> + </arg> + </signal> + + <property name="VpnState" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring>The VPN-specific state of the connection.</tp:docstring> + </property> + <property name="Banner" type="s" access="read"> + <tp:docstring>The banner string of the VPN connection.</tp:docstring> + </property> + + <signal name="VpnStateChanged"> + <tp:docstring> + Emitted when the state of the VPN connection has changed. + </tp:docstring> + <arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring> + The new state of the VPN connection. + </tp:docstring> + </arg> + <arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON"> + <tp:docstring> + Reason code describing the change to the new state. + </tp:docstring> + </arg> + </signal> + + <tp:enum name="NM_VPN_CONNECTION_STATE" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The state of the VPN connection is unknown. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="PREPARE" value="1"> + <tp:docstring> + The VPN connection is preparing to connect. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NEED_AUTH" value="2"> + <tp:docstring> + The VPN connection needs authorization credentials. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECT" value="3"> + <tp:docstring> + The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="IP_CONFIG_GET" value="4"> + <tp:docstring> + The VPN connection is getting an IP address. FIXME: Should be an -ING + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="ACTIVATED" value="5"> + <tp:docstring> + The VPN connection is active. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="FAILED" value="6"> + <tp:docstring> + The VPN connection failed. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DISCONNECTED" value="7"> + <tp:docstring> + The VPN connection is disconnected. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + <tp:enum name="NM_VPN_CONNECTION_STATE_REASON" type="u"> + <tp:enumvalue suffix="UNKNOWN" value="0"> + <tp:docstring> + The reason for the VPN connection state change is unknown. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NONE" value="1"> + <tp:docstring> + No reason was given for the VPN connection state change. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="USER_DISCONNECTED" value="2"> + <tp:docstring> + The VPN connection changed state because the user disconnected it. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="DEVICE_DISCONNECTED" value="3"> + <tp:docstring> + The VPN connection changed state because the device it was using was disconnected. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_STOPPED" value="4"> + <tp:docstring> + The service providing the VPN connection was stopped. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="IP_CONFIG_INVALID" value="5"> + <tp:docstring> + The IP config of the VPN connection was invalid. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="CONNECT_TIMEOUT" value="6"> + <tp:docstring> + The connection attempt to the VPN service timed out. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_START_TIMEOUT" value="7"> + <tp:docstring> + A timeout occurred while starting the service providing the VPN connection. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="SERVICE_START_FAILED" value="8"> + <tp:docstring> + Starting the service starting the service providing the VPN connection failed. + </tp:docstring> + </tp:enumvalue> + <tp:enumvalue suffix="NO_SECRETS" value="9"> + <tp:docstring> + Necessary secrets for the VPN connection were not provided. + </tp:docstring> + </tp:enumvalue> + </tp:enum> + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.VPN.Manager"> + <method name="Connect"> + <tp:docstring> + Establish a VPN connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_manager_connect"/> + <arg name="connection_type" type="s" direction="in"> + <tp:docstring> + String describing the connection type. + </tp:docstring> + </arg> + <arg name="connection" type="o" direction="in"> + <tp:docstring> + Object path of the network connection to establish the VPN connection on. + </tp:docstring> + </arg> + <arg name="device" type="o" direction="in"> + <tp:docstring> + Object path of the device to establish the VPN connection on. + </tp:docstring> + </arg> + <arg name="vpn_connection" type="o" direction="out"> + <tp:docstring> + Object path of the newly created VPN connection. + </tp:docstring> + </arg> + </method> + + <method name="ListConnections"> + <tp:docstring> + Get the list of active VPN connections. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_manager_get_connections"/> + <arg name="connections" type="ao" direction="out"> + <tp:docstring> + List of object paths of active VPN connections. + </tp:docstring> + </arg> + </method> + + </interface> +</node> + 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.VPN.Plugin"> + <tp:docstring> + This interface is provided by plugins providing VPN services to the NetworkManager daemon. + </tp:docstring> + <method name="Connect"> + <tp:docstring> + Tells the plugin to connect. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_connect"/> + <arg name="connection" type="a{sa{sv}}" direction="in" tp:type="String_String_Variant_Map_Map"> + <tp:docstring> + Describes the connection to be established. + </tp:docstring> + </arg> + <tp:possible-errors> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.StartingInProgress"/> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.AlreadyStarted"/> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.StoppingInProgress"/> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.BadArguments"/> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.LaunchFailed"/> + </tp:possible-errors> + </method> + + <method name="NeedSecrets"> + <tp:docstring> + Asks the plugin whether the provided connection will require secrets to connect successfully. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_need_secrets"/> + <arg name="settings" type="a{sa{sv}}" direction="in" tp:type="String_String_Variant_Map_Map"> + <tp:docstring> + Describes the connection that may need secrets. + </tp:docstring> + </arg> + <arg name="setting_name" type="s" direction="out"> + <tp:docstring> + The setting name within the provided connection that requires secrets, if any. + </tp:docstring> + </arg> + <tp:possible-errors> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.ConnectionInvalid"/> + </tp:possible-errors> + </method> + + <method name="Disconnect"> + <tp:docstring> + Disconnect the plugin. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_disconnect"/> + <tp:possible-errors> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.StoppingInProgress"/> + <tp:error name="org.freedesktop.NetworkManager.VPN.Error.AlreadyStopped"/> + </tp:possible-errors> + </method> + + <method name="SetIp4Config"> + <tp:docstring> + Set IPv4 details on the connection. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_set_ip4_config"/> + <arg name="config" type="a{sv}" direction="in" tp:type="String_Variant_Map"> + <tp:docstring> + Ip4Config details for the conneciton. + </tp:docstring> + </arg> + </method> + + <method name="SetFailure"> + <tp:docstring> + Indicate a failure to the plugin. + </tp:docstring> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_set_failure"/> + <arg name="reason" type="s" direction="in"> + <tp:docstring> + The reason for the failure. + </tp:docstring> + </arg> + </method> + + <property name="State" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring> + The state of the plugin. + </tp:docstring> + </property> + + <signal name="StateChanged"> + <tp:docstring> + Emitted when the plugin state changes. + </tp:docstring> + <arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE"> + <tp:docstring> + The new state of the plugin. + </tp:docstring> + </arg> + </signal> + + <signal name="Ip4Config"> + <tp:docstring> + The plugin obtained an IPv4 configuration. + </tp:docstring> + <arg name="ip4config" type="a{sv}" tp:type="String_Variant_Map"> + <tp:docstring> + The IPv4 configuration. + </tp:docstring> + </arg> + </signal> + + <signal name="LoginBanner"> + <tp:docstring> + Emitted when the plugin receives a login banner from the VPN service. + </tp:docstring> + <arg name="banner" type="s"> + <tp:docstring> + The login banner string. + </tp:docstring> + </arg> + </signal> + + <signal name="Failure"> + <tp:docstring> + Emitted when a failure in the VPN plugin occurs. + </tp:docstring> + <arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON"> + <tp:docstring> + Reason code for the failure. + </tp:docstring> + </arg> + </signal> + </interface> +</node> 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 <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. +*/ + +#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 <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 _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 <tdehardwaredevices.h> #include <tqfile.h> @@ -56,6 +58,13 @@ #include <sys/socket.h> #include <netdb.h> +// 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 <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. +*/ + +#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 <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 "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)); \ + } + +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 |