Commit 3a23cddb authored by Jiří Klimeš's avatar Jiří Klimeš

libnm-util: add functions to get number of data items and secrets

nm_setting_vpn_get_num_data_items()
nm_setting_vpn_get_num_secrets()
parent decfaa41
......@@ -365,6 +365,8 @@ global:
nm_setting_vpn_foreach_data_item;
nm_setting_vpn_foreach_secret;
nm_setting_vpn_get_data_item;
nm_setting_vpn_get_num_data_items;
nm_setting_vpn_get_num_secrets;
nm_setting_vpn_get_secret;
nm_setting_vpn_get_service_type;
nm_setting_vpn_get_type;
......
......@@ -173,6 +173,20 @@ nm_setting_vpn_get_user_name (NMSettingVPN *setting)
return NM_SETTING_VPN_GET_PRIVATE (setting)->user_name;
}
/**
* nm_setting_vpn_get_num_data_items:
* @setting: the #NMSettingVPN
*
* Gets number of key/value pairs of VPN configuration data.
**/
guint32
nm_setting_vpn_get_num_data_items (NMSettingVPN *setting)
{
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), 0);
return g_hash_table_size (NM_SETTING_VPN_GET_PRIVATE (setting)->data);
}
/**
* nm_setting_vpn_add_data_item:
* @setting: the #NMSettingVPN
......@@ -283,6 +297,20 @@ nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
foreach_item_helper (NM_SETTING_VPN_GET_PRIVATE (setting)->data, func, user_data);
}
/**
* nm_setting_vpn_get_num_secrets:
* @setting: the #NMSettingVPN
*
* Gets number of VPN plugin specific secrets in the setting.
**/
guint32
nm_setting_vpn_get_num_secrets (NMSettingVPN *setting)
{
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), 0);
return g_hash_table_size (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets);
}
/**
* nm_setting_vpn_add_secret:
* @setting: the #NMSettingVPN
......
......@@ -92,6 +92,7 @@ NMSetting *nm_setting_vpn_new (void);
const char *nm_setting_vpn_get_service_type (NMSettingVPN *setting);
const char *nm_setting_vpn_get_user_name (NMSettingVPN *setting);
guint32 nm_setting_vpn_get_num_data_items (NMSettingVPN *setting);
void nm_setting_vpn_add_data_item (NMSettingVPN *setting,
const char *key,
const char *item);
......@@ -103,6 +104,7 @@ void nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
NMVPNIterFunc func,
gpointer user_data);
guint32 nm_setting_vpn_get_num_secrets (NMSettingVPN *setting);
void nm_setting_vpn_add_secret (NMSettingVPN *setting,
const char *key,
const char *secret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment