dhcp: add nm_dhcp_option_add_option_utf8safe_escape() helper

This commit is contained in:
Thomas Haller
2021-02-10 15:14:59 +01:00
parent f0a9268718
commit 41634d5199
2 changed files with 19 additions and 0 deletions

View File

@@ -241,6 +241,20 @@ nm_dhcp_option_add_option(GHashTable * options,
nm_dhcp_option_take_option(options, requests, option, g_strdup(value));
}
void
nm_dhcp_option_add_option_utf8safe_escape(GHashTable * options,
const NMDhcpOption *requests,
guint option,
const guint8 * data,
gsize n_data)
{
gs_free char *to_free = NULL;
const char * escaped;
escaped = nm_utils_buf_utf8safe_escape((char *) data, n_data, 0, &to_free);
nm_dhcp_option_add_option(options, requests, option, escaped ?: "");
}
void
nm_dhcp_option_add_option_u64(GHashTable * options,
const NMDhcpOption *requests,

View File

@@ -195,6 +195,11 @@ void nm_dhcp_option_add_option(GHashTable * options,
const NMDhcpOption *requests,
guint option,
const char * value);
void nm_dhcp_option_add_option_utf8safe_escape(GHashTable * options,
const NMDhcpOption *requests,
guint option,
const guint8 * data,
gsize n_data);
void nm_dhcp_option_add_option_u64(GHashTable * options,
const NMDhcpOption *requests,
guint option,