dhcp: add nm_dhcp_client_can_accept() function

This commit is contained in:
Thomas Haller 2021-08-05 12:22:16 +02:00
parent 320a1b5a79
commit 2cbaaed820
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 15 additions and 0 deletions

View file

@ -611,6 +611,20 @@ nm_dhcp_client_accept(NMDhcpClient *self, GError **error)
return TRUE;
}
gboolean
nm_dhcp_client_can_accept(NMDhcpClient *self)
{
gboolean can_accept;
g_return_val_if_fail(NM_IS_DHCP_CLIENT(self), FALSE);
can_accept = !!(NM_DHCP_CLIENT_GET_CLASS(self)->accept);
nm_assert(can_accept == (!!(NM_DHCP_CLIENT_GET_CLASS(self)->decline)));
return can_accept;
}
gboolean
nm_dhcp_client_decline(NMDhcpClient *self, const char *error_message, GError **error)
{

View file

@ -171,6 +171,7 @@ gboolean nm_dhcp_client_start_ip6(NMDhcpClient * self,
GError ** error);
gboolean nm_dhcp_client_accept(NMDhcpClient *self, GError **error);
gboolean nm_dhcp_client_can_accept(NMDhcpClient *self);
gboolean nm_dhcp_client_decline(NMDhcpClient *self, const char *error_message, GError **error);