summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2013-02-20 23:06:45 +0100
committerMichael Biebl <biebl@debian.org>2013-02-20 23:06:45 +0100
commit8d275584fc94f398f0a7c990dcd057533d9a5856 (patch)
tree1bf4a928e201222a008e6776799d174ee3223be3 /libnm-glib
parente17c5736fc3722ce51cb33f3edb203960125a4c1 (diff)
Imported Upstream version 0.9.8.0upstream/0.9.8.0
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/Makefile.am4
-rw-r--r--libnm-glib/Makefile.in14
-rw-r--r--libnm-glib/libnm-glib.ver1
-rw-r--r--libnm-glib/nm-client.c4
-rw-r--r--libnm-glib/nm-device-bond.c2
-rw-r--r--libnm-glib/nm-device-bridge.c16
-rw-r--r--libnm-glib/nm-device-bridge.h2
-rw-r--r--libnm-glib/nm-device-wifi.c1
-rw-r--r--libnm-glib/nm-device.c54
-rw-r--r--libnm-glib/nm-device.h2
-rw-r--r--libnm-glib/nm-remote-connection.c76
-rw-r--r--libnm-glib/nm-wimax-nsp.c2
12 files changed, 161 insertions, 17 deletions
diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am
index 372f0311e..b8eee4720 100644
--- a/libnm-glib/Makefile.am
+++ b/libnm-glib/Makefile.am
@@ -148,7 +148,7 @@ libnm_glib_la_LIBADD = \
SYMBOL_VIS_FILE=$(srcdir)/libnm-glib.ver
libnm_glib_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \
- -version-info "8:0:4"
+ -version-info "9:0:5"
noinst_PROGRAMS = libnm-glib-test
@@ -182,7 +182,7 @@ libnm_glib_test_la_CFLAGS = \
-DLIBNM_GLIB_TEST
libnm_glib_test_la_SOURCES = \
- $(libnminclude_HEADERS) \
+ $(li0bnminclude_HEADERS) \
$(libnm_glib_la_SOURCES)
libnm_glib_test_la_LIBADD = \
diff --git a/libnm-glib/Makefile.in b/libnm-glib/Makefile.in
index 12e33dda4..df3e843bf 100644
--- a/libnm-glib/Makefile.in
+++ b/libnm-glib/Makefile.in
@@ -126,8 +126,7 @@ am__v_lt_0 = --silent
libnm_glib_test_la_DEPENDENCIES = \
$(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__objects_1 =
-am__objects_2 = libnm_glib_test_la-nm-object.lo \
+am__objects_1 = libnm_glib_test_la-nm-object.lo \
libnm_glib_test_la-nm-client.lo \
libnm_glib_test_la-nm-device.lo \
libnm_glib_test_la-nm-device-ethernet.lo \
@@ -156,8 +155,9 @@ am__objects_2 = libnm_glib_test_la-nm-object.lo \
libnm_glib_test_la-nm-wimax-nsp.lo \
libnm_glib_test_la-nm-glib-enum-types.lo \
libnm_glib_test_la-nm-glib-marshal.lo
-am__objects_3 = $(am__objects_2) $(am__objects_1)
-am_libnm_glib_test_la_OBJECTS = $(am__objects_1) $(am__objects_3)
+am__objects_2 =
+am__objects_3 = $(am__objects_1) $(am__objects_2)
+am_libnm_glib_test_la_OBJECTS = $(am__objects_3)
libnm_glib_test_la_OBJECTS = $(am_libnm_glib_test_la_OBJECTS)
libnm_glib_test_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
@@ -202,7 +202,7 @@ am__objects_4 = libnm_glib_la-nm-object.lo libnm_glib_la-nm-client.lo \
libnm_glib_la-nm-device-wimax.lo libnm_glib_la-nm-wimax-nsp.lo \
libnm_glib_la-nm-glib-enum-types.lo \
libnm_glib_la-nm-glib-marshal.lo
-am_libnm_glib_la_OBJECTS = $(am__objects_4) $(am__objects_1)
+am_libnm_glib_la_OBJECTS = $(am__objects_4) $(am__objects_2)
libnm_glib_la_OBJECTS = $(am_libnm_glib_la_OBJECTS)
libnm_glib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libnm_glib_la_CFLAGS) \
@@ -675,7 +675,7 @@ libnm_glib_la_LIBADD = \
SYMBOL_VIS_FILE = $(srcdir)/libnm-glib.ver
libnm_glib_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \
- -version-info "8:0:4"
+ -version-info "9:0:5"
libnm_glib_test_SOURCES = libnm-glib-test.c
libnm_glib_test_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS)
@@ -703,7 +703,7 @@ libnm_glib_test_la_CFLAGS = \
-DLIBNM_GLIB_TEST
libnm_glib_test_la_SOURCES = \
- $(libnminclude_HEADERS) \
+ $(li0bnminclude_HEADERS) \
$(libnm_glib_la_SOURCES)
libnm_glib_test_la_LIBADD = \
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 9fb956afc..571bc7d25 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -100,6 +100,7 @@ global:
nm_device_filter_connections;
nm_device_get_active_connection;
nm_device_get_autoconnect;
+ nm_device_get_available_connections;
nm_device_get_capabilities;
nm_device_get_device_type;
nm_device_get_dhcp4_config;
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 62e5f835a..3ffa7b9ee 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -1056,6 +1056,8 @@ nm_client_get_permission_result (NMClient *client, NMClientPermission permission
* Gets NetworkManager current logging level and domains.
*
* Returns: %TRUE on success, %FALSE otherwise
+ *
+ * Since: 0.9.8
**/
gboolean
nm_client_get_logging (NMClient *client, char **level, char **domains, GError **error)
@@ -1095,6 +1097,8 @@ nm_client_get_logging (NMClient *client, char **level, char **domains, GError **
* Sets NetworkManager logging level and/or domains.
*
* Returns: %TRUE on success, %FALSE otherwise
+ *
+ * Since: 0.9.8
**/
gboolean
nm_client_set_logging (NMClient *client, const char *level, const char *domains, GError **error)
diff --git a/libnm-glib/nm-device-bond.c b/libnm-glib/nm-device-bond.c
index 1d163c5e4..6261db912 100644
--- a/libnm-glib/nm-device-bond.c
+++ b/libnm-glib/nm-device-bond.c
@@ -337,6 +337,8 @@ nm_device_bond_class_init (NMDeviceBondClass *eth_class)
* NMDeviceBond:slaves:
*
* The devices (#NMDevice) slaved to the bond device.
+ *
+ * Since: 0.9.8
**/
g_object_class_install_property
(object_class, PROP_SLAVES,
diff --git a/libnm-glib/nm-device-bridge.c b/libnm-glib/nm-device-bridge.c
index 34e02d6d9..9327a9319 100644
--- a/libnm-glib/nm-device-bridge.c
+++ b/libnm-glib/nm-device-bridge.c
@@ -66,6 +66,8 @@ enum {
* Registers an error quark for #NMDeviceBridge if necessary.
*
* Returns: the error quark used for #NMDeviceBridge errors.
+ *
+ * Since: 0.9.8
**/
GQuark
nm_device_bridge_error_quark (void)
@@ -85,6 +87,8 @@ nm_device_bridge_error_quark (void)
* Creates a new #NMDeviceBridge.
*
* Returns: (transfer full): a new device
+ *
+ * Since: 0.9.8
**/
GObject *
nm_device_bridge_new (DBusGConnection *connection, const char *path)
@@ -110,6 +114,8 @@ nm_device_bridge_new (DBusGConnection *connection, const char *path)
*
* Returns: the hardware address. This is the internal string used by the
* device, and must not be modified.
+ *
+ * Since: 0.9.8
**/
const char *
nm_device_bridge_get_hw_address (NMDeviceBridge *device)
@@ -127,6 +133,8 @@ nm_device_bridge_get_hw_address (NMDeviceBridge *device)
* Whether the device has carrier.
*
* Returns: %TRUE if the device has carrier
+ *
+ * Since: 0.9.8
**/
gboolean
nm_device_bridge_get_carrier (NMDeviceBridge *device)
@@ -146,6 +154,8 @@ nm_device_bridge_get_carrier (NMDeviceBridge *device)
* Returns: (element-type NMClient.Device): the #GPtrArray containing
* #NMDevice<!-- -->s that are slaves of @device. This is the internal
* copy used by the device, and must not be modified.
+ *
+ * Since: 0.9.8
**/
const GPtrArray *
nm_device_bridge_get_slaves (NMDeviceBridge *device)
@@ -309,6 +319,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
* NMDeviceBridge:hw-address:
*
* The hardware (MAC) address of the device.
+ *
+ * Since: 0.9.8
**/
g_object_class_install_property
(object_class, PROP_HW_ADDRESS,
@@ -322,6 +334,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
* NMDeviceBridge:carrier:
*
* Whether the device has carrier.
+ *
+ * Since: 0.9.8
**/
g_object_class_install_property
(object_class, PROP_CARRIER,
@@ -335,6 +349,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
* NMDeviceBridge:slaves:
*
* The devices (#NMDevice) slaved to the bridge device.
+ *
+ * Since: 0.9.8
**/
g_object_class_install_property
(object_class, PROP_SLAVES,
diff --git a/libnm-glib/nm-device-bridge.h b/libnm-glib/nm-device-bridge.h
index 3462063d2..67e08df71 100644
--- a/libnm-glib/nm-device-bridge.h
+++ b/libnm-glib/nm-device-bridge.h
@@ -40,6 +40,8 @@ G_BEGIN_DECLS
* @NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION: the connection was not of bridge type
* @NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION: the bridge connection was invalid
* @NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
+ *
+ * Since: 0.9.8
*/
typedef enum {
NM_DEVICE_BRIDGE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c
index e61554dfc..47594a50d 100644
--- a/libnm-glib/nm-device-wifi.c
+++ b/libnm-glib/nm-device-wifi.c
@@ -356,6 +356,7 @@ request_scan_cb (DBusGProxy *proxy,
* instructs NM to perform scanning. Use nm_device_wifi_get_access_points()
* to get available access points.
*
+ * Since: 0.9.8
**/
void
nm_device_wifi_request_scan_simple (NMDeviceWifi *device,
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 22e2844cf..5f492e2ca 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -41,6 +41,8 @@
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
+#include "nm-remote-connection.h"
+#include "nm-types.h"
#include "nm-glib-marshal.h"
#include "nm-dbus-glib-types.h"
#include "nm-glib-compat.h"
@@ -84,6 +86,7 @@ typedef struct {
NMDeviceStateReason reason;
NMActiveConnection *active_connection;
+ GPtrArray *available_connections;
GUdevClient *client;
char *product;
@@ -112,6 +115,7 @@ enum {
PROP_IP_INTERFACE,
PROP_DEVICE_TYPE,
PROP_ACTIVE_CONNECTION,
+ PROP_AVAILABLE_CONNECTIONS,
LAST_PROP
};
@@ -173,6 +177,7 @@ register_properties (NMDevice *device)
{ NM_DEVICE_STATE, &priv->state },
{ NM_DEVICE_STATE_REASON, &priv->state, demarshal_state_reason },
{ NM_DEVICE_ACTIVE_CONNECTION, &priv->active_connection, NULL, NM_TYPE_ACTIVE_CONNECTION },
+ { NM_DEVICE_AVAILABLE_CONNECTIONS, &priv->available_connections, NULL, NM_TYPE_REMOTE_CONNECTION },
/* Properties that exist in D-Bus but that we don't track */
{ "ip4-address", NULL },
@@ -332,6 +337,15 @@ dispose (GObject *object)
g_clear_object (&priv->client);
g_clear_object (&priv->active_connection);
+ if (priv->available_connections) {
+ int i;
+
+ for (i = 0; i < priv->available_connections->len; i++)
+ g_object_unref (priv->available_connections->pdata[i]);
+ g_ptr_array_free (priv->available_connections, TRUE);
+ priv->available_connections = NULL;
+ }
+
G_OBJECT_CLASS (nm_device_parent_class)->dispose (object);
}
@@ -423,6 +437,9 @@ get_property (GObject *object,
case PROP_ACTIVE_CONNECTION:
g_value_set_object (value, nm_device_get_active_connection (device));
break;
+ case PROP_AVAILABLE_CONNECTIONS:
+ g_value_set_boxed (value, nm_device_get_available_connections (device));
+ break;
case PROP_PRODUCT:
g_value_set_string (value, nm_device_get_product (device));
break;
@@ -718,6 +735,21 @@ nm_device_class_init (NMDeviceClass *device_class)
G_PARAM_READABLE));
/**
+ * NMDevice:available-connections:
+ *
+ * The available connections (#NMRemoteConnection) of the device
+ *
+ * Since: 0.9.8
+ **/
+ g_object_class_install_property
+ (object_class, PROP_AVAILABLE_CONNECTIONS,
+ g_param_spec_boxed (NM_DEVICE_AVAILABLE_CONNECTIONS,
+ "AvailableConnections",
+ "Available Connections",
+ NM_TYPE_OBJECT_ARRAY,
+ G_PARAM_READABLE));
+
+ /**
* NMDevice:vendor:
*
* The vendor string of the device.
@@ -1256,6 +1288,28 @@ nm_device_get_active_connection (NMDevice *device)
return NM_DEVICE_GET_PRIVATE (device)->active_connection;
}
+/**
+ * nm_device_get_available_connections:
+ * @device: a #NMDevice
+ *
+ * Gets the #NMRemoteConnections currently known to the daemon that could
+ * be activated on @device.
+ *
+ * Returns: (element-type NMClient.RemoteConnection): the #GPtrArray
+ * containing #NMRemoteConnections. This is the internal copy used by
+ * the connection, and must not be modified.
+ *
+ * Since: 0.9.8
+ **/
+const GPtrArray *
+nm_device_get_available_connections (NMDevice *device)
+{
+ g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (device));
+ return handle_ptr_array_return (NM_DEVICE_GET_PRIVATE (device)->available_connections);
+}
+
/* From hostap, Copyright (c) 2002-2005, Jouni Malinen <jkmaline@cc.hut.fi> */
static int hex2num (char c)
diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h
index 1726862fd..c49675bcc 100644
--- a/libnm-glib/nm-device.h
+++ b/libnm-glib/nm-device.h
@@ -63,6 +63,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_STATE "state"
#define NM_DEVICE_STATE_REASON "state-reason"
#define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
+#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
#define NM_DEVICE_VENDOR "vendor"
#define NM_DEVICE_PRODUCT "product"
@@ -115,6 +116,7 @@ NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
NMDeviceState nm_device_get_state (NMDevice *device);
NMDeviceState nm_device_get_state_reason (NMDevice *device, NMDeviceStateReason *reason);
NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
+const GPtrArray * nm_device_get_available_connections(NMDevice *device);
const char * nm_device_get_product (NMDevice *device);
const char * nm_device_get_vendor (NMDevice *device);
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 64df586e7..ebb6a7b64 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -33,6 +33,8 @@
#include "nm-glib-compat.h"
#define NM_REMOTE_CONNECTION_BUS "bus"
+#define NM_REMOTE_CONNECTION_DBUS_CONNECTION "dbus-connection"
+#define NM_REMOTE_CONNECTION_DBUS_PATH "dbus-path"
static void nm_remote_connection_initable_iface_init (GInitableIface *iface);
static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface);
@@ -45,6 +47,8 @@ G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_CONNE
enum {
PROP_0,
PROP_BUS,
+ PROP_DBUS_CONNECTION,
+ PROP_DBUS_PATH,
LAST_PROP
};
@@ -385,9 +389,8 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
GHashTable *settings;
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
- G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS,
G_TYPE_INVALID,
- DBUS_TYPE_G_MAP_OF_VARIANT, &settings,
+ DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
G_TYPE_INVALID))
return FALSE;
@@ -464,6 +467,43 @@ nm_remote_connection_init (NMRemoteConnection *self)
{
}
+static GObject *
+constructor (GType type, guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ static GParamSpec *nm_connection_path = NULL;
+ static GParamSpec *nm_remote_connection_dbus_path = NULL;
+ int i, path_index = -1, dbus_path_index = -1;
+
+ if (!nm_connection_path) {
+ nm_connection_path =
+ g_object_class_find_property (g_type_class_peek (NM_TYPE_CONNECTION),
+ NM_CONNECTION_PATH);
+ nm_remote_connection_dbus_path =
+ g_object_class_find_property (g_type_class_peek (NM_TYPE_REMOTE_CONNECTION),
+ NM_REMOTE_CONNECTION_DBUS_PATH);
+ }
+
+ /* Find the two properties */
+ for (i = 0; i < n_construct_properties; i++) {
+ if (construct_properties[i].pspec == nm_connection_path)
+ path_index = i;
+ else if (construct_properties[i].pspec == nm_remote_connection_dbus_path)
+ dbus_path_index = i;
+ }
+ g_assert (path_index != -1 && dbus_path_index != -1);
+
+ /* If NMRemoteConnection:dbus-path is set, and NMConnection:path
+ * is not, then copy the value of the former to the latter.
+ */
+ if (g_value_get_string (construct_properties[dbus_path_index].value) &&
+ !g_value_get_string (construct_properties[path_index].value))
+ construct_properties[path_index].value = construct_properties[dbus_path_index].value;
+
+ return G_OBJECT_CLASS (nm_remote_connection_parent_class)->
+ constructor (type, n_construct_properties, construct_properties);
+}
+
static void
set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
@@ -472,8 +512,13 @@ set_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_BUS:
+ case PROP_DBUS_CONNECTION:
/* Construct only */
- priv->bus = dbus_g_connection_ref ((DBusGConnection *) g_value_get_boxed (value));
+ if (g_value_get_boxed (value))
+ priv->bus = dbus_g_connection_ref ((DBusGConnection *) g_value_get_boxed (value));
+ break;
+ case PROP_DBUS_PATH:
+ /* Don't need to do anything; see constructor(). */
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -508,6 +553,7 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate));
/* virtual methods */
+ object_class->constructor = constructor;
object_class->set_property = set_property;
object_class->dispose = dispose;
object_class->constructed = constructed;
@@ -516,10 +562,26 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
g_object_class_install_property
(object_class, PROP_BUS,
g_param_spec_boxed (NM_REMOTE_CONNECTION_BUS,
- "DBusGConnection",
- "DBusGConnection",
- DBUS_TYPE_G_CONNECTION,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ "DBusGConnection",
+ "DBusGConnection",
+ DBUS_TYPE_G_CONNECTION,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ /* These are needed so _nm_object_create() can create NMRemoteConnections */
+ g_object_class_install_property
+ (object_class, PROP_DBUS_CONNECTION,
+ g_param_spec_boxed (NM_REMOTE_CONNECTION_DBUS_CONNECTION,
+ "DBusGConnection",
+ "DBusGConnection",
+ DBUS_TYPE_G_CONNECTION,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property
+ (object_class, PROP_DBUS_PATH,
+ g_param_spec_string (NM_REMOTE_CONNECTION_DBUS_PATH,
+ "Object Path",
+ "DBus Object Path",
+ NULL,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
/* Signals */
/**
diff --git a/libnm-glib/nm-wimax-nsp.c b/libnm-glib/nm-wimax-nsp.c
index ce1048be7..baa4b3e16 100644
--- a/libnm-glib/nm-wimax-nsp.c
+++ b/libnm-glib/nm-wimax-nsp.c
@@ -132,7 +132,7 @@ nm_wimax_nsp_get_network_type (NMWimaxNsp *nsp)
}
/**
- * nm_wimax_nsp_filter_connections:
+ * nm_wimax_nsp_connection_valid:
* @nsp: an #NMWimaxNsp to validate @connection against
* @connection: an #NMConnection to validate against @nsp
*