REORG/MEDIUM: stream_interface: move applet->state and private to connection

The state and the private pointer are not specific to the applets, since SSL
will require exactly both of them. Move them to the connection layer now and
rename them. We also now ensure that both are NULL on first call.
diff --git a/src/peers.c b/src/peers.c
index 6fcf2f3..721eecb 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -185,9 +185,9 @@
 {
 	struct task *t = (struct task *)si->owner;
 	struct session *s = (struct session *)t->context;
-	struct peer_session *ps = (struct peer_session *)si->applet.private;
+	struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
 
-	/* si->applet.private is not a peer session */
+	/* si->conn.data_ctx is not a peer session */
 	if (si->applet.st0 < PEER_SESSION_SENDSUCCESS)
 		return;
 
@@ -227,7 +227,7 @@
 switchstate:
 		switch(si->applet.st0) {
 			case PEER_SESSION_ACCEPT:
-				si->applet.private = NULL;
+				si->conn.data_ctx = NULL;
 				si->applet.st0 = PEER_SESSION_GETVERSION;
 				/* fall through */
 			case PEER_SESSION_GETVERSION:
@@ -333,12 +333,12 @@
 					goto switchstate;
 				}
 
-				si->applet.private = curpeer;
+				si->conn.data_ctx = curpeer;
 				si->applet.st0 = PEER_SESSION_GETTABLE;
 				/* fall through */
 			}
 			case PEER_SESSION_GETTABLE: {
-				struct peer *curpeer = (struct peer *)si->applet.private;
+				struct peer *curpeer = (struct peer *)si->conn.data_ctx;
 				struct shared_table *st;
 				struct peer_session *ps = NULL;
 				unsigned long key_type;
@@ -349,12 +349,12 @@
 				if (reql <= 0) { /* closed or EOL not found */
 					if (reql == 0)
 						goto out;
-					si->applet.private = NULL;
+					si->conn.data_ctx = NULL;
 					si->applet.st0 = PEER_SESSION_END;
 					goto switchstate;
 				}
-				/* Re init si->applet.private to null, to handle correctly a release case */
-				si->applet.private = NULL;
+				/* Re init si->conn.data_ctx to null, to handle correctly a release case */
+				si->conn.data_ctx = NULL;
 
 				if (trash[reql-1] != '\n') {
 					/* Incomplete line, we quit */
@@ -380,7 +380,7 @@
 
 				p = strchr(p+1, ' ');
 				if (!p) {
-					si->applet.private = NULL;
+					si->conn.data_ctx = NULL;
 					si->applet.st0 = PEER_SESSION_EXIT;
 					si->applet.st1 = PEER_SESSION_ERRPROTO;
 					goto switchstate;
@@ -439,12 +439,12 @@
 					goto switchstate;
 				}
 
-				si->applet.private = ps;
+				si->conn.data_ctx = ps;
 				si->applet.st0 = PEER_SESSION_SENDSUCCESS;
 				/* fall through */
 			}
 			case PEER_SESSION_SENDSUCCESS:{
-				struct peer_session *ps = (struct peer_session *)si->applet.private;
+				struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
 
 				repl = snprintf(trash, trashlen, "%d\n", PEER_SESSION_SUCCESSCODE);
 				repl = bi_putblk(si->ib, trash, repl);
@@ -494,7 +494,7 @@
 				goto switchstate;
 			}
 			case PEER_SESSION_CONNECT: {
-				struct peer_session *ps = (struct peer_session *)si->applet.private;
+				struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
 
 				/* Send headers */
 				repl = snprintf(trash, trashlen,
@@ -524,7 +524,7 @@
 				/* fall through */
 			}
 			case PEER_SESSION_GETSTATUS: {
-				struct peer_session *ps = (struct peer_session *)si->applet.private;
+				struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
 
 				if (si->ib->flags & BF_WRITE_PARTIAL)
 					ps->statuscode = PEER_SESSION_CONNECTEDCODE;
@@ -595,7 +595,7 @@
 				/* fall through */
 			}
 			case PEER_SESSION_WAITMSG: {
-				struct peer_session *ps = (struct peer_session *)si->applet.private;
+				struct peer_session *ps = (struct peer_session *)si->conn.data_ctx;
 				char c;
 				int totl = 0;
 
@@ -1064,7 +1064,7 @@
 	/* call release to reinit resync states if needed */
 	peer_session_release(oldsi);
 	oldsi->applet.st0 = PEER_SESSION_END;
-	oldsi->applet.private = NULL;
+	oldsi->conn.data_ctx = NULL;
 	task_wakeup(session->task, TASK_WOKEN_MSG);
 }
 
@@ -1079,7 +1079,7 @@
 	 /* we have a dedicated I/O handler for the stats */
 	stream_int_register_handler(&s->si[1], &peer_applet);
 	copy_target(&s->target, &s->si[1].target); // for logging only
-	s->si[1].applet.private = s;
+	s->si[1].conn.data_ctx = s;
 	s->si[1].applet.st0 = PEER_SESSION_ACCEPT;
 
 	tv_zero(&s->logs.tv_request);
@@ -1162,7 +1162,7 @@
 	s->si[0].flags = SI_FL_NONE;
 	if (s->fe->options2 & PR_O2_INDEPSTR)
 		s->si[0].flags |= SI_FL_INDEP_STR;
-	s->si[0].applet.private = (void *)ps;
+	s->si[0].conn.data_ctx = (void *)ps;
 	s->si[0].applet.st0 = PEER_SESSION_CONNECT;
 
 	stream_int_register_handler(&s->si[0], &peer_applet);