Ejemplo n.º 1
0
const char *
nm_dhcp6_config_get_dbus_path (NMDHCP6Config *self)
{
	g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);

	return NM_DHCP6_CONFIG_GET_PRIVATE (self)->dbus_path;
}
Ejemplo n.º 2
0
/**
 * nm_dhcp6_config_get_one_option:
 * @config: a #NMDHCP6Config
 * @option: the option to retrieve
 *
 * Gets one option by option name.
 *
 * Returns: the configuration option's value. This is the internal string used by the
 * configuration, and must not be modified.
 **/
const char *
nm_dhcp6_config_get_one_option (NMDHCP6Config *config, const char *option)
{
	g_return_val_if_fail (NM_IS_DHCP6_CONFIG (config), NULL);

	return g_hash_table_lookup (nm_dhcp6_config_get_options (config), option);
}
Ejemplo n.º 3
0
void
nm_dhcp6_config_reset (NMDHCP6Config *self)
{
	g_return_if_fail (NM_IS_DHCP6_CONFIG (self));

	g_hash_table_remove_all (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options);
	g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS);
}
Ejemplo n.º 4
0
/**
 * nm_dhcp6_config_get_options:
 * @config: a #NMDHCP6Config
 *
 * Gets all the options contained in the configuration.
 *
 * Returns: (transfer none) (element-type utf8 GObject.Value): 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)
{
	g_return_val_if_fail (NM_IS_DHCP6_CONFIG (config), NULL);

	_nm_object_ensure_inited (NM_OBJECT (config));
	return NM_DHCP6_CONFIG_GET_PRIVATE (config)->options;
}
Ejemplo n.º 5
0
const char *
nm_dhcp6_config_get_option (NMDHCP6Config *self, const char *key)
{
	GValue *value;

	g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);
	g_return_val_if_fail (key != NULL, NULL);

	value = g_hash_table_lookup (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, key);
	return value ? g_value_get_string (value) : NULL;
}
Ejemplo n.º 6
0
/* Caller owns the list, but not the values in the list */
GSList *
nm_dhcp6_config_list_options (NMDHCP6Config *self)
{
	GHashTableIter iter;
	const char *option = NULL;
	GSList *list = NULL;

	g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);

	g_hash_table_iter_init (&iter, NM_DHCP6_CONFIG_GET_PRIVATE (self)->options);
	while (g_hash_table_iter_next (&iter, (gpointer) &option, NULL))
		list = g_slist_prepend (list, (gpointer) option);

	return list;
}
Ejemplo n.º 7
0
void
nm_dhcp6_config_add_option (NMDHCP6Config *self,
                            const char *key,
                            const char *option)
{
	GValue *svalue;

	g_return_if_fail (NM_IS_DHCP6_CONFIG (self));
	g_return_if_fail (key != NULL);
	g_return_if_fail (option != NULL);

	svalue = g_slice_new0 (GValue);
	g_value_init (svalue, G_TYPE_STRING);
	g_value_set_string (svalue, option);
	g_hash_table_insert (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, g_strdup (key), svalue);
	g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS);
}