Commit 67149b36 authored by Dan Williams's avatar Dan Williams

2008-04-07 Dan Williams <dcbw@redhat.com>

	* introspection/nm-settings-system.xml
	  introspection/Makefile.am
		- Define the unmanaged devices interface for the system settings service

	* system-settings/src/nm-system-config-hal-manager.c
	  system-settings/src/nm-system-config-hal-manager.h
	  system-settings/src/nm-system-config-hal-manager-private.h
	  system-settings/src/Makefile.am
		- Add a lightweight HAL manager object for tracking network devices for
			the purpose of determining unmanaged devices and which devices need
			the default DHCP connections

	* system-settings/src/nm-system-config-interface.c
	  system-settings/src/nm-system-config-interface.h
		- (nm_system_config_interface_init): add the HAL manager as an argument
		- (nm_system_config_interface_get_unmanaged_devices): implement
		- Define 'unmanaged-devices-changed' signal

	* system-settings/src/dbus-settings.c
	  system-settings/src/dbus-settings.h
		- Implement the unmanaged devices interface; some cleanups

	* system-settings/plugins/ifcfg-suse/plugin.c
		- Fixup for plugin interface changes

	* system-settings/plugins/ifcfg-fedora/plugin.c
		- (get_ether_device_udi): new function; find the device that has
			a specified MAC address and return its UDI
		- (get_udi_for_connection): new function; try to find the specific
			device a connection is locked to, if any
		- (device_added_cb, device_removed_cb): update unmanaged device list in
			response to HAL events
		- (get_unmanaged_devices): new function; return unmanaged device list
		- (build_one_connection): set the connection's locked device, if any
		- (write_auto_wired_connection): remove
		- (kill_old_auto_wired_file): remove the ifcfg-Auto Wired file if found
		- (handle_connection_changed): alert listeners that the unmanaged device
			list has changed
		- (init): fixup for plugin interface changes, implement unmanaged devices

	* system-settings/plugins/ifcfg-fedora/parser.c
	  system-settings/plugins/ifcfg-fedora/parser.h
		- (connection_data_free): clean up connection UDI



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3537 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent dcbfae2c
2008-04-07 Dan Williams <dcbw@redhat.com>
* introspection/nm-settings-system.xml
introspection/Makefile.am
- Define the unmanaged devices interface for the system settings service
* system-settings/src/nm-system-config-hal-manager.c
system-settings/src/nm-system-config-hal-manager.h
system-settings/src/nm-system-config-hal-manager-private.h
system-settings/src/Makefile.am
- Add a lightweight HAL manager object for tracking network devices for
the purpose of determining unmanaged devices and which devices need
the default DHCP connections
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- (nm_system_config_interface_init): add the HAL manager as an argument
- (nm_system_config_interface_get_unmanaged_devices): implement
- Define 'unmanaged-devices-changed' signal
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- Implement the unmanaged devices interface; some cleanups
* system-settings/plugins/ifcfg-suse/plugin.c
- Fixup for plugin interface changes
* system-settings/plugins/ifcfg-fedora/plugin.c
- (get_ether_device_udi): new function; find the device that has
a specified MAC address and return its UDI
- (get_udi_for_connection): new function; try to find the specific
device a connection is locked to, if any
- (device_added_cb, device_removed_cb): update unmanaged device list in
response to HAL events
- (get_unmanaged_devices): new function; return unmanaged device list
- (build_one_connection): set the connection's locked device, if any
- (write_auto_wired_connection): remove
- (kill_old_auto_wired_file): remove the ifcfg-Auto Wired file if found
- (handle_connection_changed): alert listeners that the unmanaged device
list has changed
- (init): fixup for plugin interface changes, implement unmanaged devices
* system-settings/plugins/ifcfg-fedora/parser.c
system-settings/plugins/ifcfg-fedora/parser.h
- (connection_data_free): clean up connection UDI
2008-04-07 Dan Williams <dcbw@redhat.com>
* system-settings/plugins/ifcfg-fedora/parser.c
......
......@@ -9,6 +9,7 @@ EXTRA_DIST = \
nm-manager.xml \
nm-manager-client.xml \
nm-settings.xml \
nm-settings-system.xml \
nm-exported-connection.xml \
nm-vpn-plugin.xml \
nm-vpn-connection.xml \
......
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManagerSettings.System">
<tp:docstring>
Implemented by the system settings service to provide additional settings to NetworkManager.
</tp:docstring>
<property name="UnmanagedDevices" type="ao" access="read">
<tp:docstring>
The list of HAL UDIs of devices that should not be managed by NetworkManager.
</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>
......@@ -112,6 +112,8 @@ connection_data_free (gpointer userdata)
g_hash_table_destroy (cdata->ppp_secrets);
g_free (cdata->ifcfg_path);
g_free (cdata->udi);
memset (cdata, 0, sizeof (ConnectionData));
g_free (cdata);
}
......
......@@ -35,6 +35,7 @@
typedef struct {
char *ifcfg_path;
char *udi;
gboolean ignored;
gboolean exported;
......
......@@ -326,7 +326,7 @@ ifcfg_dir_changed (GFileMonitor *monitor,
}
static void
init (NMSystemConfigInterface *config)
init (NMSystemConfigInterface *config, NMSystemConfigHalManager *hal_manager)
{
GFile *file;
GFileMonitor *monitor;
......
INCLUDES = -I${top_srcdir} \
-I${top_srcdir}/include \
-I${top_srcdir}/libnm-util \
-I${top_srcdir}/libnm-glib
-I${top_srcdir}/libnm-glib \
-I${top_builddir}/marshallers
sbin_PROGRAMS = nm-system-settings
BUILT_SOURCES = \
nm-settings-system-glue.h
nm_system_settings_SOURCES = \
dbus-settings.c \
dbus-settings.h \
main.c \
nm-system-config-interface.c \
nm-system-config-interface.h
nm-system-config-interface.h \
nm-system-config-hal-manager.c \
nm-system-config-hal-manager.h \
nm-system-config-hal-manager-private.h
nm_system_settings_CPPFLAGS = \
$(DBUS_CFLAGS) \
......@@ -32,10 +39,15 @@ nm_system_settings_LDADD = \
$(GTHREAD_LIBS) \
$(GMODULE_LIBS) \
$(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm_glib.la
$(top_builddir)/libnm-glib/libnm_glib.la \
$(top_builddir)/marshallers/libmarshallers.la
nm_system_settings_LDFLAGS = -rdynamic
nm-settings-system-glue.h: $(top_srcdir)/introspection/nm-settings-system.xml
dbus-binding-tool --prefix=nm_settings_system --mode=glib-server --output=nm-settings-system-glue.h $(top_srcdir)/introspection/nm-settings-system.xml
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = nm-system-settings.conf
......@@ -46,4 +58,6 @@ EXTRA_DIST = \
$(dbusservice_DATA) \
$(dbusactivation_DATA)
CLEANFILES = \
$(BUILT_SOURCES)
This diff is collapsed.
......@@ -43,12 +43,12 @@ typedef struct _NMSysconfigExportedConnectionClass NMSysconfigExportedConnection
struct _NMSysconfigExportedConnection
{
NMExportedConnection parent_instance;
NMExportedConnection parent_instance;
};
struct _NMSysconfigExportedConnectionClass
{
NMExportedConnectionClass parent_class;
NMExportedConnectionClass parent_class;
};
GType nm_sysconfig_exported_connection_get_type (void);
......@@ -68,16 +68,19 @@ typedef struct _NMSysconfigSettingsClass NMSysconfigSettingsClass;
#define NM_IS_SYSCONFIG_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SYSCONFIG_SETTINGS))
#define NM_SYSCONFIG_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SYSCONFIG_SETTINGS, NMSysconfigSettingsClass))
#define NM_SYSCONFIG_SETTINGS_UNMANAGED_DEVICES "unmanaged-devices"
struct _NMSysconfigSettings
{
NMSettings parent_instance;
GSList *connections;
NMSettings parent_instance;
};
struct _NMSysconfigSettingsClass
{
NMSettingsClass parent_class;
NMSettingsClass parent_class;
/* Signals */
void (*properties_changed) (NMSysconfigSettings *settings, GHashTable *properties);
};
GType nm_sysconfig_settings_get_type (void);
......@@ -94,4 +97,7 @@ void nm_sysconfig_settings_remove_connection (NMSysconfigSettings *settings,
void nm_sysconfig_settings_update_connection (NMSysconfigSettings *settings,
NMConnection *connection);
void nm_sysconfig_settings_update_unamanged_devices (NMSysconfigSettings *settings,
GSList *new_list);
#endif /* __DBUS_SETTINGS_H__ */
/*
* Copyright (C) 2008 Dan Williams
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/* *** Not to be used by system settings service plugins *** */
#ifndef NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H
#define NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H
#include "nm-system-config-hal-manager.h"
NMSystemConfigHalManager *nm_system_config_hal_manager_get (DBusGConnection *g_connection);
void nm_system_config_hal_manager_reinit_dbus (NMSystemConfigHalManager *manager,
DBusGConnection *g_connection);
void nm_system_config_hal_manager_deinit_dbus (NMSystemConfigHalManager *manager);
#endif /* NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H */
This diff is collapsed.
/*
* Copyright (C) 2008 Dan Williams
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef NM_SYSTEM_CONFIG_HAL_MANAGER_H
#define NM_SYSTEM_CONFIG_HAL_MANAGER_H
#include <glib/gtypes.h>
#include <glib-object.h>
#include <dbus/dbus-glib.h>
#include "NetworkManager.h"
#define NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER (nm_system_config_hal_manager_get_type ())
#define NM_SYSTEM_CONFIG_HAL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER, NMSystemConfigHalManager))
#define NM_SYSTEM_CONFIG_HAL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER, NMSystemConfigHalManagerClass))
#define NM_IS_SYSTEM_CONFIG_HAL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER))
#define NM_IS_SYSTEM_CONFIG_HAL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER))
#define NM_SYSTEM_CONFIG_HAL_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SYSTEM_CONFIG_HAL_MANAGER, NMSystemConfigHalManagerClass))
typedef struct {
GObject parent;
} NMSystemConfigHalManager;
typedef struct {
GObjectClass parent;
/* Signals */
void (*device_added) (NMSystemConfigHalManager *manager, const char *udi, NMDeviceType type);
void (*device_removed) (NMSystemConfigHalManager *manager, const char *udi, NMDeviceType type);
} NMSystemConfigHalManagerClass;
GType nm_system_config_hal_manager_get_type (void);
/* Returned list is allocated and must be freed by caller */
GSList *nm_system_config_hal_manager_get_devices_of_type (NMSystemConfigHalManager *manager, NMDeviceType devtype);
DBusGProxy *nm_system_config_hal_manager_get_hal_proxy (NMSystemConfigHalManager *manager);
#endif /* NM_SYSTEM_CONFIG_HAL_MANAGER_H */
......@@ -76,6 +76,14 @@ interface_init (gpointer g_iface)
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
g_signal_new ("unmanaged-devices-changed",
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSystemConfigInterface, unmanaged_devices_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
initialized = TRUE;
}
......@@ -110,12 +118,13 @@ nm_system_config_interface_get_type (void)
}
void
nm_system_config_interface_init (NMSystemConfigInterface *config)
nm_system_config_interface_init (NMSystemConfigInterface *config,
NMSystemConfigHalManager *hal_manager)
{
g_return_if_fail (config != NULL);
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->init)
NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->init (config);
NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->init (config, hal_manager);
}
GSList *
......@@ -142,3 +151,13 @@ nm_system_config_interface_get_secrets (NMSystemConfigInterface *config,
return NULL;
}
GSList *
nm_system_config_interface_get_unmanaged_devices (NMSystemConfigInterface *config)
{
g_return_val_if_fail (config != NULL, NULL);
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unmanaged_devices)
return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unmanaged_devices (config);
return NULL;
}
......@@ -26,10 +26,12 @@
#include <glib-object.h>
#include <nm-connection.h>
#include "nm-system-config-hal-manager.h"
G_BEGIN_DECLS
#define PLUGIN_PRINT(pname, fmt, args...) \
{ g_print (" " pname ": " fmt "\n", ##args); }
{ g_message (" " pname ": " fmt, ##args); }
#define PLUGIN_WARN(pname, fmt, args...) \
{ g_warning (" " pname ": " fmt, ##args); }
......@@ -72,7 +74,7 @@ struct _NMSystemConfigInterface {
GTypeInterface g_iface;
/* Called when the plugin is loaded to initialize it */
void (*init) (NMSystemConfigInterface *config);
void (*init) (NMSystemConfigInterface *config, NMSystemConfigHalManager *hal_manager);
/* Returns the plugins currently known list of connections. The returned
* list is freed by the system settings service.
......@@ -90,6 +92,13 @@ struct _NMSystemConfigInterface {
*/
GHashTable * (*get_secrets) (NMSystemConfigInterface *config, NMConnection *connection, NMSetting *setting);
/*
* Return a list of HAL UDIs of devices which NetworkManager should not
* manage. Returned list will be freed by the system settings service, and
* each element must be allocated using g_malloc() or its variants.
*/
GSList * (*get_unmanaged_devices) (NMSystemConfigInterface *config);
/* Signals */
/* Emitted when a new connection has been found by the plugin */
......@@ -100,11 +109,15 @@ struct _NMSystemConfigInterface {
/* Emitted when any non-secret settings of the connection change */
void (*connection_updated) (NMSystemConfigInterface *config, NMConnection *connection);
/* Emitted when the list of unmanaged devices changes */
void (*unmanaged_devices_changed) (NMSystemConfigInterface *config);
};
GType nm_system_config_interface_get_type (void);
void nm_system_config_interface_init (NMSystemConfigInterface *config);
void nm_system_config_interface_init (NMSystemConfigInterface *config,
NMSystemConfigHalManager *hal_manager);
GSList * nm_system_config_interface_get_connections (NMSystemConfigInterface *config);
......@@ -112,6 +125,8 @@ GHashTable *nm_system_config_interface_get_secrets (NMSystemConfigInterface *con
NMConnection *connection,
NMSetting *setting);
GSList *nm_system_config_interface_get_unmanaged_devices (NMSystemConfigInterface *config);
G_END_DECLS
#endif /* NM_SYSTEM_CONFIG_INTERFACE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment