mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 17:00:40 +01:00
core: add nm_dhcp_config_get_option_values()
Introduce a function to return an array of name-value tuples for DHCP options.
This commit is contained in:
parent
15a4211303
commit
96d8637ced
2 changed files with 25 additions and 1 deletions
|
|
@ -125,6 +125,29 @@ nm_dhcp_config_set_lease(NMDhcpConfig *self, const NML3ConfigData *l3cd)
|
|||
_notify(self, PROP_OPTIONS);
|
||||
}
|
||||
|
||||
NMUtilsNamedValue *
|
||||
nm_dhcp_config_get_option_values(NMDhcpConfig *self, guint *num)
|
||||
{
|
||||
NMDhcpConfigPrivate *priv = NM_DHCP_CONFIG_GET_PRIVATE(self);
|
||||
NMDhcpLease *lease;
|
||||
NMUtilsNamedValue *buffer = NULL;
|
||||
|
||||
if (!priv->l3cd) {
|
||||
NM_SET_OUT(num, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lease = nm_l3_config_data_get_dhcp_lease(priv->l3cd, nm_dhcp_config_get_addr_family(self));
|
||||
nm_utils_named_values_from_strdict_full(nm_dhcp_lease_get_options(lease),
|
||||
num,
|
||||
nm_strcmp_p_with_data,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
&buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_dhcp_config_get_option(NMDhcpConfig *self, const char *key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ int nm_dhcp_config_get_addr_family(NMDhcpConfig *self);
|
|||
|
||||
void nm_dhcp_config_set_lease(NMDhcpConfig *self, const NML3ConfigData *l3cd);
|
||||
|
||||
const char *nm_dhcp_config_get_option(NMDhcpConfig *self, const char *option);
|
||||
NMUtilsNamedValue *nm_dhcp_config_get_option_values(NMDhcpConfig *self, guint *num);
|
||||
const char *nm_dhcp_config_get_option(NMDhcpConfig *self, const char *option);
|
||||
|
||||
GVariant *nm_dhcp_config_get_options(NMDhcpConfig *self);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue