diff options
author | Dan Winship <danw@redhat.com> | 2015-04-16 14:20:51 -0400 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-07-24 13:25:48 -0400 |
commit | 02370be7f31bbcd7a5ecd808c239d48bdad42024 (patch) | |
tree | ecddf2f1e6fe3b2c5578fa81fd3e399489d4291d | |
parent | 1424f249e3f00693784456a9ccaa0f7577af685f (diff) | |
download | NetworkManager-02370be7f31bbcd7a5ecd808c239d48bdad42024.tar.gz |
core: rename NMDBusManager to NMBusManager
Our gdbus generated types use the same names as their corresponding
"real" types, but with "NM" changed to "NMDBus".
Unfortunately, that means that introspection/nmdbus-manager.c (the
generated type for src/nm-manager.c) uses the same type name as the
entirely unrelated src/nm-dbus-manager.c.
Fix this by removing the "d" from src/nm-dbus-manager.c. (We could
rename the generated type instead, but then it becomes inconsistent
with all the other generated types, and we're already using it as
"NMDBusManager" in libnm/nm-manager.c.)
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/dhcp-manager/nm-dhcp-listener.c | 16 | ||||
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/nm-auth-subject.c | 24 | ||||
-rw-r--r-- | src/nm-bus-manager.c (renamed from src/nm-dbus-manager.c) | 246 | ||||
-rw-r--r-- | src/nm-bus-manager.h | 129 | ||||
-rw-r--r-- | src/nm-dbus-manager.h | 129 | ||||
-rw-r--r-- | src/nm-dispatcher.c | 1 | ||||
-rw-r--r-- | src/nm-exported-object.c | 6 | ||||
-rw-r--r-- | src/nm-iface-helper.c | 18 | ||||
-rw-r--r-- | src/nm-manager.c | 16 | ||||
-rw-r--r-- | src/nm-types.h | 2 | ||||
-rw-r--r-- | src/ppp-manager/nm-ppp-manager.c | 1 | ||||
-rw-r--r-- | src/settings/nm-agent-manager.c | 12 | ||||
-rw-r--r-- | src/settings/nm-secret-agent.c | 20 | ||||
-rw-r--r-- | src/settings/nm-settings.c | 10 | ||||
-rw-r--r-- | src/tests/config/test-config.c | 6 |
17 files changed, 319 insertions, 327 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3181a1f099..e457cbc3dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -300,6 +300,8 @@ nm_sources = \ nm-activation-request.h \ nm-active-connection.c \ nm-active-connection.h \ + nm-bus-manager.c \ + nm-bus-manager.h \ nm-config.c \ nm-config.h \ nm-config-data.c \ @@ -308,8 +310,6 @@ nm_sources = \ nm-connection-provider.h \ nm-connectivity.c \ nm-connectivity.h \ - nm-dbus-manager.c \ - nm-dbus-manager.h \ nm-dcb.c \ nm-dcb.h \ nm-route-manager.c \ diff --git a/src/dhcp-manager/nm-dhcp-listener.c b/src/dhcp-manager/nm-dhcp-listener.c index 4954d57620..d675dcfcd4 100644 --- a/src/dhcp-manager/nm-dhcp-listener.c +++ b/src/dhcp-manager/nm-dhcp-listener.c @@ -33,7 +33,7 @@ #include "nm-dhcp-listener.h" #include "nm-core-internal.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-dbus-glib-types.h" #include "NetworkManagerUtils.h" @@ -42,7 +42,7 @@ #define PRIV_SOCK_TAG "dhcp" typedef struct { - NMDBusManager * dbus_mgr; + NMBusManager * dbus_mgr; guint new_conn_id; guint dis_conn_id; GHashTable * proxies; @@ -161,7 +161,7 @@ out: #if HAVE_DBUS_GLIB_100 static void -new_connection_cb (NMDBusManager *mgr, +new_connection_cb (NMBusManager *mgr, DBusGConnection *connection, NMDhcpListener *self) { @@ -176,7 +176,7 @@ new_connection_cb (NMDBusManager *mgr, } static void -dis_connection_cb (NMDBusManager *mgr, +dis_connection_cb (NMBusManager *mgr, DBusGConnection *connection, NMDhcpListener *self) { @@ -206,17 +206,17 @@ nm_dhcp_listener_init (NMDhcpListener *self) /* Maps DBusGConnection :: DBusGProxy */ priv->proxies = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); #if HAVE_DBUS_GLIB_100 /* Register the socket our DHCP clients will return lease info on */ - nm_dbus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG); + nm_bus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG); priv->new_conn_id = g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, G_CALLBACK (new_connection_cb), self); priv->dis_conn_id = g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, G_CALLBACK (dis_connection_cb), self); #else diff --git a/src/main.c b/src/main.c index 31f63b7ae3..a0b6e37553 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,7 @@ #include "main-utils.h" #include "nm-manager.h" #include "nm-linux-platform.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-device.h" #include "nm-dhcp-manager.h" #include "nm-logging.h" @@ -422,7 +422,7 @@ main (int argc, char *argv[]) #endif ); - if (!nm_dbus_manager_get_connection (nm_dbus_manager_get ())) { + if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) { #if HAVE_DBUS_GLIB_100 nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available"); #else @@ -431,7 +431,7 @@ main (int argc, char *argv[]) #endif } else { /* Start our DBus service */ - if (!nm_dbus_manager_start_service (nm_dbus_manager_get ())) { + if (!nm_bus_manager_start_service (nm_bus_manager_get ())) { nm_log_err (LOGD_CORE, "failed to start the dbus service."); goto done; } diff --git a/src/nm-auth-subject.c b/src/nm-auth-subject.c index 12dcee044a..7570b3cf58 100644 --- a/src/nm-auth-subject.c +++ b/src/nm-auth-subject.c @@ -34,7 +34,7 @@ #include <stdlib.h> #include "nm-glib.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-enum-types.h" #include "NetworkManagerUtils.h" #include "gsystem-local-alloc.h" @@ -180,18 +180,18 @@ _new_unix_process (DBusGMethodInvocation *context, g_return_val_if_fail (context || (connection && message), NULL); if (context) { - success = nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), - context, - &dbus_sender, - &uid, - &pid); + success = nm_bus_manager_get_caller_info (nm_bus_manager_get (), + context, + &dbus_sender, + &uid, + &pid); } else if (message) { - success = nm_dbus_manager_get_caller_info_from_message (nm_dbus_manager_get (), - connection, - message, - &dbus_sender, - &uid, - &pid); + success = nm_bus_manager_get_caller_info_from_message (nm_bus_manager_get (), + connection, + message, + &dbus_sender, + &uid, + &pid); } else g_assert_not_reached (); diff --git a/src/nm-dbus-manager.c b/src/nm-bus-manager.c index 48f0084228..a600c225d4 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-bus-manager.c @@ -28,7 +28,7 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include <dbus/dbus.h> #include <dbus/dbus-glib.h> @@ -50,11 +50,11 @@ enum { static guint signals[NUMBER_OF_SIGNALS]; -G_DEFINE_TYPE(NMDBusManager, nm_dbus_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE(NMBusManager, nm_bus_manager, G_TYPE_OBJECT) -#define NM_DBUS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - NM_TYPE_DBUS_MANAGER, \ - NMDBusManagerPrivate)) +#define NM_BUS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ + NM_TYPE_BUS_MANAGER, \ + NMBusManagerPrivate)) typedef struct _PrivateServer PrivateServer; @@ -71,40 +71,40 @@ typedef struct { guint proxy_destroy_id; guint reconnect_id; -} NMDBusManagerPrivate; +} NMBusManagerPrivate; -static gboolean nm_dbus_manager_init_bus (NMDBusManager *self); -static void nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose); -static void start_reconnection_timeout (NMDBusManager *self); -static void object_destroyed (NMDBusManager *self, gpointer object); +static gboolean nm_bus_manager_init_bus (NMBusManager *self); +static void nm_bus_manager_cleanup (NMBusManager *self, gboolean dispose); +static void start_reconnection_timeout (NMBusManager *self); +static void object_destroyed (NMBusManager *self, gpointer object); -NM_DEFINE_SINGLETON_DESTRUCTOR (NMDBusManager); -NM_DEFINE_SINGLETON_WEAK_REF (NMDBusManager); +NM_DEFINE_SINGLETON_DESTRUCTOR (NMBusManager); +NM_DEFINE_SINGLETON_WEAK_REF (NMBusManager); -NMDBusManager * -nm_dbus_manager_get (void) +NMBusManager * +nm_bus_manager_get (void) { if (G_UNLIKELY (!singleton_instance)) { - nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL)); - if (!nm_dbus_manager_init_bus (singleton_instance)) + nm_bus_manager_setup (g_object_new (NM_TYPE_BUS_MANAGER, NULL)); + if (!nm_bus_manager_init_bus (singleton_instance)) start_reconnection_timeout (singleton_instance); } return singleton_instance; } void -nm_dbus_manager_setup (NMDBusManager *instance) +nm_bus_manager_setup (NMBusManager *instance) { static char already_setup = FALSE; - g_assert (NM_IS_DBUS_MANAGER (instance)); + g_assert (NM_IS_BUS_MANAGER (instance)); g_assert (!already_setup); g_assert (!singleton_instance); already_setup = TRUE; singleton_instance = instance; nm_singleton_instance_weak_ref_register (); - nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMDBusManager", singleton_instance); + nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMBusManager", singleton_instance); } /**************************************************************/ @@ -115,7 +115,7 @@ struct _PrivateServer { char *address; DBusServer *server; GHashTable *connections; - NMDBusManager *manager; + NMBusManager *manager; }; static DBusHandlerResult @@ -194,7 +194,7 @@ private_server_dbus_connection_destroy (DBusConnection *conn) static PrivateServer * private_server_new (const char *path, const char *tag, - NMDBusManager *manager) + NMBusManager *manager) { PrivateServer *s; DBusServer *server; @@ -247,11 +247,11 @@ private_server_free (gpointer ptr) } void -nm_dbus_manager_private_server_register (NMDBusManager *self, - const char *path, - const char *tag) +nm_bus_manager_private_server_register (NMBusManager *self, + const char *path, + const char *tag) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); PrivateServer *s; GSList *iter; @@ -287,14 +287,14 @@ private_server_get_connection_owner (PrivateServer *s, DBusGConnection *connecti /**************************************************************/ static gboolean -_bus_get_unix_pid (NMDBusManager *self, +_bus_get_unix_pid (NMBusManager *self, const char *sender, gulong *out_pid, GError **error) { guint32 unix_pid = G_MAXUINT32; - if (!dbus_g_proxy_call_with_timeout (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call_with_timeout (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "GetConnectionUnixProcessID", 2000, error, G_TYPE_STRING, sender, G_TYPE_INVALID, @@ -314,7 +314,7 @@ _bus_get_unix_pid (NMDBusManager *self, * return the sender and the UID of the sender. */ static gboolean -_get_caller_info (NMDBusManager *self, +_get_caller_info (NMBusManager *self, DBusGMethodInvocation *context, DBusConnection *connection, DBusMessage *message, @@ -322,7 +322,7 @@ _get_caller_info (NMDBusManager *self, gulong *out_uid, gulong *out_pid) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); DBusGConnection *gconn; char *sender; const char *priv_sender; @@ -392,32 +392,32 @@ _get_caller_info (NMDBusManager *self, } gboolean -nm_dbus_manager_get_caller_info (NMDBusManager *self, - DBusGMethodInvocation *context, - char **out_sender, - gulong *out_uid, - gulong *out_pid) +nm_bus_manager_get_caller_info (NMBusManager *self, + DBusGMethodInvocation *context, + char **out_sender, + gulong *out_uid, + gulong *out_pid) { return _get_caller_info (self, context, NULL, NULL, out_sender, out_uid, out_pid); } gboolean -nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self, - DBusConnection *connection, - DBusMessage *message, - char **out_sender, - gulong *out_uid, - gulong *out_pid) +nm_bus_manager_get_caller_info_from_message (NMBusManager *self, + DBusConnection *connection, + DBusMessage *message, + char **out_sender, + gulong *out_uid, + gulong *out_pid) { return _get_caller_info (self, NULL, connection, message, out_sender, out_uid, out_pid); } gboolean -nm_dbus_manager_get_unix_user (NMDBusManager *self, - const char *sender, - gulong *out_uid) +nm_bus_manager_get_unix_user (NMBusManager *self, + const char *sender, + gulong *out_uid) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GSList *iter; DBusError error; @@ -455,9 +455,9 @@ nm_dbus_manager_get_unix_user (NMDBusManager *self, #if HAVE_DBUS_GLIB_100 static void -private_connection_new (NMDBusManager *self, DBusGConnection *connection) +private_connection_new (NMBusManager *self, DBusGConnection *connection) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; GObject *object; const char *path; @@ -472,9 +472,9 @@ private_connection_new (NMDBusManager *self, DBusGConnection *connection) } static void -private_connection_disconnected (NMDBusManager *self, DBusGConnection *connection) +private_connection_disconnected (NMBusManager *self, DBusGConnection *connection) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); const char *owner; owner = private_server_get_connection_owner (priv->priv_server, connection); @@ -486,9 +486,9 @@ private_connection_disconnected (NMDBusManager *self, DBusGConnection *connectio } static void -private_server_setup (NMDBusManager *self) +private_server_setup (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); /* Skip this step if this is just a test program */ if (nm_utils_get_testing ()) @@ -504,11 +504,11 @@ private_server_setup (NMDBusManager *self) priv->private_servers = g_slist_append (priv->private_servers, priv->priv_server); g_signal_connect (self, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, (GCallback) private_connection_new, NULL); g_signal_connect (self, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, (GCallback) private_connection_disconnected, NULL); } @@ -516,9 +516,9 @@ private_server_setup (NMDBusManager *self) #endif /* HAVE_DBUS_GLIB_100 */ static void -nm_dbus_manager_init (NMDBusManager *self) +nm_bus_manager_init (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); priv->exported = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); @@ -528,10 +528,10 @@ nm_dbus_manager_init (NMDBusManager *self) } static void -nm_dbus_manager_dispose (GObject *object) +nm_bus_manager_dispose (GObject *object) { - NMDBusManager *self = NM_DBUS_MANAGER (object); - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManager *self = NM_BUS_MANAGER (object); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; GObject *exported; @@ -548,54 +548,54 @@ nm_dbus_manager_dispose (GObject *object) priv->private_servers = NULL; priv->priv_server = NULL; - nm_dbus_manager_cleanup (self, TRUE); + nm_bus_manager_cleanup (self, TRUE); if (priv->reconnect_id) { g_source_remove (priv->reconnect_id); priv->reconnect_id = 0; } - G_OBJECT_CLASS (nm_dbus_manager_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_bus_manager_parent_class)->dispose (object); } static void -nm_dbus_manager_class_init (NMDBusManagerClass *klass) +nm_bus_manager_class_init (NMBusManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (NMDBusManagerPrivate)); + g_type_class_add_private (klass, sizeof (NMBusManagerPrivate)); - object_class->dispose = nm_dbus_manager_dispose; + object_class->dispose = nm_bus_manager_dispose; signals[DBUS_CONNECTION_CHANGED] = - g_signal_new (NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED, + g_signal_new (NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMDBusManagerClass, dbus_connection_changed), + G_STRUCT_OFFSET (NMBusManagerClass, dbus_connection_changed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[NAME_OWNER_CHANGED] = - g_signal_new (NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + g_signal_new (NM_BUS_MANAGER_NAME_OWNER_CHANGED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMDBusManagerClass, name_owner_changed), + G_STRUCT_OFFSET (NMBusManagerClass, name_owner_changed), NULL, NULL, NULL, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); signals[PRIVATE_CONNECTION_NEW] = - g_signal_new (NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW, + g_signal_new (NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - G_STRUCT_OFFSET (NMDBusManagerClass, private_connection_new), + G_STRUCT_OFFSET (NMBusManagerClass, private_connection_new), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[PRIVATE_CONNECTION_DISCONNECTED] = - g_signal_new (NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED, + g_signal_new (NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - G_STRUCT_OFFSET (NMDBusManagerClass, private_connection_disconnected), + G_STRUCT_OFFSET (NMBusManagerClass, private_connection_disconnected), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); } @@ -603,9 +603,9 @@ nm_dbus_manager_class_init (NMDBusManagerClass *klass) /* Only cleanup a specific dbus connection, not all our private data */ static void -nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose) +nm_bus_manager_cleanup (NMBusManager *self, gboolean dispose) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->proxy) { if (dispose) { @@ -626,15 +626,15 @@ nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose) } static gboolean -nm_dbus_manager_reconnect (gpointer user_data) +nm_bus_manager_reconnect (gpointer user_data) { - NMDBusManager *self = NM_DBUS_MANAGER (user_data); - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManager *self = NM_BUS_MANAGER (user_data); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); g_assert (self != NULL); - if (nm_dbus_manager_init_bus (self)) { - if (nm_dbus_manager_start_service (self)) { + if (nm_bus_manager_init_bus (self)) { + if (nm_bus_manager_start_service (self)) { nm_log_info (LOGD_CORE, "reconnected to the system bus."); g_signal_emit (self, signals[DBUS_CONNECTION_CHANGED], 0, priv->connection); @@ -644,38 +644,38 @@ nm_dbus_manager_reconnect (gpointer user_data) } /* Try again */ - nm_dbus_manager_cleanup (self, FALSE); + nm_bus_manager_cleanup (self, FALSE); return TRUE; } static void -start_reconnection_timeout (NMDBusManager *self) +start_reconnection_timeout (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->reconnect_id) g_source_remove (priv->reconnect_id); /* Schedule timeout for reconnection attempts */ - priv->reconnect_id = g_timeout_add_seconds (3, nm_dbus_manager_reconnect, self); + priv->reconnect_id = g_timeout_add_seconds (3, nm_bus_manager_reconnect, self); } char * -nm_dbus_manager_get_name_owner (NMDBusManager *self, - const char *name, - GError **error) +nm_bus_manager_get_name_owner (NMBusManager *self, + const char *name, + GError **error) { char *owner = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); g_return_val_if_fail (name != NULL, NULL); if (error) g_return_val_if_fail (*error == NULL, NULL); - if (!NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy) + if (!NM_BUS_MANAGER_GET_PRIVATE (self)->proxy) return NULL; - if (!dbus_g_proxy_call_with_timeout (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call_with_timeout (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "GetNameOwner", 2000, error, G_TYPE_STRING, name, G_TYPE_INVALID, @@ -688,19 +688,19 @@ nm_dbus_manager_get_name_owner (NMDBusManager *self, } gboolean -nm_dbus_manager_name_has_owner (NMDBusManager *self, - const char *name) +nm_bus_manager_name_has_owner (NMBusManager *self, + const char *name) { gboolean has_owner = FALSE; GError *err = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), FALSE); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), FALSE); g_return_val_if_fail (name != NULL, FALSE); - if (!NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy) + if (!NM_BUS_MANAGER_GET_PRIVATE (self)->proxy) return FALSE; - if (!dbus_g_proxy_call (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "NameHasOwner", &err, G_TYPE_STRING, name, G_TYPE_INVALID, @@ -728,13 +728,13 @@ proxy_name_owner_changed (DBusGProxy *proxy, static void destroy_cb (DBusGProxy *proxy, gpointer user_data) { - NMDBusManager *self = NM_DBUS_MANAGER (user_data); + NMBusManager *self = NM_BUS_MANAGER (user_data); /* Clean up existing connection */ nm_log_warn (LOGD_CORE, "disconnected by the system bus."); - NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy = NULL; + NM_BUS_MANAGER_GET_PRIVATE (self)->proxy = NULL; - nm_dbus_manager_cleanup (self, FALSE); + nm_bus_manager_cleanup (self, FALSE); g_signal_emit (G_OBJECT (self), signals[DBUS_CONNECTION_CHANGED], 0, NULL); @@ -742,9 +742,9 @@ destroy_cb (DBusGProxy *proxy, gpointer user_data) } static gboolean -nm_dbus_manager_init_bus (NMDBusManager *self) +nm_bus_manager_init_bus (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->connection) { nm_log_warn (LOGD_CORE, "DBus Manager already has a valid connection."); @@ -790,15 +790,15 @@ nm_dbus_manager_init_bus (NMDBusManager *self) * when we register on the bus, clients may start to call. */ gboolean -nm_dbus_manager_start_service (NMDBusManager *self) +nm_bus_manager_start_service (NMBusManager *self) { - NMDBusManagerPrivate *priv; + NMBusManagerPrivate *priv; int result; GError *err = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), FALSE); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), FALSE); - priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->started) { nm_log_err (LOGD_CORE, "Service has already started."); @@ -832,33 +832,33 @@ nm_dbus_manager_start_service (NMDBusManager *self) } DBusConnection * -nm_dbus_manager_get_dbus_connection (NMDBusManager *self) +nm_bus_manager_get_dbus_connection (NMBusManager *self) { - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); - return NM_DBUS_MANAGER_GET_PRIVATE (self)->connection; + return NM_BUS_MANAGER_GET_PRIVATE (self)->connection; } DBusGConnection * -nm_dbus_manager_get_connection (NMDBusManager *self) +nm_bus_manager_get_connection (NMBusManager *self) { - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); - return NM_DBUS_MANAGER_GET_PRIVATE (self)->g_connection; + return NM_BUS_MANAGER_GET_PRIVATE (self)->g_connection; } static void -object_destroyed (NMDBusManager *self, gpointer object) +object_destroyed (NMBusManager *self, gpointer object) { - g_hash_table_remove (NM_DBUS_MANAGER_GET_PRIVATE (self)->exported, object); + g_hash_table_remove (NM_BUS_MANAGER_GET_PRIVATE (self)->exported, object); } void -nm_dbus_manager_register_object (NMDBusManager *self, - const char *path, - gpointer object) +nm_bus_manager_register_object (NMBusManager *self, + const char *path, + gpointer object) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; DBusConnection *connection; @@ -884,9 +884,9 @@ nm_dbus_manager_register_object (NMDBusManager *self, } void -nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) +nm_bus_manager_unregister_object (NMBusManager *self, gpointer object) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; DBusConnection *connection; @@ -911,8 +911,8 @@ nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) } /** - * nm_dbus_manager_new_proxy: - * @self: the #NMDBusManager + * nm_bus_manager_new_proxy: + * @self: the #NMBusManager * @context: the method call context this proxy should be created * @name: any name on the message bus * @path: name of the object instance to call methods on @@ -926,13 +926,13 @@ nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) * Returns: a #DBusGProxy capable of calling D-Bus methods of the calling process */ DBusGProxy * -nm_dbus_manager_new_proxy (NMDBusManager *self, - DBusGMethodInvocation *context, - const char *name, - const char *path, - const char *iface) +nm_bus_manager_new_proxy (NMBusManager *self, + DBusGMethodInvocation *context, + const char *name, + const char *path, + const char *iface) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); DBusGConnection *connection; GSList *iter; const char *owner; diff --git a/src/nm-bus-manager.h b/src/nm-bus-manager.h new file mode 100644 index 0000000000..06b362d4e3 --- /dev/null +++ b/src/nm-bus-manager.h @@ -0,0 +1,129 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * 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. + * + * Copyright (C) 2006 - 2008 Red Hat, Inc. + * Copyright (C) 2006 - 2008 Novell, Inc. + */ + +#ifndef __NM_BUS_MANAGER_H__ +#define __NM_BUS_MANAGER_H__ + +#include <config.h> +#include <dbus/dbus.h> +#include <dbus/dbus-glib.h> + +#include "nm-glib.h" +#include "nm-types.h" + +G_BEGIN_DECLS + +typedef gboolean (* NMDBusSignalHandlerFunc) (DBusConnection * connection, + DBusMessage * message, + gpointer user_data); + +#define NM_TYPE_BUS_MANAGER (nm_bus_manager_get_type ()) +#define NM_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_BUS_MANAGER, NMBusManager)) +#define NM_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_BUS_MANAGER, NMBusManagerClass)) +#define NM_IS_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_BUS_MANAGER)) +#define NM_IS_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_BUS_MANAGER)) +#define NM_BUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_BUS_MANAGER, NMBusManagerClass)) + +#define NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED "dbus-connection-changed" +#define NM_BUS_MANAGER_NAME_OWNER_CHANGED "name-owner-changed" +#define NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new" +#define NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected" + +struct _NMBusManager { + GObject parent; +}; + +typedef struct { + GObjectClass parent; + + /* Signals */ + void (*dbus_connection_changed) (NMBusManager *mgr, + DBusConnection *connection); + + void (*name_owner_changed) (NMBusManager *mgr, + const char *name, + const char *old_owner, + const char *new_owner); + + void (*private_connection_new) (NMBusManager *mgr, + DBusGConnection *connection); + + void (*private_connection_disconnected) (NMBusManager *mgr, + DBusGConnection *connection); +} NMBusManagerClass; + +GType nm_bus_manager_get_type (void); + +NMBusManager * nm_bus_manager_get (void); +void nm_bus_manager_setup (NMBusManager *instance); + +char * nm_bus_manager_get_name_owner (NMBusManager *self, + const char *name, + GError **error); + +gboolean nm_bus_manager_start_service (NMBusManager *self); + +gboolean nm_bus_manager_name_has_owner (NMBusManager *self, + const char *name); + +DBusConnection * nm_bus_manager_get_dbus_connection (NMBusManager *self); +DBusGConnection * nm_bus_manager_get_connection (NMBusManager *self); + +gboolean nm_bus_manager_get_caller_info (NMBusManager *self, + DBusGMethodInvocation *context, + char **out_sender, + gulong *out_uid, + gulong *out_pid); + +gboolean nm_bus_manager_get_unix_user (NMBusManager *self, + const char *sender, + gulong *out_uid); + +gboolean nm_bus_manager_get_caller_info_from_message (NMBusManager *self, + DBusConnection *connection, + DBusMessage *message, + char **out_sender, + gulong *out_uid, + gulong *out_pid); + +void nm_bus_manager_register_object (NMBusManager *self, + const char *path, + gpointer object); + +void nm_bus_manager_unregister_object (NMBusManager *self, gpointer object); + +void nm_bus_manager_private_server_register (NMBusManager *self, + const char *path, + const char *tag); + +DBusGProxy *nm_bus_manager_new_proxy (NMBusManager *self, + DBusGMethodInvocation *context, + const char *name, + const char *path, + const char *iface); + +#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION +DBusGConnection *dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context); +#endif + +G_END_DECLS + +#endif /* __NM_BUS_MANAGER_H__ */ diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h deleted file mode 100644 index 2ce12a2d41..0000000000 --- a/src/nm-dbus-manager.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * 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. - * - * Copyright (C) 2006 - 2008 Red Hat, Inc. - * Copyright (C) 2006 - 2008 Novell, Inc. - */ - -#ifndef __NM_DBUS_MANAGER_H__ -#define __NM_DBUS_MANAGER_H__ - -#include <config.h> -#include <dbus/dbus.h> -#include <dbus/dbus-glib.h> - -#include "nm-glib.h" -#include "nm-types.h" - -G_BEGIN_DECLS - -typedef gboolean (* NMDBusSignalHandlerFunc) (DBusConnection * connection, - DBusMessage * message, - gpointer user_data); - -#define NM_TYPE_DBUS_MANAGER (nm_dbus_manager_get_type ()) -#define NM_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_DBUS_MANAGER, NMDBusManager)) -#define NM_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass)) -#define NM_IS_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_DBUS_MANAGER)) -#define NM_IS_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_DBUS_MANAGER)) -#define NM_DBUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass)) - -#define NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED "dbus-connection-changed" -#define NM_DBUS_MANAGER_NAME_OWNER_CHANGED "name-owner-changed" -#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new" -#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected" - -struct _NMDBusManager { - GObject parent; -}; - -typedef struct { - GObjectClass parent; - - /* Signals */ - void (*dbus_connection_changed) (NMDBusManager *mgr, - DBusConnection *connection); - - void (*name_owner_changed) (NMDBusManager *mgr, - const char *name, - const char *old_owner, - const char *new_owner); - - void (*private_connection_new) (NMDBusManager *mgr, - DBusGConnection *connection); - - void (*private_connection_disconnected) (NMDBusManager *mgr, - DBusGConnection *connection); -} NMDBusManagerClass; - -GType nm_dbus_manager_get_type (void); - -NMDBusManager * nm_dbus_manager_get (void); -void nm_dbus_manager_setup (NMDBusManager *instance); - -char * nm_dbus_manager_get_name_owner (NMDBusManager *self, - const char *name, - GError **error); - -gboolean nm_dbus_manager_start_service (NMDBusManager *self); - -gboolean nm_dbus_manager_name_has_owner (NMDBusManager *self, - const char *name); - -DBusConnection * nm_dbus_manager_get_dbus_connection (NMDBusManager *self); -DBusGConnection * nm_dbus_manager_get_connection (NMDBusManager *self); - -gboolean nm_dbus_manager_get_caller_info (NMDBusManager *self, - DBusGMethodInvocation *context, - char **out_sender, - gulong *out_uid, - gulong *out_pid); - -gboolean nm_dbus_manager_get_unix_user (NMDBusManager *self, - const char *sender, - gulong *out_uid); - -gboolean nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self, - DBusConnection *connection, - DBusMessage *message, - char **out_sender, - gulong *out_uid, - gulong *out_pid); - -void nm_dbus_manager_register_object (NMDBusManager *self, - const char *path, - gpointer object); - -void nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object); - -void nm_dbus_manager_private_server_register (NMDBusManager *self, - const char *path, - const char *tag); - -DBusGProxy *nm_dbus_manager_new_proxy (NMDBusManager *self, - DBusGMethodInvocation *context, - const char *name, - const char *path, - const char *iface); - -#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION -DBusGConnection *dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context); -#endif - -G_END_DECLS - -#endif /* __NM_DBUS_MANAGER_H__ */ diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index cba3b5cad6..d8e6be2f7b 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -30,7 +30,6 @@ #include "NetworkManagerUtils.h" #include "nm-utils.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c index 7fd6c623ea..1023842332 100644 --- a/src/nm-exported-object.c +++ b/src/nm-exported-object.c @@ -24,7 +24,7 @@ #include "nm-exported-object.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-logging.h" static GHashTable *prefix_counters; @@ -160,7 +160,7 @@ nm_exported_object_export (NMExportedObject *self) } else priv->path = g_strdup (class_export_path); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); + nm_bus_manager_register_object (nm_bus_manager_get (), priv->path, self); return priv->path; } @@ -215,7 +215,7 @@ nm_exported_object_unexport (NMExportedObject *self) g_return_if_fail (priv->path != NULL); g_clear_pointer (&priv->path, g_free); - nm_dbus_manager_unregister_object (nm_dbus_manager_get (), self); + nm_bus_manager_unregister_object (nm_bus_manager_get (), self); } static void diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 1302c070c0..a35d0d7c04 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -504,10 +504,9 @@ nm_main_config_reload (int signal) gconstpointer nm_config_get (void); const char *nm_config_get_dhcp_client (gpointer unused); gboolean nm_config_get_configure_and_quit (gpointer unused); -gconstpointer nm_dbus_manager_get (void); -void nm_dbus_manager_register_exported_type (gpointer unused, GType gtype, gconstpointer unused2); -void nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer object); -void nm_dbus_manager_unregister_object (gpointer unused, gpointer object); +gconstpointer nm_bus_manager_get (void); +void nm_bus_manager_register_object (gpointer unused, const char *path, gpointer object); +void nm_bus_manager_unregister_object (gpointer unused, gpointer object); gconstpointer nm_config_get (void) @@ -528,23 +527,18 @@ nm_config_get_configure_and_quit (gpointer unused) } gconstpointer -nm_dbus_manager_get (void) +nm_bus_manager_get (void) { return GUINT_TO_POINTER (1); } void -nm_dbus_manager_register_exported_type (gpointer unused, GType gtype, gconstpointer unused2) +nm_bus_manager_register_object (gpointer unused, const char *path, gpointer object) { } void -nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer object) -{ -} - -void -nm_dbus_manager_unregister_object (gpointer unused, gpointer object) +nm_bus_manager_unregister_object (gpointer unused, gpointer object) { } diff --git a/src/nm-manager.c b/src/nm-manager.c index a5983a3480..7d1d2b3ca5 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -34,7 +34,7 @@ #include "gsystem-local-alloc.h" #include "nm-manager.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-vpn-manager.h" #include "nm-device.h" #include "nm-device-generic.h" @@ -166,7 +166,7 @@ typedef struct { NMPolicy *policy; - NMDBusManager *dbus_mgr; + NMBusManager *dbus_mgr; gboolean prop_filter_added; NMRfkillManager *rfkill_mgr; @@ -3992,7 +3992,7 @@ impl_manager_set_logging (NMManager *manager, GError *error = NULL; gulong caller_uid = G_MAXULONG; - if (!nm_dbus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid, NULL)) { + if (!nm_bus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid, NULL)) { error = g_error_new_literal (NM_MANAGER_ERROR, NM_MANAGER_ERROR_PERMISSION_DENIED, "Failed to get request UID."); @@ -4626,7 +4626,7 @@ periodic_update_active_connection_timestamps (gpointer user_data) } static void -dbus_connection_changed_cb (NMDBusManager *dbus_mgr, +dbus_connection_changed_cb (NMBusManager *dbus_mgr, DBusConnection *dbus_connection, gpointer user_data) { @@ -4686,7 +4686,7 @@ nm_manager_new (NMSettings *settings, priv = NM_MANAGER_GET_PRIVATE (singleton); - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + bus = nm_bus_manager_get_connection (priv->dbus_mgr); if (!bus) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, "Failed to initialize D-Bus connection"); @@ -4817,9 +4817,9 @@ nm_manager_init (NMManager *manager) priv->state = NM_STATE_DISCONNECTED; priv->startup = TRUE; - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED, + NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED, G_CALLBACK (dbus_connection_changed_cb), manager); @@ -5027,7 +5027,7 @@ dispose (GObject *object) /* Unregister property filter */ if (priv->dbus_mgr) { - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + bus = nm_bus_manager_get_connection (priv->dbus_mgr); if (bus) { dbus_connection = dbus_g_connection_get_connection (bus); if (dbus_connection && priv->prop_filter_added) { diff --git a/src/nm-types.h b/src/nm-types.h index 530f9f7b5b..7d3cf48129 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -30,11 +30,11 @@ typedef struct _NMActiveConnection NMActiveConnection; typedef struct _NMVpnConnection NMVpnConnection; typedef struct _NMActRequest NMActRequest; typedef struct _NMAuthSubject NMAuthSubject; +typedef struct _NMBusManager NMBusManager; typedef struct _NMConfig NMConfig; typedef struct _NMConfigData NMConfigData; typedef struct _NMConnectionProvider NMConnectionProvider; typedef struct _NMConnectivity NMConnectivity; -typedef struct _NMDBusManager NMDBusManager; typedef struct _NMDefaultRouteManager NMDefaultRouteManager; typedef struct _NMDevice NMDevice; typedef struct _NMDhcp4Config NMDhcp4Config; diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index bd720950ee..f767c29e31 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -45,7 +45,6 @@ #include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-ppp-manager.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-platform.h" #include "nm-core-internal.h" diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index eb0073be0a..eaf5ff3f2b 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -38,7 +38,7 @@ #include "nm-setting-connection.h" #include "nm-enum-types.h" #include "nm-auth-manager.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-session-monitor.h" #include "nm-simple-connection.h" #include "NetworkManagerUtils.h" @@ -355,11 +355,11 @@ impl_agent_manager_unregister (NMAgentManager *self, GError *error = NULL; char *sender = NULL; - if (!nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), - context, - &sender, - NULL, - NULL)) { + if (!nm_bus_manager_get_caller_info (nm_bus_manager_get (), + context, + &sender, + NULL, + NULL)) { error = g_error_new_literal (NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED, "Unable to determine request sender."); diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index e1355a76cd..a2b5da5795 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -29,7 +29,7 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-secret-agent.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-dbus-glib-types.h" #include "nm-logging.h" #include "nm-auth-subject.h" @@ -460,7 +460,7 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self, static void proxy_cleanup (NMSecretAgent *self); static void -name_owner_changed_cb (NMDBusManager *dbus_mgr, +name_owner_changed_cb (NMBusManager *dbus_mgr, const char *name, const char *old_owner, const char *new_owner, @@ -482,7 +482,7 @@ proxy_cleanup (NMSecretAgent *self) g_signal_handlers_disconnect_by_func (priv->proxy, proxy_cleanup, self); g_clear_object (&priv->proxy); - g_signal_handlers_disconnect_by_func (nm_dbus_manager_get (), name_owner_changed_cb, self); + g_signal_handlers_disconnect_by_func (nm_bus_manager_get (), name_owner_changed_cb, self); g_clear_pointer (&priv->dbus_owner, g_free); g_signal_emit (self, signals[DISCONNECTED], 0); @@ -524,16 +524,16 @@ nm_secret_agent_new (DBusGMethodInvocation *context, priv->hash = g_str_hash (hash_str); g_free (hash_str); - priv->proxy = nm_dbus_manager_new_proxy (nm_dbus_manager_get (), - context, - priv->dbus_owner, - NM_DBUS_PATH_SECRET_AGENT, - NM_DBUS_INTERFACE_SECRET_AGENT); + priv->proxy = nm_bus_manager_new_proxy (nm_bus_manager_get (), + context, + priv->dbus_owner, + NM_DBUS_PATH_SECRET_AGENT, + NM_DBUS_INTERFACE_SECRET_AGENT); g_assert (priv->proxy); g_signal_connect_swapped (priv->proxy, "destroy", G_CALLBACK (proxy_cleanup), self); - g_signal_connect (nm_dbus_manager_get (), - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + g_signal_connect (nm_bus_manager_get (), + NM_BUS_MANAGER_NAME_OWNER_CHANGED, G_CALLBACK (name_owner_changed_cb), self); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 663898a421..ba5035a513 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -67,7 +67,7 @@ #include "nm-settings-connection.h" #include "nm-system-config-interface.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-auth-utils.h" #include "nm-auth-subject.h" #include "nm-session-monitor.h" @@ -161,7 +161,7 @@ G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT, 0, typedef struct { - NMDBusManager *dbus_mgr; + NMBusManager *dbus_mgr; NMAgentManager *agent_mgr; @@ -1435,13 +1435,13 @@ impl_settings_add_connection_unsaved (NMSettings *self, } static gboolean -ensure_root (NMDBusManager *dbus_mgr, +ensure_root (NMBusManager *dbus_mgr, DBusGMethodInvocation *context) { gulong caller_uid; GError *error = NULL; - if (!nm_dbus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid, NULL)) { + if (!nm_bus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid, NULL)) { error = g_error_new_literal (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_PERMISSION_DENIED, "Unable to determine request UID."); @@ -2102,7 +2102,7 @@ nm_settings_new (GError **error) priv = NM_SETTINGS_GET_PRIVATE (self); priv->config = nm_config_get (); - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); /* Load the plugins; fail if a plugin is not found. */ if (!load_plugins (self, nm_config_get_plugins (priv->config), error)) { diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index 39043ec50f..69e6894347 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -28,7 +28,7 @@ #include "nm-test-device.h" #include "nm-fake-platform.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-test-utils.h" @@ -757,10 +757,10 @@ main (int argc, char **argv) /* Initialize the DBus manager singleton explicitly, because it is accessed by * the class initializer of NMDevice (used by the NMTestDevice stub). - * This way, we skip calling nm_dbus_manager_init_bus() which would + * This way, we skip calling nm_bus_manager_init_bus() which would * either fail and/or cause unexpected actions in the test. * */ - nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL)); + nm_bus_manager_setup (g_object_new (NM_TYPE_BUS_MANAGER, NULL)); nm_fake_platform_setup (); |