mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 04:10:17 +01:00
glib-aux: move ip address utils in "nm-shared-utils.h" header
Some were duplicated. Drop those.
Some function were in an order where they required forward declarations.
Reorder.
(cherry picked from commit d7990b359b)
This commit is contained in:
parent
09832c5639
commit
04d982e278
1 changed files with 22 additions and 32 deletions
|
|
@ -389,6 +389,10 @@ gboolean nm_utils_get_ipv6_interface_identifier(NMLinkType link_type,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
in_addr_t _nm_utils_ip4_prefix_to_netmask(guint32 prefix);
|
||||
guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip);
|
||||
guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip);
|
||||
|
||||
gconstpointer
|
||||
nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen);
|
||||
in_addr_t nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen);
|
||||
|
|
@ -408,6 +412,20 @@ int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a,
|
|||
const struct in6_addr *addr_b,
|
||||
guint8 plen);
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint8 plen)
|
||||
{
|
||||
return nm_utils_ip4_address_same_prefix_cmp(addr_a, addr_b, plen) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ip6_address_same_prefix(const struct in6_addr *addr_a,
|
||||
const struct in6_addr *addr_b,
|
||||
guint8 plen)
|
||||
{
|
||||
return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen) == 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_utils_ip_address_same_prefix_cmp(int addr_family,
|
||||
gconstpointer addr_a,
|
||||
|
|
@ -427,20 +445,6 @@ nm_utils_ip_address_same_prefix_cmp(int addr_family,
|
|||
return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint8 plen)
|
||||
{
|
||||
return nm_utils_ip4_address_same_prefix_cmp(addr_a, addr_b, plen) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ip6_address_same_prefix(const struct in6_addr *addr_a,
|
||||
const struct in6_addr *addr_b,
|
||||
guint8 plen)
|
||||
{
|
||||
return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ip_address_same_prefix(int addr_family,
|
||||
gconstpointer addr_a,
|
||||
|
|
@ -458,6 +462,10 @@ nm_utils_ip_address_same_prefix(int addr_family,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nm_utils_ip_is_site_local(int addr_family, const void *address);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_IPV4LL_NETWORK ((in_addr_t) (htonl(0xA9FE0000lu)))
|
||||
#define NM_IPV4LL_NETMASK ((in_addr_t) (htonl(0xFFFF0000lu)))
|
||||
|
||||
|
|
@ -974,24 +982,6 @@ nm_utils_escaped_tokens_options_escape_val(const char *val, char **out_to_free)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
guint32 _nm_utils_ip4_prefix_to_netmask(guint32 prefix);
|
||||
guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip);
|
||||
guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip);
|
||||
|
||||
gconstpointer
|
||||
nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen);
|
||||
in_addr_t nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen);
|
||||
const struct in6_addr *nm_utils_ip6_address_clear_host_address(struct in6_addr *dst,
|
||||
const struct in6_addr *src,
|
||||
guint8 plen);
|
||||
int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a,
|
||||
const struct in6_addr *addr_b,
|
||||
guint8 plen);
|
||||
|
||||
gboolean nm_utils_ip_is_site_local(int addr_family, const void *address);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nm_utils_parse_inaddr_bin_full(int addr_family,
|
||||
gboolean accept_legacy,
|
||||
const char *text,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue