libnm: avoid in_addr_t/in6addr use in libnm header

"in_addr_t" and "struct in6_addr" require headers from libc (or linux).

In particular, some libc headers conflict with the linux headers
(or they have to be included in a specific order). To avoid that
we want that our libnm headers include a minimum of other headers
(and only drag in glib headers, which we anyway need).

- instead of "in_addr_t", use guint32. For all practical purposes,
  "in_addr_t" is a plain 32 bit integers and we can do this replacement
  in our public headers.

- forward declare "struct in6_addr".
This commit is contained in:
Thomas Haller
2020-12-21 21:49:56 +01:00
parent 0fca809bfd
commit 45ed23c46e

View File

@@ -185,7 +185,10 @@ gboolean nm_utils_is_uuid(const char *str);
* for both nm_utils_inet4_ntop() and nm_utils_inet6_ntop().
**/
#define NM_UTILS_INET_ADDRSTRLEN INET6_ADDRSTRLEN
const char *nm_utils_inet4_ntop(in_addr_t inaddr, char *dst);
const char *nm_utils_inet4_ntop(guint32 inaddr, char *dst);
struct in6_addr;
const char *nm_utils_inet6_ntop(const struct in6_addr *in6addr, char *dst);
gboolean nm_utils_ipaddr_valid(int family, const char *ip);