[MEDIUM] separate protocol-level accept() from the frontend's

For a long time we had two large accept() functions, one for TCP
sockets instanciating proxies, and another one for UNIX sockets
instanciating the stats interface.

A lot of code was duplicated and both did not work exactly the same way.

Now we have a stream_sock layer accept() called for either TCP or UNIX
sockets, and this function calls the frontend-specific accept() function
which does the rest of the frontend-specific initialisation.

Some code is still duplicated (session & task allocation, stream interface
initialization), and might benefit from having an intermediate session-level
accept() callback to perform such initializations. Still there are some
minor differences that need to be addressed first. For instance, the monitor
nets should only be checked for proxies and not for other connection templates.

Last, we renamed l->private as l->frontend. The "private" pointer in
the listener is only used to store a frontend, so let's rename it to
eliminate this ambiguity. When we later support detached listeners
(eg: FTP), we'll add another field to avoid the confusion.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 1662e90..fc020c9 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -63,6 +63,7 @@
 	.sock_family = AF_INET,
 	.sock_addrlen = sizeof(struct sockaddr_in),
 	.l3_addrlen = 32/8,
+	.accept = &stream_sock_accept,
 	.read = &stream_sock_read,
 	.write = &stream_sock_write,
 	.bind_all = tcp_bind_listeners,
@@ -81,6 +82,7 @@
 	.sock_family = AF_INET6,
 	.sock_addrlen = sizeof(struct sockaddr_in6),
 	.l3_addrlen = 128/8,
+	.accept = &stream_sock_accept,
 	.read = &stream_sock_read,
 	.write = &stream_sock_write,
 	.bind_all = tcp_bind_listeners,
@@ -539,19 +541,17 @@
 	listener->fd = fd;
 	listener->state = LI_LISTEN;
 
-	/* the function for the accept() event */
-	fd_insert(fd);
-	fdtab[fd].cb[DIR_RD].f = listener->accept;
-	fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
-	fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
 	fdtab[fd].owner = listener; /* reference the listener instead of a task */
 	fdtab[fd].state = FD_STLISTEN;
-	fdtab[fd].flags = FD_FL_TCP;
-	if (listener->options & LI_O_NOLINGER)
-		fdtab[fd].flags |= FD_FL_TCP_NOLING;
+	fdtab[fd].flags = FD_FL_TCP | ((listener->options & LI_O_NOLINGER) ? FD_FL_TCP_NOLING : 0);
+	fdtab[fd].cb[DIR_RD].f = listener->proto->accept;
+	fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
+	fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
 
 	fdinfo[fd].peeraddr = NULL;
 	fdinfo[fd].peerlen = 0;
+	fd_insert(fd);
+
  tcp_return:
 	if (msg && errlen)
 		strlcpy2(errmsg, msg, errlen);