NetworkManager/system-settings/src/nm-system-config-interface.h
Dan Williams 67149b36f4 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
2008-04-08 01:36:39 +00:00

132 lines
5.1 KiB
C

/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* 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 of the License, 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.
*
* (C) Copyright 2007 Red Hat, Inc.
*/
#ifndef NM_SYSTEM_CONFIG_INTERFACE_H
#define NM_SYSTEM_CONFIG_INTERFACE_H
#include <glib.h>
#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_message (" " pname ": " fmt, ##args); }
#define PLUGIN_WARN(pname, fmt, args...) \
{ g_warning (" " pname ": " fmt, ##args); }
/* Plugin's factory function that returns a GObject that implements
* NMSystemConfigInterface.
*/
GObject * nm_system_config_factory (void);
/* NOTE:
* When passing NMConnection objects to NetworkManager, any properties
* of that NMConnection's NMSetting objects that are secrets must be set as
* GObject data items on the NMSetting object, _not_ inside the NMSetting
* object itself. This is to ensure that the secrets are only given to
* NetworkManager itself and not exposed to clients like nm-applet that need
* connection details, but not secrets.
*/
#define NM_TYPE_SYSTEM_CONFIG_INTERFACE (nm_system_config_interface_get_type ())
#define NM_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface))
#define NM_IS_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE))
#define NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface))
#define NM_SYSTEM_CONFIG_INTERFACE_NAME "name"
#define NM_SYSTEM_CONFIG_INTERFACE_INFO "info"
typedef enum {
NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST = 0x1000,
NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME = NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST,
NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO,
} NMSystemConfigInterfaceProp;
typedef struct _NMSystemConfigInterface NMSystemConfigInterface;
struct _NMSystemConfigInterface {
GTypeInterface g_iface;
/* Called when the plugin is loaded to initialize it */
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.
*/
GSList * (*get_connections) (NMSystemConfigInterface *config);
/* Return the secrets associated with settings of a specific
* connection. The returned hash table is unreffed by the system settings
* service. Returned hash table should itself contain string::hashtable
* mappings, each value being a hash table of secrets for a single setting.
*
* string :: (string :: GValue)
*
* The returned hash table will be freed by the system settings service.
*/
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 */
void (*connection_added) (NMSystemConfigInterface *config, NMConnection *connection);
/* Emitted when a connection has been removed by the plugin */
void (*connection_removed) (NMSystemConfigInterface *config, NMConnection *connection);
/* 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,
NMSystemConfigHalManager *hal_manager);
GSList * nm_system_config_interface_get_connections (NMSystemConfigInterface *config);
GHashTable *nm_system_config_interface_get_secrets (NMSystemConfigInterface *config,
NMConnection *connection,
NMSetting *setting);
GSList *nm_system_config_interface_get_unmanaged_devices (NMSystemConfigInterface *config);
G_END_DECLS
#endif /* NM_SYSTEM_CONFIG_INTERFACE_H */