libnm: add internal helper function nm_utils_inet_ntop()
This commit is contained in:
@@ -429,6 +429,8 @@ NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection *
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst);
|
||||
|
||||
gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@@ -3762,6 +3762,22 @@ nm_utils_is_uuid (const char *str)
|
||||
|
||||
static char _nm_utils_inet_ntop_buffer[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
const char *
|
||||
nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
nm_assert_addr_family (addr_family);
|
||||
nm_assert (addr);
|
||||
|
||||
s = inet_ntop (addr_family,
|
||||
addr,
|
||||
dst ? dst : _nm_utils_inet_ntop_buffer,
|
||||
addr_family == AF_INET6 ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN);
|
||||
nm_assert (s);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_inet4_ntop: (skip)
|
||||
* @inaddr: the address that should be converted to string.
|
||||
|
Reference in New Issue
Block a user