From 8c3d6f734b3d53bf55cfb6b5d26ca8b3d748fd1c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 9 Oct 2014 09:12:42 -0400 Subject: [PATCH 1/2] libnm: add nm-types.h, to avoid include loops Add nm-types.h defining all the type structs, to avoid future include loops. Clean up the includes in all of the installed headers. --- libnm/Makefile.am | 1 + libnm/nm-access-point.h | 10 ++----- libnm/nm-active-connection.c | 4 +++ libnm/nm-active-connection.h | 14 ++------- libnm/nm-client.c | 1 + libnm/nm-client.h | 14 ++------- libnm/nm-device-adsl.h | 6 ++-- libnm/nm-device-bond.h | 6 ++-- libnm/nm-device-bridge.h | 6 ++-- libnm/nm-device-bt.h | 7 ++--- libnm/nm-device-ethernet.h | 6 ++-- libnm/nm-device-generic.h | 6 ++-- libnm/nm-device-infiniband.h | 6 ++-- libnm/nm-device-modem.h | 6 ++-- libnm/nm-device-olpc-mesh.h | 7 ++--- libnm/nm-device-team.h | 6 ++-- libnm/nm-device-vlan.h | 6 ++-- libnm/nm-device-wifi.c | 1 + libnm/nm-device-wifi.h | 7 ++--- libnm/nm-device-wimax.c | 1 + libnm/nm-device-wimax.h | 7 ++--- libnm/nm-device.c | 5 ++++ libnm/nm-device.h | 15 ++-------- libnm/nm-dhcp4-config.h | 8 ++---- libnm/nm-dhcp6-config.h | 8 ++---- libnm/nm-ip4-config.h | 8 ++---- libnm/nm-ip6-config.h | 8 ++---- libnm/nm-manager.h | 4 +-- libnm/nm-object.h | 8 ++---- libnm/nm-remote-connection.h | 5 ++-- libnm/nm-remote-settings.c | 1 + libnm/nm-remote-settings.h | 3 -- libnm/nm-secret-agent.h | 7 ++--- libnm/nm-types.h | 56 ++++++++++++++++++++++++++++++++++++ libnm/nm-vpn-connection.h | 10 +++---- libnm/nm-wimax-nsp.h | 9 ++---- 36 files changed, 150 insertions(+), 133 deletions(-) create mode 100644 libnm/nm-types.h diff --git a/libnm/Makefile.am b/libnm/Makefile.am index e3945b88b6..458aee8860 100644 --- a/libnm/Makefile.am +++ b/libnm/Makefile.am @@ -51,6 +51,7 @@ libnminclude_HEADERS = \ nm-object.h \ nm-remote-connection.h \ nm-secret-agent.h \ + nm-types.h \ nm-vpn-connection.h \ nm-vpn-plugin.h \ nm-vpn-plugin-ui-interface.h \ diff --git a/libnm/nm-access-point.h b/libnm/nm-access-point.h index 1062388d09..53935e5fa9 100644 --- a/libnm/nm-access-point.h +++ b/libnm/nm-access-point.h @@ -26,11 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -55,9 +51,9 @@ G_BEGIN_DECLS #define NM_ACCESS_POINT_HW_ADDRESS "hw-address" -typedef struct { +struct _NMAccessPoint { NMObject parent; -} NMAccessPoint; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index 2c6c2ec8f8..80ab449355 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -31,6 +31,10 @@ #include "nm-vpn-connection.h" #include "nm-glib-compat.h" #include "nm-dbus-helpers.h" +#include "nm-dhcp4-config.h" +#include "nm-dhcp6-config.h" +#include "nm-ip4-config.h" +#include "nm-ip6-config.h" static GType _nm_active_connection_decide_type (GVariant *value); diff --git a/libnm/nm-active-connection.h b/libnm/nm-active-connection.h index 09fe891edb..2b0d6821c1 100644 --- a/libnm/nm-active-connection.h +++ b/libnm/nm-active-connection.h @@ -26,15 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" -#include -#include -#include "nm-ip4-config.h" -#include "nm-dhcp4-config.h" -#include "nm-ip6-config.h" -#include "nm-dhcp6-config.h" +#include G_BEGIN_DECLS @@ -61,9 +53,9 @@ G_BEGIN_DECLS #define NM_ACTIVE_CONNECTION_VPN "vpn" #define NM_ACTIVE_CONNECTION_MASTER "master" -typedef struct { +struct _NMActiveConnection { NMObject parent; -} NMActiveConnection; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 9ecb77a1cf..87b01d62b0 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -31,6 +31,7 @@ #include "nm-core-internal.h" #include "nm-active-connection.h" #include "nm-vpn-connection.h" +#include "nm-remote-connection.h" #include "nm-object-cache.h" #include "nm-glib-compat.h" #include "nm-dbus-helpers.h" diff --git a/libnm/nm-client.h b/libnm/nm-client.h index 99de7e003a..64bd0a0d32 100644 --- a/libnm/nm-client.h +++ b/libnm/nm-client.h @@ -26,15 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include - -#include -#include "nm-device.h" -#include "nm-active-connection.h" -#include "nm-remote-connection.h" -#include "nm-vpn-connection.h" +#include G_BEGIN_DECLS @@ -159,9 +151,9 @@ typedef enum { #define NM_CLIENT_ERROR nm_client_error_quark () GQuark nm_client_error_quark (void); -typedef struct { +struct _NMClient { GObject parent; -} NMClient; +}; typedef struct { GObjectClass parent; diff --git a/libnm/nm-device-adsl.h b/libnm/nm-device-adsl.h index 3c175f0f86..d76f35a891 100644 --- a/libnm/nm-device-adsl.h +++ b/libnm/nm-device-adsl.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -53,9 +53,9 @@ GQuark nm_device_adsl_error_quark (void); #define NM_DEVICE_ADSL_CARRIER "carrier" -typedef struct { +struct _NMDeviceAdsl { NMDevice parent; -} NMDeviceAdsl; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-bond.h b/libnm/nm-device-bond.h index 8e1522af2a..e8ffd8e633 100644 --- a/libnm/nm-device-bond.h +++ b/libnm/nm-device-bond.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -57,9 +57,9 @@ GQuark nm_device_bond_error_quark (void); #define NM_DEVICE_BOND_CARRIER "carrier" #define NM_DEVICE_BOND_SLAVES "slaves" -typedef struct { +struct _NMDeviceBond { NMDevice parent; -} NMDeviceBond; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-bridge.h b/libnm/nm-device-bridge.h index 05c6ea72c5..4ec490e13f 100644 --- a/libnm/nm-device-bridge.h +++ b/libnm/nm-device-bridge.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -57,9 +57,9 @@ GQuark nm_device_bridge_error_quark (void); #define NM_DEVICE_BRIDGE_CARRIER "carrier" #define NM_DEVICE_BRIDGE_SLAVES "slaves" -typedef struct { +struct _NMDeviceBridge { NMDevice parent; -} NMDeviceBridge; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-bt.h b/libnm/nm-device-bt.h index 5861e812a8..b6c6045ead 100644 --- a/libnm/nm-device-bt.h +++ b/libnm/nm-device-bt.h @@ -26,8 +26,7 @@ #error "Only can be included directly." #endif -#include "nm-dbus-interface.h" -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -63,9 +62,9 @@ GQuark nm_device_bt_error_quark (void); #define NM_DEVICE_BT_NAME "name" #define NM_DEVICE_BT_CAPABILITIES "bt-capabilities" -typedef struct { +struct _NMDeviceBt { NMDevice parent; -} NMDeviceBt; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-ethernet.h b/libnm/nm-device-ethernet.h index 68a8f40104..caea242c87 100644 --- a/libnm/nm-device-ethernet.h +++ b/libnm/nm-device-ethernet.h @@ -26,7 +26,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -61,9 +61,9 @@ GQuark nm_device_ethernet_error_quark (void); #define NM_DEVICE_ETHERNET_SPEED "speed" #define NM_DEVICE_ETHERNET_CARRIER "carrier" -typedef struct { +struct _NMDeviceEthernet { NMDevice parent; -} NMDeviceEthernet; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-generic.h b/libnm/nm-device-generic.h index d6160be671..be0d932d93 100644 --- a/libnm/nm-device-generic.h +++ b/libnm/nm-device-generic.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -54,9 +54,9 @@ GQuark nm_device_generic_error_quark (void); #define NM_DEVICE_GENERIC_HW_ADDRESS "hw-address" #define NM_DEVICE_GENERIC_TYPE_DESCRIPTION "type-description" -typedef struct { +struct _NMDeviceGeneric { NMDevice parent; -} NMDeviceGeneric; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-infiniband.h b/libnm/nm-device-infiniband.h index 279af5026f..ac15410afa 100644 --- a/libnm/nm-device-infiniband.h +++ b/libnm/nm-device-infiniband.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -58,9 +58,9 @@ GQuark nm_device_infiniband_error_quark (void); #define NM_DEVICE_INFINIBAND_HW_ADDRESS "hw-address" #define NM_DEVICE_INFINIBAND_CARRIER "carrier" -typedef struct { +struct _NMDeviceInfiniband { NMDevice parent; -} NMDeviceInfiniband; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-modem.h b/libnm/nm-device-modem.h index 22e2195035..dd5b2656ea 100644 --- a/libnm/nm-device-modem.h +++ b/libnm/nm-device-modem.h @@ -26,7 +26,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -57,9 +57,9 @@ GQuark nm_device_modem_error_quark (void); #define NM_DEVICE_MODEM_MODEM_CAPABILITIES "modem-capabilities" #define NM_DEVICE_MODEM_CURRENT_CAPABILITIES "current-capabilities" -typedef struct { +struct _NMDeviceModem { NMDevice parent; -} NMDeviceModem; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-olpc-mesh.h b/libnm/nm-device-olpc-mesh.h index 69097b063c..c1bb7a9e28 100644 --- a/libnm/nm-device-olpc-mesh.h +++ b/libnm/nm-device-olpc-mesh.h @@ -25,8 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" -#include "nm-device-wifi.h" +#include G_BEGIN_DECLS @@ -56,9 +55,9 @@ GQuark nm_device_olpc_mesh_error_quark (void); #define NM_DEVICE_OLPC_MESH_COMPANION "companion" #define NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL "active-channel" -typedef struct { +struct _NMDeviceOlpcMesh { NMDevice parent; -} NMDeviceOlpcMesh; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-team.h b/libnm/nm-device-team.h index 3cb4e358ed..f8b9548b00 100644 --- a/libnm/nm-device-team.h +++ b/libnm/nm-device-team.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -57,9 +57,9 @@ GQuark nm_device_team_error_quark (void); #define NM_DEVICE_TEAM_CARRIER "carrier" #define NM_DEVICE_TEAM_SLAVES "slaves" -typedef struct { +struct _NMDeviceTeam { NMDevice parent; -} NMDeviceTeam; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-vlan.h b/libnm/nm-device-vlan.h index 574e13c7e9..379364beba 100644 --- a/libnm/nm-device-vlan.h +++ b/libnm/nm-device-vlan.h @@ -25,7 +25,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" +#include G_BEGIN_DECLS @@ -61,9 +61,9 @@ GQuark nm_device_vlan_error_quark (void); #define NM_DEVICE_VLAN_CARRIER "carrier" #define NM_DEVICE_VLAN_VLAN_ID "vlan-id" -typedef struct { +struct _NMDeviceVlan { NMDevice parent; -} NMDeviceVlan; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index 84c8288e0e..1d0cd39aa7 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -30,6 +30,7 @@ #include #include "nm-device-wifi.h" +#include "nm-access-point.h" #include "nm-device-private.h" #include "nm-object-private.h" #include "nm-object-cache.h" diff --git a/libnm/nm-device-wifi.h b/libnm/nm-device-wifi.h index bb9788cc07..7947f6959f 100644 --- a/libnm/nm-device-wifi.h +++ b/libnm/nm-device-wifi.h @@ -26,8 +26,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" -#include "nm-access-point.h" +#include G_BEGIN_DECLS @@ -71,9 +70,9 @@ GQuark nm_device_wifi_error_quark (void); #define NM_DEVICE_WIFI_CAPABILITIES "wireless-capabilities" #define NM_DEVICE_WIFI_ACCESS_POINTS "access-points" -typedef struct { +struct _NMDeviceWifi { NMDevice parent; -} NMDeviceWifi; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device-wimax.c b/libnm/nm-device-wimax.c index ec16279191..dfb6fbe53d 100644 --- a/libnm/nm-device-wimax.c +++ b/libnm/nm-device-wimax.c @@ -29,6 +29,7 @@ #include #include "nm-device-wimax.h" +#include "nm-wimax-nsp.h" #include "nm-object-private.h" #include "nm-object-cache.h" #include "nm-core-internal.h" diff --git a/libnm/nm-device-wimax.h b/libnm/nm-device-wimax.h index 36b13e4f69..ea76547b15 100644 --- a/libnm/nm-device-wimax.h +++ b/libnm/nm-device-wimax.h @@ -26,8 +26,7 @@ #error "Only can be included directly." #endif -#include "nm-device.h" -#include "nm-wimax-nsp.h" +#include G_BEGIN_DECLS @@ -66,9 +65,9 @@ GQuark nm_device_wimax_error_quark (void); #define NM_DEVICE_WIMAX_BSID "bsid" #define NM_DEVICE_WIMAX_NSPS "nsps" -typedef struct { +struct _NMDeviceWimax { NMDevice parent; -} NMDeviceWimax; +}; typedef struct { NMDeviceClass parent; diff --git a/libnm/nm-device.c b/libnm/nm-device.c index f523fdf1f2..e1cadb1ae8 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -25,6 +25,7 @@ #include #include "nm-dbus-interface.h" +#include "nm-active-connection.h" #include "nm-device-ethernet.h" #include "nm-device-adsl.h" #include "nm-device-wifi.h" @@ -40,6 +41,10 @@ #include "nm-device-generic.h" #include "nm-device.h" #include "nm-device-private.h" +#include "nm-dhcp4-config.h" +#include "nm-dhcp6-config.h" +#include "nm-ip4-config.h" +#include "nm-ip6-config.h" #include "nm-object-private.h" #include "nm-object-cache.h" #include "nm-remote-connection.h" diff --git a/libnm/nm-device.h b/libnm/nm-device.h index f19c675ffe..5af1e07b29 100644 --- a/libnm/nm-device.h +++ b/libnm/nm-device.h @@ -26,16 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" -#include "nm-dbus-interface.h" -#include "nm-ip4-config.h" -#include "nm-dhcp4-config.h" -#include "nm-ip6-config.h" -#include "nm-dhcp6-config.h" -#include "nm-connection.h" -#include "nm-active-connection.h" +#include G_BEGIN_DECLS @@ -84,9 +75,9 @@ GQuark nm_device_error_quark (void); #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id" #define NM_DEVICE_MTU "mtu" -typedef struct { +struct _NMDevice { NMObject parent; -} NMDevice; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-dhcp4-config.h b/libnm/nm-dhcp4-config.h index 306327843d..90152c8f63 100644 --- a/libnm/nm-dhcp4-config.h +++ b/libnm/nm-dhcp4-config.h @@ -26,9 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -38,9 +36,9 @@ G_BEGIN_DECLS #define NM_IS_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP4_CONFIG)) #define NM_IS_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP4_CONFIG)) -typedef struct { +struct _NMDhcp4Config { NMObject parent; -} NMDhcp4Config; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-dhcp6-config.h b/libnm/nm-dhcp6-config.h index f5c43017f4..53bd45eeb7 100644 --- a/libnm/nm-dhcp6-config.h +++ b/libnm/nm-dhcp6-config.h @@ -26,9 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -38,9 +36,9 @@ G_BEGIN_DECLS #define NM_IS_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP6_CONFIG)) #define NM_IS_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP6_CONFIG)) -typedef struct { +struct _NMDhcp6Config { NMObject parent; -} NMDhcp6Config; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-ip4-config.h b/libnm/nm-ip4-config.h index ce65fd8cbd..a933a5e277 100644 --- a/libnm/nm-ip4-config.h +++ b/libnm/nm-ip4-config.h @@ -26,9 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -39,9 +37,9 @@ G_BEGIN_DECLS #define NM_IS_IP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP4_CONFIG)) #define NM_IP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass)) -typedef struct { +struct _NMIP4Config { NMObject parent; -} NMIP4Config; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-ip6-config.h b/libnm/nm-ip6-config.h index 385bfdf73e..2c98633411 100644 --- a/libnm/nm-ip6-config.h +++ b/libnm/nm-ip6-config.h @@ -26,9 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -39,9 +37,9 @@ G_BEGIN_DECLS #define NM_IS_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP6_CONFIG)) #define NM_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass)) -typedef struct { +struct _NMIP6Config { NMObject parent; -} NMIP6Config; +}; typedef struct { NMObjectClass parent; diff --git a/libnm/nm-manager.h b/libnm/nm-manager.h index 6b74b44483..430b038e03 100644 --- a/libnm/nm-manager.h +++ b/libnm/nm-manager.h @@ -22,8 +22,8 @@ #ifndef __NM_MANAGER_H__ #define __NM_MANAGER_H__ -#include "nm-client.h" -#include "nm-object.h" +#include +#include G_BEGIN_DECLS diff --git a/libnm/nm-object.h b/libnm/nm-object.h index 69232364f4..829c539229 100644 --- a/libnm/nm-object.h +++ b/libnm/nm-object.h @@ -26,9 +26,7 @@ #error "Only can be included directly." #endif -#include - -#include +#include G_BEGIN_DECLS @@ -58,9 +56,9 @@ GQuark nm_object_error_quark (void); #define NM_OBJECT_PATH "path" #define NM_OBJECT_DBUS_CONNECTION "dbus-connection" -typedef struct { +struct _NMObject { GObject parent; -} NMObject; +}; typedef struct { GObjectClass parent; diff --git a/libnm/nm-remote-connection.h b/libnm/nm-remote-connection.h index 6631e01b0a..191a8c3fa9 100644 --- a/libnm/nm-remote-connection.h +++ b/libnm/nm-remote-connection.h @@ -26,7 +26,6 @@ #error "Only can be included directly." #endif -#include #include G_BEGIN_DECLS @@ -58,9 +57,9 @@ GQuark nm_remote_connection_error_quark (void); #define NM_REMOTE_CONNECTION_UNSAVED "unsaved" #define NM_REMOTE_CONNECTION_VISIBLE "visible" -typedef struct { +struct _NMRemoteConnection { NMObject parent; -} NMRemoteConnection; +}; typedef struct { NMObjectClass parent_class; diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index 12e5450375..2c2dd597e6 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -25,6 +25,7 @@ #include "nm-remote-settings.h" #include "nm-client.h" +#include "nm-remote-connection.h" #include "nm-remote-connection-private.h" #include "nm-object-private.h" #include "nm-dbus-helpers.h" diff --git a/libnm/nm-remote-settings.h b/libnm/nm-remote-settings.h index bed6a495e4..dbe39abe5e 100644 --- a/libnm/nm-remote-settings.h +++ b/libnm/nm-remote-settings.h @@ -22,10 +22,7 @@ #ifndef __NM_REMOTE_SETTINGS_H__ #define __NM_REMOTE_SETTINGS_H__ -#include #include -#include -#include G_BEGIN_DECLS diff --git a/libnm/nm-secret-agent.h b/libnm/nm-secret-agent.h index 90fcc7d7e1..6b88699005 100644 --- a/libnm/nm-secret-agent.h +++ b/libnm/nm-secret-agent.h @@ -25,8 +25,7 @@ #error "Only can be included directly." #endif -#include -#include +#include G_BEGIN_DECLS @@ -72,9 +71,9 @@ typedef enum { #define NM_SECRET_AGENT_REGISTERED "registered" #define NM_SECRET_AGENT_CAPABILITIES "capabilities" -typedef struct { +struct _NMSecretAgent { GObject parent; -} NMSecretAgent; +}; /** * NMSecretAgentGetSecretsFunc: diff --git a/libnm/nm-types.h b/libnm/nm-types.h new file mode 100644 index 0000000000..940a329454 --- /dev/null +++ b/libnm/nm-types.h @@ -0,0 +1,56 @@ +/* -*- 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 2014 Red Hat, Inc. + */ + +#ifndef __NM_TYPES_H__ +#define __NM_TYPES_H__ + +#include + +#include +#include + +typedef struct _NMAccessPoint NMAccessPoint; +typedef struct _NMActiveConnection NMActiveConnection; +typedef struct _NMClient NMClient; +typedef struct _NMDevice NMDevice; +typedef struct _NMDeviceAdsl NMDeviceAdsl; +typedef struct _NMDeviceBond NMDeviceBond; +typedef struct _NMDeviceBridge NMDeviceBridge; +typedef struct _NMDeviceBt NMDeviceBt; +typedef struct _NMDeviceEthernet NMDeviceEthernet; +typedef struct _NMDeviceGeneric NMDeviceGeneric; +typedef struct _NMDeviceInfiniband NMDeviceInfiniband; +typedef struct _NMDeviceModem NMDeviceModem; +typedef struct _NMDeviceOlpcMesh NMDeviceOlpcMesh; +typedef struct _NMDeviceTeam NMDeviceTeam; +typedef struct _NMDeviceVlan NMDeviceVlan; +typedef struct _NMDeviceWifi NMDeviceWifi; +typedef struct _NMDeviceWimax NMDeviceWimax; +typedef struct _NMDhcp4Config NMDhcp4Config; +typedef struct _NMDhcp6Config NMDhcp6Config; +typedef struct _NMIP4Config NMIP4Config; +typedef struct _NMIP6Config NMIP6Config; +typedef struct _NMObject NMObject; +typedef struct _NMRemoteConnection NMRemoteConnection; +typedef struct _NMSecretAgent NMSecretAgent; +typedef struct _NMVpnConnection NMVpnConnection; +typedef struct _NMWimaxNsp NMWimaxNsp; + +#endif /* NM_TYPES_H */ diff --git a/libnm/nm-vpn-connection.h b/libnm/nm-vpn-connection.h index 86a78d2e0b..349de41ea5 100644 --- a/libnm/nm-vpn-connection.h +++ b/libnm/nm-vpn-connection.h @@ -26,10 +26,8 @@ #error "Only can be included directly." #endif -#include -#include -#include "nm-active-connection.h" -#include "nm-vpn-dbus-interface.h" +#include +#include G_BEGIN_DECLS @@ -43,9 +41,9 @@ G_BEGIN_DECLS #define NM_VPN_CONNECTION_VPN_STATE "vpn-state" #define NM_VPN_CONNECTION_BANNER "banner" -typedef struct { +struct _NMVpnConnection { NMActiveConnection parent; -} NMVpnConnection; +}; typedef struct { NMActiveConnectionClass parent; diff --git a/libnm/nm-wimax-nsp.h b/libnm/nm-wimax-nsp.h index 3cae3fc263..710639e784 100644 --- a/libnm/nm-wimax-nsp.h +++ b/libnm/nm-wimax-nsp.h @@ -26,10 +26,7 @@ #error "Only can be included directly." #endif -#include -#include -#include -#include "nm-object.h" +#include G_BEGIN_DECLS @@ -51,9 +48,9 @@ typedef enum { NM_WIMAX_NSP_NETWORK_TYPE_ROAMING_PARTNER = 3 } NMWimaxNspNetworkType; -typedef struct { +struct _NMWimaxNsp { NMObject parent; -} NMWimaxNsp; +}; typedef struct { NMObjectClass parent; From 677314c540d388bf29257c499fb0ff5f45b29f2b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 9 Oct 2014 09:24:05 -0400 Subject: [PATCH 2/2] libnm: fix NMActiveConnection object-path-valued properties NMActiveConnection:connection was an object path rather than an NMRemoteConnection because in the past the NMObject property system wasn't capable of handling NMRemoteConnection-valued properties. NMActiveConnection:master was an object path rather than an NMDevice entirely by accident. Fix both. NMActiveConnection:specific-object can't currently be converted to an object, because we don't know ahead of time what object type it is, and NMObject can't deal with that. Instead, we rename it to :specific-object-path (and likewise for its get function), both to emphasize that it doesn't behave like other properties, and to leave the old name open for an actual object-valued property later on. --- clients/cli/connections.c | 75 +++++---------- clients/tui/nmt-connect-connection-list.c | 7 +- libnm/libnm.ver | 2 +- libnm/nm-active-connection.c | 110 +++++++++++----------- libnm/nm-active-connection.h | 60 ++++++------ 5 files changed, 115 insertions(+), 139 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index cfaa669b06..22492f371f 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -594,7 +594,7 @@ get_ac_device_string (NMActiveConnection *active) static NMActiveConnection * get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection) { - const char *con_path; + const char *con_path, *ac_con_path; int i; NMActiveConnection *ac = NULL; @@ -602,8 +602,11 @@ get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection) con_path = nm_connection_get_path (connection); for (i = 0; i < active_cons->len; i++) { NMActiveConnection *candidate = g_ptr_array_index (active_cons, i); + NMRemoteConnection *con; - if (!g_strcmp0 (nm_active_connection_get_connection (candidate), con_path)) { + con = nm_active_connection_get_connection (candidate); + ac_con_path = nm_connection_get_path (NM_CONNECTION (con)); + if (!g_strcmp0 (ac_con_path, con_path)) { ac = candidate; break; } @@ -611,24 +614,6 @@ get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection) return ac; } -static NMConnection * -get_connection_for_active (const GSList *con_list, NMActiveConnection *active) -{ - const GSList *iter; - const char *path; - - path = nm_active_connection_get_connection (active); - g_return_val_if_fail (path != NULL, NULL); - - for (iter = con_list; iter; iter = g_slist_next (iter)) { - NMConnection *candidate = NM_CONNECTION (iter->data); - - if (strcmp (nm_connection_get_path (candidate), path) == 0) - return candidate; - } - return NULL; -} - static gboolean nmc_connection_profile_details (NMConnection *connection, NmCli *nmc) { @@ -713,15 +698,15 @@ find_active_connection (const GPtrArray *active_cons, for (i = start; i < active_cons->len; i++) { NMActiveConnection *candidate = g_ptr_array_index (active_cons, i); - path = nm_active_connection_get_connection (candidate); + con = NM_CONNECTION (nm_active_connection_get_connection (candidate)); + id = nm_connection_get_id (con); + + path = nm_connection_get_path (con); a_path = nm_object_get_path (NM_OBJECT (candidate)); uuid = nm_active_connection_get_uuid (candidate); path_num = path ? strrchr (path, '/') + 1 : NULL; a_path_num = a_path ? strrchr (a_path, '/') + 1 : NULL; - con = get_connection_for_active (cons, candidate); - id = nm_connection_get_id (con); - /* When filter_type is NULL, compare connection ID (filter_val) * against all types. Otherwise, only compare against the specific * type. If 'path' or 'apath' filter types are specified, comparison @@ -813,21 +798,25 @@ fill_output_active_connection (NMActiveConnection *active, gboolean with_group, guint32 o_flags) { - GSList *iter; - const char *active_path; + NMConnection *con; NMSettingConnection *s_con; const GPtrArray *devices; GString *dev_str; NMActiveConnectionState state; + NMDevice *master; int i; - GSList *con_list = nmc->connections; NmcOutputField *tmpl, *arr; size_t tmpl_len; int idx_start = with_group ? 0 : 1; - active_path = nm_active_connection_get_connection (active); + con = NM_CONNECTION (nm_active_connection_get_connection (active)); + s_con = nm_connection_get_setting_connection (con); + g_assert (s_con != NULL); + state = nm_active_connection_get_state (active); + master = nm_active_connection_get_master (active); + /* Get devices of the active connection */ dev_str = g_string_new (NULL); devices = nm_active_connection_get_devices (active); @@ -854,35 +843,19 @@ fill_output_active_connection (NMActiveConnection *active, arr = nmc_dup_fields_array (tmpl, tmpl_len, o_flags); if (with_group) set_val_strc (arr, 0, nmc_fields_con_active_details_groups[0].name); - set_val_strc (arr, 1-idx_start, _("N/A")); + set_val_strc (arr, 1-idx_start, nm_setting_connection_get_id (s_con)); set_val_strc (arr, 2-idx_start, nm_active_connection_get_uuid (active)); set_val_str (arr, 3-idx_start, dev_str->str); set_val_strc (arr, 4-idx_start, active_connection_state_to_string (state)); set_val_strc (arr, 5-idx_start, nm_active_connection_get_default (active) ? _("yes") : _("no")); set_val_strc (arr, 6-idx_start, nm_active_connection_get_default6 (active) ? _("yes") : _("no")); - set_val_strc (arr, 7-idx_start, nm_active_connection_get_specific_object (active)); + set_val_strc (arr, 7-idx_start, nm_active_connection_get_specific_object_path (active)); set_val_strc (arr, 8-idx_start, NM_IS_VPN_CONNECTION (active) ? _("yes") : _("no")); set_val_strc (arr, 9-idx_start, nm_object_get_path (NM_OBJECT (active))); - set_val_strc (arr, 10-idx_start, nm_active_connection_get_connection (active)); - set_val_strc (arr, 11-idx_start, _("N/A")); - set_val_strc (arr, 12-idx_start, nm_active_connection_get_master (active)); + set_val_strc (arr, 10-idx_start, nm_connection_get_path (con)); + set_val_strc (arr, 11-idx_start, nm_setting_connection_get_zone (s_con)); + set_val_strc (arr, 12-idx_start, master ? nm_object_get_path (NM_OBJECT (master)) : NULL); - for (iter = con_list; iter; iter = g_slist_next (iter)) { - NMConnection *connection = (NMConnection *) iter->data; - const char *con_path = nm_connection_get_path (connection); - - if (!strcmp (active_path, con_path)) { - /* This connection is active */ - s_con = nm_connection_get_setting_connection (connection); - g_assert (s_con != NULL); - - /* Fill field values that depend on NMConnection */ - set_val_strc (arr, 1-idx_start, nm_setting_connection_get_id (s_con)); - set_val_strc (arr, 11-idx_start, nm_setting_connection_get_zone (s_con)); - - break; - } - } g_ptr_array_add (nmc->output_data, arr); g_string_free (dev_str, FALSE); @@ -1097,7 +1070,7 @@ nmc_active_connection_details (NMActiveConnection *acon, NmCli *nmc) char **vpn_data_array = NULL; guint32 items_num; - con = get_connection_for_active (nmc->connections, acon); + con = NM_CONNECTION (nm_active_connection_get_connection (acon)); s_con = nm_connection_get_setting_connection (con); g_assert (s_con != NULL); @@ -1350,7 +1323,7 @@ do_connections_show (NmCli *nmc, gboolean active_only, int argc, char **argv) if (!con) { acon = find_active_connection (active_cons, nmc->connections, selector, *argv, NULL); if (acon) - con = get_connection_for_active (nmc->connections, acon); + con = NM_CONNECTION (nm_active_connection_get_connection (acon)); } /* Print connection details */ diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c index f4dc0cf98e..4b80a807ed 100644 --- a/clients/tui/nmt-connect-connection-list.c +++ b/clients/tui/nmt-connect-connection-list.c @@ -445,15 +445,14 @@ connection_find_ac (NMConnection *conn, const GPtrArray *acs) { NMActiveConnection *ac; - const char *path, *ac_path; + NMRemoteConnection *ac_conn; int i; - path = nm_connection_get_path (conn); for (i = 0; i < acs->len; i++) { ac = acs->pdata[i]; - ac_path = nm_active_connection_get_connection (ac); + ac_conn = nm_active_connection_get_connection (ac); - if (!g_strcmp0 (path, ac_path)) + if (conn == NM_CONNECTION (ac_conn)) return ac; } diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 437cebf936..bcb3a97381 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -26,7 +26,7 @@ global: nm_active_connection_get_ip4_config; nm_active_connection_get_ip6_config; nm_active_connection_get_master; - nm_active_connection_get_specific_object; + nm_active_connection_get_specific_object_path; nm_active_connection_get_state; nm_active_connection_get_type; nm_active_connection_get_uuid; diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index 80ab449355..ae36bf78ee 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -35,6 +35,7 @@ #include "nm-dhcp6-config.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" +#include "nm-remote-connection.h" static GType _nm_active_connection_decide_type (GVariant *value); @@ -48,11 +49,11 @@ G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJEC #define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate)) typedef struct { - char *connection; + NMRemoteConnection *connection; char *id; char *uuid; char *type; - char *specific_object; + char *specific_object_path; GPtrArray *devices; NMActiveConnectionState state; gboolean is_default; @@ -62,7 +63,7 @@ typedef struct { NMIP6Config *ip6_config; NMDhcp6Config *dhcp6_config; gboolean is_vpn; - char *master; + NMDevice *master; } NMActiveConnectionPrivate; enum { @@ -71,7 +72,7 @@ enum { PROP_ID, PROP_UUID, PROP_TYPE, - PROP_SPECIFIC_OBJECT, + PROP_SPECIFIC_OBJECT_PATH, PROP_DEVICES, PROP_STATE, PROP_DEFAULT, @@ -100,15 +101,12 @@ _nm_active_connection_decide_type (GVariant *value) * nm_active_connection_get_connection: * @connection: a #NMActiveConnection * - * Gets the #NMConnection's DBus object path. This is often used with - * nm_remote_settings_get_connection_by_path() to retrieve the - * #NMRemoteConnection object that describes the connection. + * Gets the #NMRemoteConnection associated with @connection. * - * Returns: the object path of the #NMConnection which this #NMActiveConnection - * is an active instance of. This is the internal string used by the - * connection, and must not be modified. + * Returns: (transfer none): the #NMRemoteConnection which this + * #NMActiveConnection is an active instance of. **/ -const char * +NMRemoteConnection * nm_active_connection_get_connection (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); @@ -168,20 +166,26 @@ nm_active_connection_get_connection_type (NMActiveConnection *connection) } /** - * nm_active_connection_get_specific_object: + * nm_active_connection_get_specific_object_path: * @connection: a #NMActiveConnection * - * Gets the "specific object" used at the activation. + * Gets the path of the "specific object" used at activation. * - * Returns: the specific object's DBus path. This is the internal string used by the - * connection, and must not be modified. + * Currently there is no single method that will allow you to automatically turn + * this into an appropriate #NMObject; you need to know what kind of object it + * is based on other information. (Eg, if @connection corresponds to a Wi-Fi + * connection, then the specific object will be an #NMAccessPoint, and you can + * resolve it with nm_device_wifi_get_access_point_by_path().) + * + * Returns: the specific object's D-Bus path. This is the internal string used + * by the connection, and must not be modified. **/ const char * -nm_active_connection_get_specific_object (NMActiveConnection *connection) +nm_active_connection_get_specific_object_path (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->specific_object; + return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->specific_object_path; } /** @@ -345,12 +349,11 @@ nm_active_connection_get_vpn (NMActiveConnection *connection) * nm_active_connection_get_master: * @connection: a #NMActiveConnection * - * Gets the path to the master #NMDevice of the connection. + * Gets the master #NMDevice of the connection. * - * Returns: the path of the master #NMDevice of the #NMActiveConnection. - * This is the internal string used by the connection, and must not be modified. + * Returns: (transfer none): the master #NMDevice of the #NMActiveConnection. **/ -const char * +NMDevice * nm_active_connection_get_master (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); @@ -370,6 +373,8 @@ dispose (GObject *object) g_clear_pointer (&priv->devices, g_ptr_array_unref); + g_clear_object (&priv->connection); + g_clear_object (&priv->master); g_clear_object (&priv->ip4_config); g_clear_object (&priv->dhcp4_config); g_clear_object (&priv->ip6_config); @@ -383,12 +388,10 @@ finalize (GObject *object) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); - g_free (priv->connection); g_free (priv->id); g_free (priv->uuid); g_free (priv->type); - g_free (priv->specific_object); - g_free (priv->master); + g_free (priv->specific_object_path); G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object); } @@ -403,7 +406,7 @@ get_property (GObject *object, switch (prop_id) { case PROP_CONNECTION: - g_value_set_string (value, nm_active_connection_get_connection (self)); + g_value_set_object (value, nm_active_connection_get_connection (self)); break; case PROP_ID: g_value_set_string (value, nm_active_connection_get_id (self)); @@ -414,8 +417,8 @@ get_property (GObject *object, case PROP_TYPE: g_value_set_string (value, nm_active_connection_get_connection_type (self)); break; - case PROP_SPECIFIC_OBJECT: - g_value_set_boxed (value, nm_active_connection_get_specific_object (self)); + case PROP_SPECIFIC_OBJECT_PATH: + g_value_set_string (value, nm_active_connection_get_specific_object_path (self)); break; case PROP_DEVICES: g_value_take_boxed (value, _nm_utils_copy_object_array (nm_active_connection_get_devices (self))); @@ -445,7 +448,7 @@ get_property (GObject *object, g_value_set_boolean (value, nm_active_connection_get_vpn (self)); break; case PROP_MASTER: - g_value_set_string (value, nm_active_connection_get_master (self)); + g_value_set_object (value, nm_active_connection_get_master (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -458,21 +461,21 @@ init_dbus (NMObject *object) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { - { NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection }, - { NM_ACTIVE_CONNECTION_ID, &priv->id }, - { NM_ACTIVE_CONNECTION_UUID, &priv->uuid }, - { NM_ACTIVE_CONNECTION_TYPE, &priv->type }, - { NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, &priv->specific_object }, - { NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE }, - { NM_ACTIVE_CONNECTION_STATE, &priv->state }, - { NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default }, - { NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG }, - { NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG }, - { NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 }, - { NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG }, - { NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG }, - { NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn }, - { NM_ACTIVE_CONNECTION_MASTER, &priv->master }, + { NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection, NULL, NM_TYPE_REMOTE_CONNECTION }, + { NM_ACTIVE_CONNECTION_ID, &priv->id }, + { NM_ACTIVE_CONNECTION_UUID, &priv->uuid }, + { NM_ACTIVE_CONNECTION_TYPE, &priv->type }, + { NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, &priv->specific_object_path }, + { NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE }, + { NM_ACTIVE_CONNECTION_STATE, &priv->state }, + { NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default }, + { NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG }, + { NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG }, + { NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 }, + { NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG }, + { NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG }, + { NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn }, + { NM_ACTIVE_CONNECTION_MASTER, &priv->master, NULL, NM_TYPE_DEVICE }, { NULL }, }; @@ -507,12 +510,12 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) /** * NMActiveConnection:connection: * - * The connection's path of the active connection. + * The connection that this is an active instance of. **/ g_object_class_install_property (object_class, PROP_CONNECTION, - g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "", - NULL, + g_param_spec_object (NM_ACTIVE_CONNECTION_CONNECTION, "", "", + NM_TYPE_REMOTE_CONNECTION, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -553,13 +556,14 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) G_PARAM_STATIC_STRINGS)); /** - * NMActiveConnection:specific-object: + * NMActiveConnection:specific-object-path: * - * The specific object's path of the active connection. + * The path to the "specific object" of the active connection; see + * nm_active_connection_get_specific_object_path() for more details. **/ g_object_class_install_property - (object_class, PROP_SPECIFIC_OBJECT, - g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "", + (object_class, PROP_SPECIFIC_OBJECT_PATH, + g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, "", "", NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -678,12 +682,12 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) /** * NMActiveConnection:master: * - * The path of the master device if one exists. + * The master device if one exists. **/ g_object_class_install_property (object_class, PROP_MASTER, - g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "", - NULL, + g_param_spec_object (NM_ACTIVE_CONNECTION_MASTER, "", "", + NM_TYPE_DEVICE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } diff --git a/libnm/nm-active-connection.h b/libnm/nm-active-connection.h index 2b0d6821c1..ef8dd1980b 100644 --- a/libnm/nm-active-connection.h +++ b/libnm/nm-active-connection.h @@ -37,21 +37,21 @@ G_BEGIN_DECLS #define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACTIVE_CONNECTION)) #define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass)) -#define NM_ACTIVE_CONNECTION_CONNECTION "connection" -#define NM_ACTIVE_CONNECTION_ID "id" -#define NM_ACTIVE_CONNECTION_UUID "uuid" -#define NM_ACTIVE_CONNECTION_TYPE "type" -#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object" -#define NM_ACTIVE_CONNECTION_DEVICES "devices" -#define NM_ACTIVE_CONNECTION_STATE "state" -#define NM_ACTIVE_CONNECTION_DEFAULT "default" -#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config" -#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config" -#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6" -#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config" -#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config" -#define NM_ACTIVE_CONNECTION_VPN "vpn" -#define NM_ACTIVE_CONNECTION_MASTER "master" +#define NM_ACTIVE_CONNECTION_CONNECTION "connection" +#define NM_ACTIVE_CONNECTION_ID "id" +#define NM_ACTIVE_CONNECTION_UUID "uuid" +#define NM_ACTIVE_CONNECTION_TYPE "type" +#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH "specific-object-path" +#define NM_ACTIVE_CONNECTION_DEVICES "devices" +#define NM_ACTIVE_CONNECTION_STATE "state" +#define NM_ACTIVE_CONNECTION_DEFAULT "default" +#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config" +#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config" +#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6" +#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config" +#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config" +#define NM_ACTIVE_CONNECTION_VPN "vpn" +#define NM_ACTIVE_CONNECTION_MASTER "master" struct _NMActiveConnection { NMObject parent; @@ -66,21 +66,21 @@ typedef struct { GType nm_active_connection_get_type (void); -const char * nm_active_connection_get_connection (NMActiveConnection *connection); -const char * nm_active_connection_get_id (NMActiveConnection *connection); -const char * nm_active_connection_get_uuid (NMActiveConnection *connection); -const char * nm_active_connection_get_connection_type (NMActiveConnection *connection); -const char * nm_active_connection_get_specific_object (NMActiveConnection *connection); -const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection); -NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection); -const char * nm_active_connection_get_master (NMActiveConnection *connection); -gboolean nm_active_connection_get_default (NMActiveConnection *connection); -NMIP4Config * nm_active_connection_get_ip4_config (NMActiveConnection *connection); -NMDhcp4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection); -gboolean nm_active_connection_get_default6 (NMActiveConnection *connection); -NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection); -NMDhcp6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection); -gboolean nm_active_connection_get_vpn (NMActiveConnection *connection); +NMRemoteConnection *nm_active_connection_get_connection (NMActiveConnection *connection); +const char *nm_active_connection_get_id (NMActiveConnection *connection); +const char *nm_active_connection_get_uuid (NMActiveConnection *connection); +const char *nm_active_connection_get_connection_type (NMActiveConnection *connection); +const char *nm_active_connection_get_specific_object_path (NMActiveConnection *connection); +const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection); +NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection); +NMDevice *nm_active_connection_get_master (NMActiveConnection *connection); +gboolean nm_active_connection_get_default (NMActiveConnection *connection); +NMIP4Config *nm_active_connection_get_ip4_config (NMActiveConnection *connection); +NMDhcp4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection); +gboolean nm_active_connection_get_default6 (NMActiveConnection *connection); +NMIP6Config *nm_active_connection_get_ip6_config (NMActiveConnection *connection); +NMDhcp6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection); +gboolean nm_active_connection_get_vpn (NMActiveConnection *connection); G_END_DECLS