示例#1
0
/**
 * nm_ip4_config_get_routes:
 * @config: a #NMIP4Config
 *
 * Gets the routes.
 *
 * Returns: (element-type NetworkManager.IP4Route): the #GSList containing
 * #NMIP4Route<!-- -->s. This is the internal copy used by the configuration,
 * and must not be modified.
 **/
const GSList *
nm_ip4_config_get_routes (NMIP4Config *config)
{
	NMIP4ConfigPrivate *priv;
	GValue value = { 0, };

	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);

	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
	if (priv->routes)
		return priv->routes;

	if (!_nm_object_get_property (NM_OBJECT (config),
	                              NM_DBUS_INTERFACE_IP4_CONFIG,
	                              "Routes",
	                              &value,
	                              NULL)) {
		return NULL;
	}

	demarshal_ip4_routes_array (NM_OBJECT (config), NULL, &value, &priv->routes);
	g_value_unset (&value);

	return priv->routes;
}
示例#2
0
/**
 * nm_ip4_config_get_wins_servers:
 * @config: a #NMIP4Config
 *
 * Gets the Windows Internet Name Service servers (WINS).
 *
 * Returns: (element-type guint32): the #GArray containing %guint32<!-- -->s.
 * This is the internal copy used by the configuration and must not be modified.
 **/
const GArray *
nm_ip4_config_get_wins_servers (NMIP4Config *config)
{
	NMIP4ConfigPrivate *priv;
	GArray *array = NULL;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);

	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
	if (!priv->wins) {
		if (_nm_object_get_property (NM_OBJECT (config),
		                             NM_DBUS_INTERFACE_IP4_CONFIG,
		                             "WinsServers",
		                             &value,
		                             NULL)) {
			array = (GArray *) g_value_get_boxed (&value);
			if (array && array->len) {
				priv->wins = g_array_sized_new (FALSE, TRUE, sizeof (guint32), array->len);
				g_array_append_vals (priv->wins, array->data, array->len);
			}
			g_value_unset (&value);
		}
	}

	return priv->wins;
}
示例#3
0
/**
 * nm_ip4_config_get_domains:
 * @config: a #NMIP4Config
 *
 * Gets the domain names.
 *
 * Returns: (element-type utf8): the #GPtrArray containing domains as strings. This is the 
 * internal copy used by the configuration, and must not be modified.
 **/
const GPtrArray *
nm_ip4_config_get_domains (NMIP4Config *config)
{
	NMIP4ConfigPrivate *priv;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);

	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
	if (priv->domains)
		return handle_ptr_array_return (priv->domains);

	if (_nm_object_get_property (NM_OBJECT (config),
	                             NM_DBUS_INTERFACE_IP4_CONFIG,
	                             "Domains",
	                             &value,
	                             NULL)) {
		char **array = NULL, **p;

		array = (char **) g_value_get_boxed (&value);
		if (array && g_strv_length (array)) {
			priv->domains = g_ptr_array_sized_new (g_strv_length (array));
			for (p = array; *p; p++)
				g_ptr_array_add (priv->domains, g_strdup (*p));
		}
		g_value_unset (&value);
	}

	return handle_ptr_array_return (priv->domains);
}
示例#4
0
/**
 * nm_ip6_config_get_domains:
 * @config: a #NMIP6Config
 *
 * Gets the domain names.
 *
 * Returns: (element-type utf8): the #GPtrArray containing domains as strings.
 * This is the internal copy used by the configuration, and must not be modified.
 **/
const GPtrArray *
nm_ip6_config_get_domains (NMIP6Config *config)
{
	NMIP6ConfigPrivate *priv;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);

	priv = NM_IP6_CONFIG_GET_PRIVATE (config);
	if (priv->domains)
		return handle_ptr_array_return (priv->domains);

	if (!_nm_object_get_property (NM_OBJECT (config),
	                              NM_DBUS_INTERFACE_IP6_CONFIG,
	                              "Domains",
	                              &value,
	                              NULL)) {
		return NULL;
	}

	demarshal_domains (NM_OBJECT (config), NULL, &value, &priv->domains);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->domains);
}
示例#5
0
/**
 * nm_ip6_config_get_nameservers: (skip)
 * @config: a #NMIP6Config
 *
 * Gets the domain name servers (DNS).
 *
 * Returns: (element-type Posix.in6_addr): a #GSList containing elements of type
 * 'struct in6_addr' which contain the addresses of nameservers of the configuration.
 * This is the internal copy used by the configuration and must not be modified.
 **/
const GSList *
nm_ip6_config_get_nameservers (NMIP6Config *config)
{
	NMIP6ConfigPrivate *priv;
	GParamSpec *pspec;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);

	priv = NM_IP6_CONFIG_GET_PRIVATE (config);
	if (priv->nameservers)
		return priv->nameservers;

	if (!_nm_object_get_property (NM_OBJECT (config),
	                              NM_DBUS_INTERFACE_IP6_CONFIG,
	                              "Nameservers",
	                              &value,
	                              NULL)) {
		return NULL;
	}

	pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (config)), NM_IP6_CONFIG_NAMESERVERS);
	demarshal_ip6_nameserver_array (NM_OBJECT (config), pspec, &value, &priv->nameservers);
	g_value_unset (&value);

	return priv->nameservers;
}
/**
 * nm_dhcp6_config_get_options:
 * @config: a #NMDHCP6Config
 *
 * Gets all the options contained in the configuration.
 *
 * Returns: the #GHashTable containing strings for keys and values.
 * This is the internal copy used by the configuration, and must not be modified.
 **/
GHashTable *
nm_dhcp6_config_get_options (NMDHCP6Config *config)
{
	NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (config);
	GValue value = { 0, };

	if (g_hash_table_size (priv->options))
		return priv->options;

	if (!_nm_object_get_property (NM_OBJECT (config),
	                              NM_DBUS_INTERFACE_DHCP6_CONFIG,
	                              "Options",
	                              &value))
		goto out;

	demarshal_dhcp6_options (NM_OBJECT (config), NULL, &value, &priv->options);	
	g_value_unset (&value);

out:
	return priv->options;
}
/**
 * nm_active_connection_get_devices:
 * @connection: a #NMActiveConnection
 *
 * Gets the #NMDevice<!-- -->s used for the active connections.
 *
 * Returns: the #GPtrArray containing #NMDevice<!-- -->s.
 * This is the internal copy used by the connection, and must not be modified.
 **/
const GPtrArray *
nm_active_connection_get_devices (NMActiveConnection *connection)
{
	NMActiveConnectionPrivate *priv;
	GValue value = { 0, };

	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);

	priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
	if (priv->devices)
		return handle_ptr_array_return (priv->devices);

	if (!_nm_object_get_property (NM_OBJECT (connection),
	                             NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
	                             DBUS_PROP_DEVICES,
	                             &value)) {
		return NULL;
	}

	demarshal_devices (NM_OBJECT (connection), NULL, &value, &priv->devices);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->devices);
}