shared: add "struct in_addr" union member to NMIPAddr struct

NMIPAddr is a union of IPv4 and IPv6 addresses.

A lot of our internal API handles IPv4 as in_addr_t / guint32 / be32_t
types, as such the union field "addr4" is just a plain number. Possibly
the internal API should be all refactored to prefer "struct in_addr"
instead, but that is yet to be done.

Anyway, at a few places we will need also access to the IPv4 address in form of
a `struct in_addr`. Add an alias for that.

I am not too happy about the resulting naming. It would be nicer to have

    struct in_addr  addr4;
    struct in6_addr addr6;
    in_addr_t       s_addr4;

but for now, don't do such renaming.
This commit is contained in:
Thomas Haller 2019-01-13 13:31:15 +01:00
parent 035c4ad45d
commit 744e11dc0d

View file

@ -102,6 +102,7 @@ typedef struct {
union {
guint8 addr_ptr[1];
in_addr_t addr4;
struct in_addr addr4_struct;
struct in6_addr addr6;
/* NMIPAddr is really a union for IP addresses.