/*----- IPv4 addresses ----------------------------------------------------*/
+#define ADDRFAM_IPV4 AF_INET
+#define NAME_IPV4 "IPv4"
+#define ADDRLEN_IPV4 32
+
static int addreq_ipv4(const union addr *a, const union addr *b)
{ return a->ipv4.s_addr == b->ipv4.s_addr; }
/*----- IPv6 addresses ----------------------------------------------------*/
+#define ADDRFAM_IPV6 AF_INET6
+#define NAME_IPV6 "IPv6"
+#define ADDRLEN_IPV6 128
+
static int addreq_ipv6(const union addr *a, const union addr *b)
{ return !memcmp(a->ipv6.s6_addr, b->ipv6.s6_addr, 16); }
/*----- The operations table ----------------------------------------------*/
const struct addrops addroptab[] = {
-#define DEFOPS(ty, TY, af, name, len) \
- { AF_##af, name, len, &any_##ty, &addrops_sys_##ty, \
+#define DEFOPS(ty, TY) \
+ { ADDRFAM_##TY, NAME_##TY, ADDRLEN_##TY, \
+ &any_##ty, &addrops_sys_##ty, \
addreq_##ty, match_addrpat_##ty, \
socket_to_sockaddr_##ty, sockaddr_to_addr_##ty, \
init_listen_socket_##ty },