shared: add nm_ip_addr_set() helper

This commit is contained in:
Thomas Haller 2017-11-07 19:51:25 +01:00
parent 632e8ac885
commit a9d1f5e543

View file

@ -66,6 +66,19 @@ typedef struct {
extern const NMIPAddr nm_ip_addr_zero;
static inline void
nm_ip_addr_set (int addr_family, gpointer dst, const NMIPAddr *src)
{
nm_assert_addr_family (addr_family);
nm_assert (dst);
nm_assert (src);
if (addr_family != AF_INET6)
*((in_addr_t *) dst) = src->addr4;
else
*((struct in6_addr *) dst) = src->addr6;
}
/*****************************************************************************/
#define NM_CMP_RETURN(c) \