MEDIUM: stream_sock: add a get_src and get_dst callback and remove SN_FRT_ADDR_SET

These callbacks are used to retrieve the source and destination address
of a socket. The address flags are not hold on the stream interface and
not on the session anymore. The addresses are collected when needed.

This still needs to be improved to store the IP and port separately so
that it is not needed to perform a getsockname() when only the IP address
is desired for outgoing traffic.
diff --git a/src/backend.c b/src/backend.c
index f6e2d73..57acbe7 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -688,8 +688,8 @@
 			 * the client asked, which is handy for remapping ports
 			 * locally on multiple addresses at once.
 			 */
-			if (!(s->be->options & PR_O_TRANSP) && !(s->flags & SN_FRT_ADDR_SET))
-				get_frt_addr(s);
+			if (!(s->be->options & PR_O_TRANSP))
+				stream_sock_get_to_addr(s->req->prod);
 
 			if (s->req->prod->addr.to.ss_family == AF_INET) {
 				((struct sockaddr_in *)&s->req->cons->addr.to)->sin_addr = ((struct sockaddr_in *)&s->req->prod->addr.to)->sin_addr;
@@ -703,8 +703,8 @@
 		if (target_srv(&s->target)->state & SRV_MAPPORTS) {
 			int base_port;
 
-			if (!(s->be->options & PR_O_TRANSP) && !(s->flags & SN_FRT_ADDR_SET))
-				get_frt_addr(s);
+			if (!(s->be->options & PR_O_TRANSP))
+				stream_sock_get_to_addr(s->req->prod);
 
 			/* First, retrieve the port from the incoming connection */
 			base_port = get_host_port(&s->req->prod->addr.to);
@@ -720,8 +720,7 @@
 	}
 	else if (s->be->options & PR_O_TRANSP) {
 		/* in transparent mode, use the original dest addr if no dispatch specified */
-		if (!(s->flags & SN_FRT_ADDR_SET))
-			get_frt_addr(s);
+		stream_sock_get_to_addr(s->req->prod);
 
 		if (s->req->prod->addr.to.ss_family == AF_INET || s->req->prod->addr.to.ss_family == AF_INET6) {
 			memcpy(&s->req->cons->addr.to, &s->req->prod->addr.to, MIN(sizeof(s->req->cons->addr.to), sizeof(s->req->prod->addr.to)));
@@ -973,6 +972,8 @@
 	 */
 	stream_sock_prepare_interface(s->req->cons);
 	s->req->cons->connect = tcp_connect_server;
+	s->req->cons->get_src = getsockname;
+	s->req->cons->get_dst = getpeername;
 	/* the target was only on the session, assign it to the SI now */
 	copy_target(&s->req->cons->target, &s->target);
 
@@ -980,8 +981,7 @@
 	s->req->cons->send_proxy_ofs = 0;
 	if (s->target.type == TARG_TYPE_SERVER && (s->target.ptr.s->state & SRV_SEND_PROXY)) {
 		s->req->cons->send_proxy_ofs = 1; /* must compute size */
-		if (!(s->flags & SN_FRT_ADDR_SET))
-			get_frt_addr(s);
+		stream_sock_get_to_addr(s->req->prod);
 	}
 
 	assign_tproxy_address(s);