dhcp: add nm_dhcp_option_add_option_utf8safe_escape() helper
This commit is contained in:
@@ -241,6 +241,20 @@ nm_dhcp_option_add_option(GHashTable * options,
|
|||||||
nm_dhcp_option_take_option(options, requests, option, g_strdup(value));
|
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
|
void
|
||||||
nm_dhcp_option_add_option_u64(GHashTable * options,
|
nm_dhcp_option_add_option_u64(GHashTable * options,
|
||||||
const NMDhcpOption *requests,
|
const NMDhcpOption *requests,
|
||||||
|
@@ -195,6 +195,11 @@ void nm_dhcp_option_add_option(GHashTable * options,
|
|||||||
const NMDhcpOption *requests,
|
const NMDhcpOption *requests,
|
||||||
guint option,
|
guint option,
|
||||||
const char * value);
|
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,
|
void nm_dhcp_option_add_option_u64(GHashTable * options,
|
||||||
const NMDhcpOption *requests,
|
const NMDhcpOption *requests,
|
||||||
guint option,
|
guint option,
|
||||||
|
Reference in New Issue
Block a user