MINOR: protocol: add a new proto_fam structure for protocol families

We need to specially handle protocol families which regroup common
functions used for a given address family. These functions include
bind(), addrcmp(), get_src() and get_dst() for now. Some fields are
also added about the address family, socket domain (protocol family
passed to the socket() syscall), and address length.

These protocol families are referenced from the protocols but not yet
used.
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index a920f4e..a2a9607 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -45,9 +45,22 @@
 static int sockpair_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static int sockpair_connect_server(struct connection *conn, int flags);
 
+struct proto_fam proto_fam_sockpair = {
+	.name = "sockpair",
+	.sock_domain = AF_CUST_SOCKPAIR,
+	.sock_family = AF_UNIX,
+	.sock_addrlen = sizeof(struct sockaddr_un),
+	.l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),
+	.addrcmp = NULL,
+	.bind = sockpair_bind_receiver,
+	.get_src = NULL,
+	.get_dst = NULL,
+};
+
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_sockpair = {
 	.name = "sockpair",
+	.fam = &proto_fam_sockpair,
 	.sock_domain = AF_CUST_SOCKPAIR,
 	.sock_type = SOCK_STREAM,
 	.sock_prot = 0,
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 4af22e5..cb4dc32 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -51,6 +51,7 @@
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_tcpv4 = {
 	.name = "tcpv4",
+	.fam = &proto_fam_inet4,
 	.sock_domain = AF_INET,
 	.sock_type = SOCK_STREAM,
 	.sock_prot = IPPROTO_TCP,
@@ -76,6 +77,7 @@
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_tcpv6 = {
 	.name = "tcpv6",
+	.fam = &proto_fam_inet6,
 	.sock_domain = AF_INET6,
 	.sock_type = SOCK_STREAM,
 	.sock_prot = IPPROTO_TCP,
diff --git a/src/proto_udp.c b/src/proto_udp.c
index 43eff39..d4d6b2a 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -47,6 +47,7 @@
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_udp4 = {
 	.name = "udp4",
+	.fam = &proto_fam_inet4,
 	.sock_domain = AF_CUST_UDP4,
 	.sock_type = SOCK_DGRAM,
 	.sock_prot = IPPROTO_UDP,
@@ -72,6 +73,7 @@
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_udp6 = {
 	.name = "udp6",
+	.fam = &proto_fam_inet6,
 	.sock_domain = AF_CUST_UDP6,
 	.sock_type = SOCK_DGRAM,
 	.sock_prot = IPPROTO_UDP,
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 5ceb18f..0b8e176 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -48,6 +48,7 @@
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct protocol proto_unix = {
 	.name = "unix_stream",
+	.fam = &proto_fam_unix,
 	.sock_domain = PF_UNIX,
 	.sock_type = SOCK_STREAM,
 	.sock_prot = 0,
diff --git a/src/sock_inet.c b/src/sock_inet.c
index 3bb4f34..09ff71e 100644
--- a/src/sock_inet.c
+++ b/src/sock_inet.c
@@ -31,6 +31,29 @@
 #include <haproxy/sock_inet.h>
 #include <haproxy/tools.h>
 
+struct proto_fam proto_fam_inet4 = {
+	.name = "inet4",
+	.sock_domain = PF_INET,
+	.sock_family = AF_INET,
+	.sock_addrlen = sizeof(struct sockaddr_in),
+	.l3_addrlen = 32/8,
+	.addrcmp = sock_inet4_addrcmp,
+	.bind = sock_inet_bind_receiver,
+	.get_src = sock_get_src,
+	.get_dst = sock_inet_get_dst,
+};
+
+struct proto_fam proto_fam_inet6 = {
+	.name = "inet6",
+	.sock_domain = PF_INET6,
+	.sock_family = AF_INET6,
+	.sock_addrlen = sizeof(struct sockaddr_in6),
+	.l3_addrlen = 128/8,
+	.addrcmp = sock_inet6_addrcmp,
+	.bind = sock_inet_bind_receiver,
+	.get_src = sock_get_src,
+	.get_dst = sock_get_dst,
+};
 
 /* PLEASE NOTE for function below:
  *   - sock_inet4_* is solely for AF_INET (IPv4)
diff --git a/src/sock_unix.c b/src/sock_unix.c
index 04accb4..4620b74 100644
--- a/src/sock_unix.c
+++ b/src/sock_unix.c
@@ -36,6 +36,18 @@
 #include <haproxy/tools.h>
 
 
+struct proto_fam proto_fam_unix = {
+	.name = "unix",
+	.sock_domain = PF_UNIX,
+	.sock_family = AF_UNIX,
+	.sock_addrlen = sizeof(struct sockaddr_un),
+	.l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),
+	.addrcmp = sock_unix_addrcmp,
+	.bind = sock_unix_bind_receiver,
+	.get_src = sock_get_src,
+	.get_dst = sock_get_dst,
+};
+
 /* PLEASE NOTE for functions below:
  *
  * The address family SHOULD always be checked. In some cases a function will