2010-10-27 20:05:23 -05:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/* NetworkManager system settings service
|
|
|
|
|
*
|
|
|
|
|
* Søren Sandmann <sandmann@daimi.au.dk>
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
* Tambet Ingo <tambet@gmail.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.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
2011-06-28 15:48:12 +02:00
|
|
|
* (C) Copyright 2007 - 2011 Red Hat, Inc.
|
2010-10-27 20:05:23 -05:00
|
|
|
* (C) Copyright 2008 Novell, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __NM_SETTINGS_H__
|
|
|
|
|
#define __NM_SETTINGS_H__
|
|
|
|
|
|
|
|
|
|
#include <nm-connection.h>
|
|
|
|
|
|
2015-04-13 13:31:42 -04:00
|
|
|
#include "nm-exported-object.h"
|
2010-10-27 20:05:23 -05:00
|
|
|
|
|
|
|
|
#define NM_TYPE_SETTINGS (nm_settings_get_type ())
|
|
|
|
|
#define NM_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS, NMSettings))
|
|
|
|
|
#define NM_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTINGS, NMSettingsClass))
|
|
|
|
|
#define NM_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS))
|
|
|
|
|
#define NM_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTINGS))
|
|
|
|
|
#define NM_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS, NMSettingsClass))
|
|
|
|
|
|
2014-12-18 16:04:07 -05:00
|
|
|
#define NM_SETTINGS_UNMANAGED_SPECS "unmanaged-specs"
|
|
|
|
|
#define NM_SETTINGS_HOSTNAME "hostname"
|
|
|
|
|
#define NM_SETTINGS_CAN_MODIFY "can-modify"
|
|
|
|
|
#define NM_SETTINGS_CONNECTIONS "connections"
|
|
|
|
|
#define NM_SETTINGS_STARTUP_COMPLETE "connections"
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2011-01-26 11:38:12 -06:00
|
|
|
#define NM_SETTINGS_SIGNAL_CONNECTION_ADDED "connection-added"
|
|
|
|
|
#define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED "connection-updated"
|
2013-12-12 21:37:06 +01:00
|
|
|
#define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER "connection-updated-by-user"
|
2011-01-26 11:38:12 -06:00
|
|
|
#define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed"
|
|
|
|
|
#define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
|
2011-06-28 15:48:12 +02:00
|
|
|
#define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registered"
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2014-07-17 17:06:44 -04:00
|
|
|
struct _NMSettings {
|
2015-04-13 13:31:42 -04:00
|
|
|
NMExportedObject parent_instance;
|
2014-07-17 17:06:44 -04:00
|
|
|
};
|
2010-10-27 20:05:23 -05:00
|
|
|
|
|
|
|
|
typedef struct {
|
2015-04-13 13:31:42 -04:00
|
|
|
NMExportedObjectClass parent_class;
|
2010-10-27 20:05:23 -05:00
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
void (*properties_changed) (NMSettings *self, GHashTable *properties);
|
|
|
|
|
|
2011-01-26 15:24:41 -06:00
|
|
|
void (*connection_added) (NMSettings *self, NMSettingsConnection *connection);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2011-01-26 15:24:41 -06:00
|
|
|
void (*connection_updated) (NMSettings *self, NMSettingsConnection *connection);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2011-01-26 15:24:41 -06:00
|
|
|
void (*connection_removed) (NMSettings *self, NMSettingsConnection *connection);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2011-01-26 15:24:41 -06:00
|
|
|
void (*connection_visibility_changed) (NMSettings *self, NMSettingsConnection *connection);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2011-06-28 15:48:12 +02:00
|
|
|
void (*agent_registered) (NMSettings *self, NMSecretAgent *agent);
|
2010-10-27 20:05:23 -05:00
|
|
|
} NMSettingsClass;
|
|
|
|
|
|
|
|
|
|
GType nm_settings_get_type (void);
|
|
|
|
|
|
core: better order the code at startup
NM was calling nm_bus_manager_start_service() to claim its bus name
before it exported any of its objects, but this didn't matter under
dbus-glib, because no client connections would be accepted until the
main loop was started later on, by which point we would have exported
everything.
But with gdbus, method calls are initially received in the gdbus
worker thread, which means that clients would be able to connect right
away and then be told that the expected interfaces don't exist.
So move the nm_bus_manager_start_service() call to occur after
creating NMSettings and NMManager (and, indirectly, NMAgentManager).
This requires splitting out the slow parts of nm_settings_new() into a
new nm_settings_start(), so that we can create and export it first,
and then read the connections, etc afterward. (Likewise, there were
still a few potentially-slow bits in nm_manager_new() which are now
moved into nm_manager_start().)
2015-07-31 13:00:22 -04:00
|
|
|
NMSettings *nm_settings_new (void);
|
|
|
|
|
gboolean nm_settings_start (NMSettings *self, GError **error);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
|
|
|
|
typedef void (*NMSettingsForEachFunc) (NMSettings *settings,
|
2011-01-26 11:38:12 -06:00
|
|
|
NMSettingsConnection *connection,
|
2010-10-27 20:05:23 -05:00
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
void nm_settings_for_each_connection (NMSettings *settings,
|
|
|
|
|
NMSettingsForEachFunc for_each_func,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2011-01-10 23:39:12 -06:00
|
|
|
typedef void (*NMSettingsAddCallback) (NMSettings *settings,
|
2011-01-26 11:38:12 -06:00
|
|
|
NMSettingsConnection *connection,
|
2011-01-10 23:39:12 -06:00
|
|
|
GError *error,
|
2015-04-15 14:53:30 -04:00
|
|
|
GDBusMethodInvocation *context,
|
2015-07-15 14:44:45 +02:00
|
|
|
NMAuthSubject *subject,
|
2011-01-10 23:39:12 -06:00
|
|
|
gpointer user_data);
|
|
|
|
|
|
2013-08-27 14:51:16 +02:00
|
|
|
void nm_settings_add_connection_dbus (NMSettings *self,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
gboolean save_to_disk,
|
2015-04-15 14:53:30 -04:00
|
|
|
GDBusMethodInvocation *context,
|
2013-08-27 14:51:16 +02:00
|
|
|
NMSettingsAddCallback callback,
|
|
|
|
|
gpointer user_data);
|
2011-01-10 23:39:12 -06:00
|
|
|
|
2011-01-26 11:38:12 -06:00
|
|
|
/* Returns a list of NMSettingsConnections. Caller must free the list with
|
2010-10-27 20:05:23 -05:00
|
|
|
* g_slist_free().
|
|
|
|
|
*/
|
|
|
|
|
GSList *nm_settings_get_connections (NMSettings *settings);
|
|
|
|
|
|
2013-08-27 14:51:16 +02:00
|
|
|
NMSettingsConnection *nm_settings_add_connection (NMSettings *settings,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
gboolean save_to_disk,
|
|
|
|
|
GError **error);
|
2011-01-26 11:38:12 -06:00
|
|
|
NMSettingsConnection *nm_settings_get_connection_by_path (NMSettings *settings,
|
|
|
|
|
const char *path);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2012-01-13 17:20:06 -06:00
|
|
|
NMSettingsConnection *nm_settings_get_connection_by_uuid (NMSettings *settings,
|
|
|
|
|
const char *uuid);
|
|
|
|
|
|
2015-04-22 15:05:53 +02:00
|
|
|
gboolean nm_settings_has_connection (NMSettings *self, NMConnection *connection);
|
|
|
|
|
|
2010-10-27 20:05:23 -05:00
|
|
|
const GSList *nm_settings_get_unmanaged_specs (NMSettings *self);
|
|
|
|
|
|
|
|
|
|
char *nm_settings_get_hostname (NMSettings *self);
|
|
|
|
|
|
|
|
|
|
void nm_settings_device_added (NMSettings *self, NMDevice *device);
|
|
|
|
|
|
2013-11-14 11:33:12 -06:00
|
|
|
void nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quitting);
|
2010-10-27 20:05:23 -05:00
|
|
|
|
2013-11-15 13:09:12 -06:00
|
|
|
gint nm_settings_sort_connections (gconstpointer a, gconstpointer b);
|
|
|
|
|
|
2014-12-18 16:04:07 -05:00
|
|
|
gboolean nm_settings_get_startup_complete (NMSettings *self);
|
|
|
|
|
|
2010-10-27 20:05:23 -05:00
|
|
|
#endif /* __NM_SETTINGS_H__ */
|