REORG/MEDIUM: stream: rename stream flags from SN_* to SF_*

This is in order to keep things consistent.
diff --git a/src/backend.c b/src/backend.c
index ee84571..d56d46f 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -499,7 +499,7 @@
  * defined by the backend it is assigned to. The stream is then marked as
  * 'assigned'.
  *
- * This function MAY NOT be called with SN_ASSIGNED already set. If the stream
+ * This function MAY NOT be called with SF_ASSIGNED already set. If the stream
  * had a server previously assigned, it is rebalanced, trying to avoid the same
  * server, which should still be present in target_srv(&s->target) before the call.
  * The function tries to keep the original connection slot if it reconnects to
@@ -513,7 +513,7 @@
  *   SRV_STATUS_FULL     if all servers are saturated. Stream is not ASSIGNED
  *   SRV_STATUS_INTERNAL for other unrecoverable errors.
  *
- * Upon successful return, the stream flag SN_ASSIGNED is set to indicate that
+ * Upon successful return, the stream flag SF_ASSIGNED is set to indicate that
  * it does not need to be called anymore. This means that target_srv(&s->target)
  * can be trusted in balance and direct modes.
  *
@@ -529,7 +529,7 @@
 	DPRINTF(stderr,"assign_server : s=%p\n",s);
 
 	err = SRV_STATUS_INTERNAL;
-	if (unlikely(s->pend_pos || s->flags & SN_ASSIGNED))
+	if (unlikely(s->pend_pos || s->flags & SF_ASSIGNED))
 		goto out_err;
 
 	prev_srv  = objt_server(s->target);
@@ -708,7 +708,7 @@
 		goto out;
 	}
 
-	s->flags |= SN_ASSIGNED;
+	s->flags |= SF_ASSIGNED;
 	err = SRV_STATUS_OK;
  out:
 
@@ -729,7 +729,7 @@
 }
 
 /*
- * This function assigns a server address to a stream, and sets SN_ADDR_SET.
+ * This function assigns a server address to a stream, and sets SF_ADDR_SET.
  * The address is taken from the currently assigned server, or from the
  * dispatch or transparent address.
  *
@@ -737,7 +737,7 @@
  *   SRV_STATUS_OK       if everything is OK.
  *   SRV_STATUS_INTERNAL for other unrecoverable errors.
  *
- * Upon successful return, the stream flag SN_ADDR_SET is set. This flag is
+ * Upon successful return, the stream flag SF_ADDR_SET is set. This flag is
  * not cleared, so it's to the caller to clear it if required.
  *
  * The caller is responsible for having already assigned a connection
@@ -753,9 +753,9 @@
 	fprintf(stderr,"assign_server_address : s=%p\n",s);
 #endif
 
-	if ((s->flags & SN_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
+	if ((s->flags & SF_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
 		/* A server is necessarily known for this stream */
-		if (!(s->flags & SN_ASSIGNED))
+		if (!(s->flags & SF_ASSIGNED))
 			return SRV_STATUS_INTERNAL;
 
 		srv_conn->addr.to = objt_server(s->target)->addr;
@@ -813,14 +813,14 @@
 	/* Copy network namespace from client connection */
 	srv_conn->proxy_netns = cli_conn ? cli_conn->proxy_netns : NULL;
 
-	s->flags |= SN_ADDR_SET;
+	s->flags |= SF_ADDR_SET;
 	return SRV_STATUS_OK;
 }
 
 /* This function assigns a server to stream <s> if required, and can add the
  * connection to either the assigned server's queue or to the proxy's queue.
  * If ->srv_conn is set, the stream is first released from the server.
- * It may also be called with SN_DIRECT and/or SN_ASSIGNED though. It will
+ * It may also be called with SF_DIRECT and/or SF_ASSIGNED though. It will
  * be called before any connection and after any retry or redispatch occurs.
  *
  * It is not allowed to call this function with a stream in a queue.
@@ -846,7 +846,7 @@
 		return SRV_STATUS_INTERNAL;
 
 	err = SRV_STATUS_OK;
-	if (!(s->flags & SN_ASSIGNED)) {
+	if (!(s->flags & SF_ASSIGNED)) {
 		struct server *prev_srv = objt_server(s->target);
 
 		err = assign_server(s);
@@ -855,7 +855,7 @@
 			 * update the stream's and the server's stats :
 			 *  - if the server changed :
 			 *    - set TX_CK_DOWN if txn.flags was TX_CK_VALID
-			 *    - set SN_REDISP if it was successfully redispatched
+			 *    - set SF_REDISP if it was successfully redispatched
 			 *    - increment srv->redispatches and be->redispatches
 			 *  - if the server remained the same : update retries.
 			 */
@@ -865,7 +865,7 @@
 					s->txn.flags &= ~TX_CK_MASK;
 					s->txn.flags |= TX_CK_DOWN;
 				}
-				s->flags |= SN_REDISP;
+				s->flags |= SF_REDISP;
 				prev_srv->counters.redispatches++;
 				s->be->be_counters.redispatches++;
 			} else {
@@ -877,7 +877,7 @@
 
 	switch (err) {
 	case SRV_STATUS_OK:
-		/* we have SN_ASSIGNED set */
+		/* we have SF_ASSIGNED set */
 		srv = objt_server(s->target);
 		if (!srv)
 			return SRV_STATUS_OK;   /* dispatch or proxy mode */
@@ -890,7 +890,7 @@
 		 * connection slot yet. Either it is a redispatch, or it was
 		 * assigned from persistence information (direct mode).
 		 */
-		if ((s->flags & SN_REDIRECTABLE) && srv->rdr_len) {
+		if ((s->flags & SF_REDIRECTABLE) && srv->rdr_len) {
 			/* server scheduled for redirection, and already assigned. We
 			 * don't want to go further nor check the queue.
 			 */
@@ -1004,13 +1004,13 @@
  * (s->target, s->si[1].addr.to). It will assign a server if none
  * is assigned yet.
  * It can return one of :
- *  - SN_ERR_NONE if everything's OK
- *  - SN_ERR_SRVTO if there are no more servers
- *  - SN_ERR_SRVCL if the connection was refused by the server
- *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
- *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
- *  - SN_ERR_INTERNAL for any other purely internal errors
- * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+ *  - SF_ERR_NONE if everything's OK
+ *  - SF_ERR_SRVTO if there are no more servers
+ *  - SF_ERR_SRVCL if the connection was refused by the server
+ *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+ *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+ *  - SF_ERR_INTERNAL for any other purely internal errors
+ * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
  * The server-facing stream interface is expected to hold a pre-allocated connection
  * in s->si[1].conn.
  */
@@ -1045,12 +1045,12 @@
 
 	srv_conn = si_alloc_conn(&s->si[1], reuse);
 	if (!srv_conn)
-		return SN_ERR_RESOURCE;
+		return SF_ERR_RESOURCE;
 
-	if (!(s->flags & SN_ADDR_SET)) {
+	if (!(s->flags & SF_ADDR_SET)) {
 		err = assign_server_address(s);
 		if (err != SRV_STATUS_OK)
-			return SN_ERR_INTERNAL;
+			return SF_ERR_INTERNAL;
 	}
 
 	if (!conn_xprt_ready(srv_conn)) {
@@ -1065,10 +1065,10 @@
 			/* proxies exclusively run on raw_sock right now */
 			conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), &raw_sock);
 			if (!objt_conn(s->si[1].end) || !objt_conn(s->si[1].end)->ctrl)
-				return SN_ERR_INTERNAL;
+				return SF_ERR_INTERNAL;
 		}
 		else
-			return SN_ERR_INTERNAL;  /* how did we get there ? */
+			return SF_ERR_INTERNAL;  /* how did we get there ? */
 
 		/* process the case where the server requires the PROXY protocol to be sent */
 		srv_conn->send_proxy_ofs = 0;
@@ -1086,7 +1086,7 @@
 	else {
 		/* the connection is being reused, just re-attach it */
 		si_attach_conn(&s->si[1], srv_conn);
-		s->flags |= SN_SRV_REUSED;
+		s->flags |= SF_SRV_REUSED;
 	}
 
 	/* flag for logging source ip/port */
@@ -1099,7 +1099,7 @@
 
 	err = si_connect(&s->si[1]);
 
-	if (err != SN_ERR_NONE)
+	if (err != SF_ERR_NONE)
 		return err;
 
 	/* set connect timeout */
@@ -1107,7 +1107,7 @@
 
 	srv = objt_server(s->target);
 	if (srv) {
-		s->flags |= SN_CURR_SESS;
+		s->flags |= SF_CURR_SESS;
 		srv->cur_sess++;
 		if (srv->cur_sess > srv->counters.cur_sess_max)
 			srv->counters.cur_sess_max = srv->cur_sess;
@@ -1115,7 +1115,7 @@
 			s->be->lbprm.server_take_conn(srv);
 	}
 
-	return SN_ERR_NONE;  /* connection is OK */
+	return SF_ERR_NONE;  /* connection is OK */
 }
 
 
@@ -1151,9 +1151,9 @@
 		 * would bring us on the same server again. Note that s->target is set
 		 * in this case.
 		 */
-		if (((s->flags & (SN_DIRECT|SN_FORCE_PRST)) == SN_DIRECT) &&
+		if (((s->flags & (SF_DIRECT|SF_FORCE_PRST)) == SF_DIRECT) &&
 		    (s->be->options & PR_O_REDISP)) {
-			s->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
+			s->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
 			goto redispatch;
 		}
 
@@ -1241,7 +1241,7 @@
 		req->buf->i,
 		req->analysers);
 
-	if (s->flags & SN_ASSIGNED)
+	if (s->flags & SF_ASSIGNED)
 		goto no_cookie;
 
 	memset(&smp, 0, sizeof(smp));
@@ -1268,7 +1268,7 @@
 		    memcmp(&addr, &(srv->addr), sizeof(addr)) == 0) {
 			if ((srv->state != SRV_ST_STOPPED) || (px->options & PR_O_PERSIST)) {
 				/* we found the server and it is usable */
-				s->flags |= SN_DIRECT | SN_ASSIGNED;
+				s->flags |= SF_DIRECT | SF_ASSIGNED;
 				s->target = &srv->obj_type;
 				break;
 			}
diff --git a/src/checks.c b/src/checks.c
index b3a005b..3702d9a 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1389,14 +1389,14 @@
  * establish a server health-check that makes use of a connection.
  *
  * It can return one of :
- *  - SN_ERR_NONE if everything's OK and tcpcheck_main() was not called
- *  - SN_ERR_UP if if everything's OK and tcpcheck_main() was called
- *  - SN_ERR_SRVTO if there are no more servers
- *  - SN_ERR_SRVCL if the connection was refused by the server
- *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
- *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
- *  - SN_ERR_INTERNAL for any other purely internal errors
- * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+ *  - SF_ERR_NONE if everything's OK and tcpcheck_main() was not called
+ *  - SF_ERR_UP if if everything's OK and tcpcheck_main() was called
+ *  - SF_ERR_SRVTO if there are no more servers
+ *  - SF_ERR_SRVCL if the connection was refused by the server
+ *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+ *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+ *  - SF_ERR_INTERNAL for any other purely internal errors
+ * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
  * Note that we try to prevent the network stack from sending the ACK during the
  * connect() when a pure TCP check is used (without PROXY protocol).
  */
@@ -1474,13 +1474,13 @@
 		/* if first step is a 'connect', then tcpcheck_main must run it */
 		if (r->action == TCPCHK_ACT_CONNECT) {
 			tcpcheck_main(conn);
-			return SN_ERR_UP;
+			return SF_ERR_UP;
 		}
 		if (r->action == TCPCHK_ACT_EXPECT)
 			quickack = 0;
 	}
 
-	ret = SN_ERR_INTERNAL;
+	ret = SF_ERR_INTERNAL;
 	if (proto->connect)
 		ret = proto->connect(conn, check->type, quickack ? 2 : 0);
 	conn->flags |= CO_FL_WAKE_DATA;
@@ -1763,13 +1763,13 @@
  * establish a server health-check that makes use of a process.
  *
  * It can return one of :
- *  - SN_ERR_NONE if everything's OK
- *  - SN_ERR_SRVTO if there are no more servers
- *  - SN_ERR_SRVCL if the connection was refused by the server
- *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
- *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
- *  - SN_ERR_INTERNAL for any other purely internal errors
- * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+ *  - SF_ERR_NONE if everything's OK
+ *  - SF_ERR_SRVTO if there are no more servers
+ *  - SF_ERR_SRVCL if the connection was refused by the server
+ *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+ *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+ *  - SF_ERR_INTERNAL for any other purely internal errors
+ * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
  *
  * Blocks and then unblocks SIGCHLD
  */
@@ -1782,7 +1782,7 @@
 	int status;
 	pid_t pid;
 
-	status = SN_ERR_RESOURCE;
+	status = SF_ERR_RESOURCE;
 
 	block_sigchld();
 
@@ -1813,7 +1813,7 @@
 				int t_con = tick_add(now_ms, px->timeout.connect);
 				t->expire = tick_first(t->expire, t_con);
 			}
-			status = SN_ERR_NONE;
+			status = SF_ERR_NONE;
 			goto out;
 		}
 		else {
@@ -1862,9 +1862,9 @@
 
 		ret = connect_proc_chk(t);
 		switch (ret) {
-		case SN_ERR_UP:
+		case SF_ERR_UP:
 			return t;
-		case SN_ERR_NONE:
+		case SF_ERR_NONE:
 			/* we allow up to min(inter, timeout.connect) for a connection
 			 * to establish but only when timeout.check is set
 			 * as it may be to short for a full check otherwise
@@ -1878,14 +1878,14 @@
 
 			goto reschedule;
 
-		case SN_ERR_SRVTO: /* ETIMEDOUT */
-		case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
+		case SF_ERR_SRVTO: /* ETIMEDOUT */
+		case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
 			conn->flags |= CO_FL_ERROR;
 			chk_report_conn_err(conn, errno, 0);
 			break;
-		case SN_ERR_PRXCOND:
-		case SN_ERR_RESOURCE:
-		case SN_ERR_INTERNAL:
+		case SF_ERR_PRXCOND:
+		case SF_ERR_RESOURCE:
+		case SF_ERR_INTERNAL:
 			conn->flags |= CO_FL_ERROR;
 			chk_report_conn_err(conn, 0, 0);
 			break;
@@ -2005,9 +2005,9 @@
 
 		ret = connect_conn_chk(t);
 		switch (ret) {
-		case SN_ERR_UP:
+		case SF_ERR_UP:
 			return t;
-		case SN_ERR_NONE:
+		case SF_ERR_NONE:
 			/* we allow up to min(inter, timeout.connect) for a connection
 			 * to establish but only when timeout.check is set
 			 * as it may be to short for a full check otherwise
@@ -2024,14 +2024,14 @@
 
 			goto reschedule;
 
-		case SN_ERR_SRVTO: /* ETIMEDOUT */
-		case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
+		case SF_ERR_SRVTO: /* ETIMEDOUT */
+		case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
 			conn->flags |= CO_FL_ERROR;
 			chk_report_conn_err(conn, errno, 0);
 			break;
-		case SN_ERR_PRXCOND:
-		case SN_ERR_RESOURCE:
-		case SN_ERR_INTERNAL:
+		case SF_ERR_PRXCOND:
+		case SF_ERR_RESOURCE:
+		case SF_ERR_INTERNAL:
 			conn->flags |= CO_FL_ERROR;
 			chk_report_conn_err(conn, 0, 0);
 			break;
@@ -2532,7 +2532,7 @@
 #endif /* USE_OPENSSL */
 			conn_prepare(conn, proto, xprt);
 
-			ret = SN_ERR_INTERNAL;
+			ret = SF_ERR_INTERNAL;
 			if (proto->connect)
 				ret = proto->connect(conn,
 						     1 /* I/O polling is always needed */,
@@ -2544,18 +2544,18 @@
 			}
 
 			/* It can return one of :
-			 *  - SN_ERR_NONE if everything's OK
-			 *  - SN_ERR_SRVTO if there are no more servers
-			 *  - SN_ERR_SRVCL if the connection was refused by the server
-			 *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
-			 *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
-			 *  - SN_ERR_INTERNAL for any other purely internal errors
-			 * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+			 *  - SF_ERR_NONE if everything's OK
+			 *  - SF_ERR_SRVTO if there are no more servers
+			 *  - SF_ERR_SRVCL if the connection was refused by the server
+			 *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+			 *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+			 *  - SF_ERR_INTERNAL for any other purely internal errors
+			 * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
 			 * Note that we try to prevent the network stack from sending the ACK during the
 			 * connect() when a pure TCP check is used (without PROXY protocol).
 			 */
 			switch (ret) {
-			case SN_ERR_NONE:
+			case SF_ERR_NONE:
 				/* we allow up to min(inter, timeout.connect) for a connection
 				 * to establish but only when timeout.check is set
 				 * as it may be to short for a full check otherwise
@@ -2567,15 +2567,15 @@
 					t->expire = tick_first(t->expire, t_con);
 				}
 				break;
-			case SN_ERR_SRVTO: /* ETIMEDOUT */
-			case SN_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
+			case SF_ERR_SRVTO: /* ETIMEDOUT */
+			case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
 				chunk_printf(&trash, "TCPCHK error establishing connection at step %d: %s",
 						tcpcheck_get_step_id(check), strerror(errno));
 				set_server_check_status(check, HCHK_STATUS_L4CON, trash.str);
 				goto out_end_tcpcheck;
-			case SN_ERR_PRXCOND:
-			case SN_ERR_RESOURCE:
-			case SN_ERR_INTERNAL:
+			case SF_ERR_PRXCOND:
+			case SF_ERR_RESOURCE:
+			case SF_ERR_INTERNAL:
 				chunk_printf(&trash, "TCPCHK error establishing connection at step %d",
 						tcpcheck_get_step_id(check));
 				set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 5f663b6..62f3dd9 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -2008,7 +2008,7 @@
 				return 1;
 			}
 
-			stream_shutdown(sess, SN_ERR_KILLED);
+			stream_shutdown(sess, SF_ERR_KILLED);
 			return 1;
 		}
 		else if (strcmp(args[1], "sessions") == 0) {
@@ -2023,7 +2023,7 @@
 				/* kill all the stream that are on this server */
 				list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
 					if (sess->srv_conn == sv)
-						stream_shutdown(sess, SN_ERR_KILLED);
+						stream_shutdown(sess, SF_ERR_KILLED);
 
 				return 1;
 			}
@@ -4674,7 +4674,7 @@
 
 							list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
 								if (sess->srv_conn == sv)
-									stream_shutdown(sess, SN_ERR_KILLED);
+									stream_shutdown(sess, SF_ERR_KILLED);
 
 							altered_servers++;
 							total_servers++;
diff --git a/src/hlua.c b/src/hlua.c
index 4b04f87..a13b8ce 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1351,7 +1351,7 @@
 
 	/* Remove all reference between the Lua stack and the coroutine stream. */
 	appctx = objt_appctx(socket->s->si[0].end);
-	stream_shutdown(socket->s, SN_ERR_KILLED);
+	stream_shutdown(socket->s, SF_ERR_KILLED);
 	socket->s = NULL;
 	appctx->ctx.hlua.socket = NULL;
 
@@ -1373,7 +1373,7 @@
 		return 0;
 
 	/* Close the stream and remove the associated stop task. */
-	stream_shutdown(socket->s, SN_ERR_KILLED);
+	stream_shutdown(socket->s, SF_ERR_KILLED);
 	appctx = objt_appctx(socket->s->si[0].end);
 	appctx->ctx.hlua.socket = NULL;
 	socket->s = NULL;
@@ -2204,7 +2204,7 @@
 	socket->s->si[1].conn_retries = socket_proxy.conn_retries;
 
 	/* Force destination server. */
-	socket->s->flags |= SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET | SN_BE_ASSIGNED;
+	socket->s->flags |= SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET | SF_BE_ASSIGNED;
 	socket->s->target = &socket_tcp.obj_type;
 
 	/* This stream is added to te lists of alive streams. */
diff --git a/src/log.c b/src/log.c
index f9c78a2..c4daa81 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1335,15 +1335,15 @@
 				break;
 
 			case LOG_FMT_TERMSTATE: // %ts
-				LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]);
-				LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]);
+				LOGCHAR(sess_term_cond[(s->flags & SF_ERR_MASK) >> SF_ERR_SHIFT]);
+				LOGCHAR(sess_fin_state[(s->flags & SF_FINST_MASK) >> SF_FINST_SHIFT]);
 				*tmplog = '\0';
 				last_isspace = 0;
 				break;
 
 			case LOG_FMT_TERMSTATE_CK: // %tsc, same as TS with cookie state (for mode HTTP)
-				LOGCHAR(sess_term_cond[(s->flags & SN_ERR_MASK) >> SN_ERR_SHIFT]);
-				LOGCHAR(sess_fin_state[(s->flags & SN_FINST_MASK) >> SN_FINST_SHIFT]);
+				LOGCHAR(sess_term_cond[(s->flags & SF_ERR_MASK) >> SF_ERR_SHIFT]);
+				LOGCHAR(sess_fin_state[(s->flags & SF_FINST_MASK) >> SF_FINST_SHIFT]);
 				LOGCHAR((be->ck_opts & PR_CK_ANY) ? sess_cookie[(txn->flags & TX_CK_MASK) >> TX_CK_SHIFT] : '-');
 				LOGCHAR((be->ck_opts & PR_CK_ANY) ? sess_set_cookie[(txn->flags & TX_SCK_MASK) >> TX_SCK_SHIFT] : '-');
 				last_isspace = 0;
@@ -1384,7 +1384,7 @@
 				break;
 
 			case LOG_FMT_RETRIES:  // %rq
-				if (s->flags & SN_REDISP)
+				if (s->flags & SF_REDISP)
 					LOGCHAR('+');
 				ret = ltoa_o((s->si[1].conn_retries>0) ?
 				                (be->conn_retries - s->si[1].conn_retries) :
@@ -1608,9 +1608,9 @@
 	int size, err, level;
 
 	/* if we don't want to log normal traffic, return now */
-	err = (s->flags & SN_REDISP) ||
-              ((s->flags & SN_ERR_MASK) > SN_ERR_LOCAL) ||
-	      (((s->flags & SN_ERR_MASK) == SN_ERR_NONE) &&
+	err = (s->flags & SF_REDISP) ||
+              ((s->flags & SF_ERR_MASK) > SF_ERR_LOCAL) ||
+	      (((s->flags & SF_ERR_MASK) == SF_ERR_NONE) &&
 	       (s->si[1].conn_retries != s->be->conn_retries)) ||
 	      ((s->fe->mode == PR_MODE_HTTP) && s->txn.status >= 500);
 
diff --git a/src/peers.c b/src/peers.c
index a2f29d2..6df3ce7 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1125,7 +1125,7 @@
 	LIST_INIT(&s->back_refs);
 	LIST_INIT(&s->buffer_wait);
 
-	s->flags = SN_ASSIGNED|SN_ADDR_SET;
+	s->flags = SF_ASSIGNED|SF_ADDR_SET;
 
 	/* if this session comes from a known monitoring system, we want to ignore
 	 * it as soon as possible, which means closing it immediately for TCP.
diff --git a/src/proto_http.c b/src/proto_http.c
index 2df2ce8..0abba2f 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -836,9 +836,9 @@
 		s->txn.status = status;
 		bo_inject(si_ic(si), msg->str, msg->len);
 	}
-	if (!(s->flags & SN_ERR_MASK))
+	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= err;
-	if (!(s->flags & SN_FINST_MASK))
+	if (!(s->flags & SF_FINST_MASK))
 		s->flags |= finst;
 }
 
@@ -1032,7 +1032,7 @@
 	si->state    = SI_ST_CLO;
 
 	/* send the message */
-	http_server_error(s, si, SN_ERR_LOCAL, SN_FINST_C, 302, &trash);
+	http_server_error(s, si, SF_ERR_LOCAL, SF_FINST_C, 302, &trash);
 
 	/* FIXME: we should increase a counter of redirects per server and per backend. */
 	srv_inc_sess_ctr(srv);
@@ -1055,32 +1055,32 @@
 	int err_type = si->err_type;
 
 	if (err_type & SI_ET_QUEUE_ABRT)
-		http_server_error(s, si, SN_ERR_CLICL, SN_FINST_Q,
+		http_server_error(s, si, SF_ERR_CLICL, SF_FINST_Q,
 				  503, http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_CONN_ABRT)
-		http_server_error(s, si, SN_ERR_CLICL, SN_FINST_C,
+		http_server_error(s, si, SF_ERR_CLICL, SF_FINST_C,
 				  503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
 				  http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_QUEUE_TO)
-		http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_Q,
+		http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_Q,
 				  503, http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_QUEUE_ERR)
-		http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_Q,
+		http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_Q,
 				  503, http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_CONN_TO)
-		http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_C,
+		http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_C,
 				  503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
 				  http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_CONN_ERR)
-		http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_C,
-				  503, (s->flags & SN_SRV_REUSED) ? NULL :
+		http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_C,
+				  503, (s->flags & SF_SRV_REUSED) ? NULL :
 				  http_error_message(s, HTTP_ERR_503));
 	else if (err_type & SI_ET_CONN_RES)
-		http_server_error(s, si, SN_ERR_RESOURCE, SN_FINST_C,
+		http_server_error(s, si, SF_ERR_RESOURCE, SF_FINST_C,
 				  503, (s->txn.flags & TX_NOT_FIRST) ? NULL :
 				  http_error_message(s, HTTP_ERR_503));
 	else /* SI_ET_CONN_OTHER and others */
-		http_server_error(s, si, SN_ERR_INTERNAL, SN_FINST_C,
+		http_server_error(s, si, SF_ERR_INTERNAL, SF_FINST_C,
 				  500, http_error_message(s, HTTP_ERR_500));
 }
 
@@ -2428,7 +2428,7 @@
 	if (s->comp_algo->init(&s->comp_ctx, global.tune.comp_maxlevel) < 0)
 		goto fail;
 
-	s->flags |= SN_COMP_READY;
+	s->flags |= SF_COMP_READY;
 
 	/* remove Content-Length header */
 	ctx.idx = 0;
@@ -2539,7 +2539,7 @@
 	 *   msg->next          = first non-visited byte
 	 *
 	 * At end of parsing, we may perform a capture of the error (if any), and
-	 * we will set a few fields (txn->meth, sn->flags/SN_REDIRECTABLE).
+	 * we will set a few fields (txn->meth, sn->flags/SF_REDIRECTABLE).
 	 * We also check for monitor-uri, logging, HTTP/0.9 to 1.0 conversion, and
 	 * finally headers capture.
 	 */
@@ -2682,8 +2682,8 @@
 
 		/* 2: have we encountered a read error ? */
 		else if (req->flags & CF_READ_ERROR) {
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_CLICL;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_CLICL;
 
 			if (txn->flags & TX_WAIT_NEXT_RQ)
 				goto failed_keep_alive;
@@ -2705,15 +2705,15 @@
 			if (s->listener->counters)
 				s->listener->counters->failed_req++;
 
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_R;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_R;
 			return 0;
 		}
 
 		/* 3: has the read timeout expired ? */
 		else if (req->flags & CF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_CLITO;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_CLITO;
 
 			if (txn->flags & TX_WAIT_NEXT_RQ)
 				goto failed_keep_alive;
@@ -2734,15 +2734,15 @@
 			if (s->listener->counters)
 				s->listener->counters->failed_req++;
 
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_R;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_R;
 			return 0;
 		}
 
 		/* 4: have we encountered a close ? */
 		else if (req->flags & CF_SHUTR) {
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_CLICL;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_CLICL;
 
 			if (txn->flags & TX_WAIT_NEXT_RQ)
 				goto failed_keep_alive;
@@ -2761,8 +2761,8 @@
 			if (s->listener->counters)
 				s->listener->counters->failed_req++;
 
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_R;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_R;
 			return 0;
 		}
 
@@ -2849,7 +2849,7 @@
 
 	/* we can make use of server redirect on GET and HEAD */
 	if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
-		s->flags |= SN_REDIRECTABLE;
+		s->flags |= SF_REDIRECTABLE;
 
 	/*
 	 * 2: check if the URI matches the monitor_uri.
@@ -2866,7 +2866,7 @@
 		 */
 		struct acl_cond *cond;
 
-		s->flags |= SN_MONITOR;
+		s->flags |= SF_MONITOR;
 		s->fe->fe_counters.intercepted_req++;
 
 		/* Check if we want to fail this monitor request or not */
@@ -2881,8 +2881,8 @@
 				/* we fail this request, let's return 503 service unavail */
 				txn->status = 503;
 				stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_503));
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_LOCAL; /* we don't want a real error here */
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
 				goto return_prx_cond;
 			}
 		}
@@ -2890,8 +2890,8 @@
 		/* nothing to fail, let's reply normaly */
 		txn->status = 200;
 		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_200));
-		if (!(s->flags & SN_ERR_MASK))
-			s->flags |= SN_ERR_LOCAL; /* we don't want a real error here */
+		if (!(s->flags & SF_ERR_MASK))
+			s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
 		goto return_prx_cond;
 	}
 
@@ -3075,10 +3075,10 @@
 		s->listener->counters->failed_req++;
 
  return_prx_cond:
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 
 	req->analysers = 0;
 	req->analyse_exp = TICK_ETERNITY;
@@ -4048,10 +4048,10 @@
 		txn->req.chn->analysers = 0;
 	}
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_LOCAL;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_LOCAL;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 
 	return 1;
 }
@@ -4129,8 +4129,8 @@
 			s->logs.tv_request = now;
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_RESOURCE;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_RESOURCE;
 			goto return_prx_cond;
 		}
 
@@ -4180,10 +4180,10 @@
 		if (s->fe == s->be) /* report it if the request was intercepted by the frontend */
 			s->fe->fe_counters.intercepted_req++;
 
-		if (!(s->flags & SN_ERR_MASK))      // this is not really an error but it is
-			s->flags |= SN_ERR_LOCAL;   // to mark that it comes from the proxy
-		if (!(s->flags & SN_FINST_MASK))
-			s->flags |= SN_FINST_R;
+		if (!(s->flags & SF_ERR_MASK))      // this is not really an error but it is
+			s->flags |= SF_ERR_LOCAL;   // to mark that it comes from the proxy
+		if (!(s->flags & SF_FINST_MASK))
+			s->flags |= SF_FINST_R;
 
 		/* we may want to compress the stats page */
 		if (s->fe->comp || s->be->comp)
@@ -4284,10 +4284,10 @@
 		s->listener->counters->failed_req++;
 
  return_prx_cond:
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 
 	req->analysers = 0;
 	req->analyse_exp = TICK_ETERNITY;
@@ -4339,7 +4339,7 @@
 	 * incoming request. Note that this requires that a connection is
 	 * allocated on the server side.
 	 */
-	if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SN_ADDR_SET)) {
+	if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SF_ADDR_SET)) {
 		struct connection *conn;
 		char *path;
 
@@ -4350,10 +4350,10 @@
 			req->analysers = 0;
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_RESOURCE;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_R;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_RESOURCE;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_R;
 
 			return 0;
 		}
@@ -4408,7 +4408,7 @@
 	 */
 
 	/* It needs to look into the URI unless persistence must be ignored */
-	if ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SN_IGNORE_PRST)) {
+	if ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SF_IGNORE_PRST)) {
 		get_srv_from_appsession(s, req->buf->p + msg->sl.rq.u, msg->sl.rq.u_l);
 	}
 
@@ -4582,7 +4582,7 @@
 	 * with a POST request, we may be interested in checking the body for
 	 * that parameter. This will be done in another analyser.
 	 */
-	if (!(s->flags & (SN_ASSIGNED|SN_DIRECT)) &&
+	if (!(s->flags & (SF_ASSIGNED|SF_DIRECT)) &&
 	    s->txn.meth == HTTP_METH_POST && s->be->url_param_name != NULL &&
 	    (msg->flags & (HTTP_MSGF_CNT_LEN|HTTP_MSGF_TE_CHNK))) {
 		channel_dont_connect(req);
@@ -4639,10 +4639,10 @@
 	if (s->listener->counters)
 		s->listener->counters->failed_req++;
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 	return 0;
 }
 
@@ -4679,10 +4679,10 @@
 	req->analysers = 0;
 	req->analyse_exp = TICK_ETERNITY;
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_T;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_T;
 	return 0;
 }
 
@@ -4787,10 +4787,10 @@
 		txn->status = 408;
 		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_408));
 
-		if (!(s->flags & SN_ERR_MASK))
-			s->flags |= SN_ERR_CLITO;
-		if (!(s->flags & SN_FINST_MASK))
-			s->flags |= SN_FINST_D;
+		if (!(s->flags & SF_ERR_MASK))
+			s->flags |= SF_ERR_CLITO;
+		if (!(s->flags & SF_FINST_MASK))
+			s->flags |= SF_FINST_D;
 		goto return_err_msg;
 	}
 
@@ -4820,10 +4820,10 @@
 	txn->status = 400;
 	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 
  return_err_msg:
 	req->analysers = 0;
@@ -4911,7 +4911,7 @@
 		si_shutw(&s->si[1]);
 	}
 
-	if (s->flags & SN_BE_ASSIGNED) {
+	if (s->flags & SF_BE_ASSIGNED) {
 		s->be->beconn--;
 		if (unlikely(s->srv_conn))
 			sess_change_server(s, NULL);
@@ -4929,14 +4929,14 @@
 
 		if (s->fe->mode == PR_MODE_HTTP) {
 			s->fe->fe_counters.p.http.rsp[n]++;
-			if (s->comp_algo && (s->flags & SN_COMP_READY))
+			if (s->comp_algo && (s->flags & SF_COMP_READY))
 				s->fe->fe_counters.p.http.comp_rsp++;
 		}
-		if ((s->flags & SN_BE_ASSIGNED) &&
+		if ((s->flags & SF_BE_ASSIGNED) &&
 		    (s->be->mode == PR_MODE_HTTP)) {
 			s->be->be_counters.p.http.rsp[n]++;
 			s->be->be_counters.p.http.cum_req++;
-			if (s->comp_algo && (s->flags & SN_COMP_READY))
+			if (s->comp_algo && (s->flags & SF_COMP_READY))
 				s->be->be_counters.p.http.comp_rsp++;
 		}
 	}
@@ -4947,7 +4947,7 @@
 
 	/* let's do a final log if we need it */
 	if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
-	    !(s->flags & SN_MONITOR) &&
+	    !(s->flags & SF_MONITOR) &&
 	    (!(s->fe->options & PR_O_NULLNOLOG) || s->req.total)) {
 		s->do_log(s);
 	}
@@ -4973,8 +4973,8 @@
 		pendconn_free(s->pend_pos);
 
 	if (objt_server(s->target)) {
-		if (s->flags & SN_CURR_SESS) {
-			s->flags &= ~SN_CURR_SESS;
+		if (s->flags & SF_CURR_SESS) {
+			s->flags &= ~SF_CURR_SESS;
 			objt_server(s->target)->cur_sess--;
 		}
 		if (may_dequeue_tasks(objt_server(s->target), s->be))
@@ -4998,9 +4998,9 @@
 	s->si[1].flags    &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */
 	s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WAKE_CONNECT|CF_WROTE_DATA);
 	s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA);
-	s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
-	s->flags &= ~(SN_CURR_SESS|SN_REDIRECTABLE|SN_SRV_REUSED);
-	s->flags &= ~(SN_ERR_MASK|SN_FINST_MASK|SN_REDISP);
+	s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_ADDR_SET|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST);
+	s->flags &= ~(SF_CURR_SESS|SF_REDIRECTABLE|SF_SRV_REUSED);
+	s->flags &= ~(SF_ERR_MASK|SF_FINST_MASK|SF_REDISP);
 
 	s->txn.meth = 0;
 	http_reset_txn(s);
@@ -5601,13 +5601,13 @@
 
 	/* stop waiting for data if the input is closed before the end */
 	if (req->flags & CF_SHUTR) {
-		if (!(s->flags & SN_ERR_MASK))
-			s->flags |= SN_ERR_CLICL;
-		if (!(s->flags & SN_FINST_MASK)) {
+		if (!(s->flags & SF_ERR_MASK))
+			s->flags |= SF_ERR_CLICL;
+		if (!(s->flags & SF_FINST_MASK)) {
 			if (txn->rsp.msg_state < HTTP_MSG_ERROR)
-				s->flags |= SN_FINST_H;
+				s->flags |= SF_FINST_H;
 			else
-				s->flags |= SN_FINST_D;
+				s->flags |= SF_FINST_D;
 		}
 
 		s->fe->fe_counters.cli_aborts++;
@@ -5662,13 +5662,13 @@
 	req->analysers = 0;
 	s->res.analysers = 0; /* we're in data phase, we want to abort both directions */
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK)) {
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK)) {
 		if (txn->rsp.msg_state < HTTP_MSG_ERROR)
-			s->flags |= SN_FINST_H;
+			s->flags |= SF_FINST_H;
 		else
-			s->flags |= SN_FINST_D;
+			s->flags |= SF_FINST_D;
 	}
 	return 0;
 
@@ -5689,13 +5689,13 @@
 	if (objt_server(s->target))
 		objt_server(s->target)->counters.srv_aborts++;
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_SRVCL;
-	if (!(s->flags & SN_FINST_MASK)) {
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_SRVCL;
+	if (!(s->flags & SF_FINST_MASK)) {
 		if (txn->rsp.msg_state < HTTP_MSG_ERROR)
-			s->flags |= SN_FINST_H;
+			s->flags |= SF_FINST_H;
 		else
-			s->flags |= SN_FINST_D;
+			s->flags |= SF_FINST_D;
 	}
 	return 0;
 }
@@ -5823,10 +5823,10 @@
 			channel_truncate(rep);
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_PRXCOND;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_PRXCOND;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 
 			return 0;
 		}
@@ -5858,10 +5858,10 @@
 			channel_truncate(rep);
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_SRVCL;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_SRVCL;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 			return 0;
 		}
 
@@ -5885,10 +5885,10 @@
 			channel_truncate(rep);
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_504));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_SRVTO;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_SRVTO;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 			return 0;
 		}
 
@@ -5906,10 +5906,10 @@
 			channel_truncate(rep);
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_CLICL;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_CLICL;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 
 			/* process_stream() will take care of the error */
 			return 0;
@@ -5935,10 +5935,10 @@
 			channel_truncate(rep);
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_SRVCL;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_SRVCL;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 			return 0;
 		}
 
@@ -5953,10 +5953,10 @@
 			rep->analysers = 0;
 			channel_auto_close(rep);
 
-			if (!(s->flags & SN_ERR_MASK))
-				s->flags |= SN_ERR_CLICL;
-			if (!(s->flags & SN_FINST_MASK))
-				s->flags |= SN_FINST_H;
+			if (!(s->flags & SF_ERR_MASK))
+				s->flags |= SF_ERR_CLICL;
+			if (!(s->flags & SF_FINST_MASK))
+				s->flags |= SF_FINST_H;
 
 			/* process_stream() will take care of the error */
 			return 0;
@@ -6354,10 +6354,10 @@
 				s->si[1].flags |= SI_FL_NOLINGER;
 				channel_truncate(rep);
 				stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_PRXCOND;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_H;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_PRXCOND;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_H;
 				return 0;
 			}
 		}
@@ -6428,13 +6428,13 @@
 	 */
 	if (objt_server(s->target) && (s->be->ck_opts & PR_CK_INS) &&
 	    !((txn->flags & TX_SCK_FOUND) && (s->be->ck_opts & PR_CK_PSV)) &&
-	    (!(s->flags & SN_DIRECT) ||
+	    (!(s->flags & SF_DIRECT) ||
 	     ((s->be->cookie_maxidle || txn->cookie_last_date) &&
 	      (!txn->cookie_last_date || (txn->cookie_last_date - date.tv_sec) < 0)) ||
 	     (s->be->cookie_maxlife && !txn->cookie_first_date) ||  // set the first_date
 	     (!s->be->cookie_maxlife && txn->cookie_first_date)) && // remove the first_date
 	    (!(s->be->ck_opts & PR_CK_POST) || (txn->meth == HTTP_METH_POST)) &&
-	    !(s->flags & SN_IGNORE_PRST)) {
+	    !(s->flags & SF_IGNORE_PRST)) {
 		/* the server is known, it's not the one the client requested, or the
 		 * cookie's last seen date needs to be refreshed. We have to
 		 * insert a set-cookie here, except if we want to insert only on POST
@@ -6482,7 +6482,7 @@
 			goto return_bad_resp;
 
 		txn->flags &= ~TX_SCK_MASK;
-		if (objt_server(s->target)->cookie && (s->flags & SN_DIRECT))
+		if (objt_server(s->target)->cookie && (s->flags & SF_DIRECT))
 			/* the server did not change, only the date was updated */
 			txn->flags |= TX_SCK_UPDATED;
 		else
@@ -6832,8 +6832,8 @@
 	if (res->flags & CF_SHUTR) {
 		if ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))
 			goto aborted_xfer;
-		if (!(s->flags & SN_ERR_MASK))
-			s->flags |= SN_ERR_SRVCL;
+		if (!(s->flags & SF_ERR_MASK))
+			s->flags |= SF_ERR_SRVCL;
 		s->be->be_counters.srv_aborts++;
 		if (objt_server(s->target))
 			objt_server(s->target)->counters.srv_aborts++;
@@ -6893,10 +6893,10 @@
 	if (objt_server(s->target))
 		health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_PRXCOND;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_D;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_PRXCOND;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_D;
 	return 0;
 
  aborted_xfer:
@@ -6916,10 +6916,10 @@
 	if (objt_server(s->target))
 		objt_server(s->target)->counters.cli_aborts++;
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_CLICL;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_D;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_CLICL;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_D;
 	return 0;
 }
 
@@ -7242,11 +7242,11 @@
 				if (strcmp(srv->id, asession->serverid) == 0) {
 					if ((srv->state != SRV_ST_STOPPED) ||
 					    (s->be->options & PR_O_PERSIST) ||
-					    (s->flags & SN_FORCE_PRST)) {
+					    (s->flags & SF_FORCE_PRST)) {
 						/* we found the server and it's usable */
 						txn->flags &= ~TX_CK_MASK;
 						txn->flags |= (srv->state != SRV_ST_STOPPED) ? TX_CK_VALID : TX_CK_DOWN;
-						s->flags |= SN_DIRECT | SN_ASSIGNED;
+						s->flags |= SF_DIRECT | SF_ASSIGNED;
 						s->target = &srv->obj_type;
 
 						break;
@@ -7644,7 +7644,7 @@
 				 * empty cookies and mark them as invalid.
 				 * The same behaviour is applied when persistence must be ignored.
 				 */
-				if ((delim == val_beg) || (s->flags & (SN_IGNORE_PRST | SN_ASSIGNED)))
+				if ((delim == val_beg) || (s->flags & (SF_IGNORE_PRST | SF_ASSIGNED)))
 					srv = NULL;
 
 				while (srv) {
@@ -7652,11 +7652,11 @@
 					    !memcmp(val_beg, srv->cookie, delim - val_beg)) {
 						if ((srv->state != SRV_ST_STOPPED) ||
 						    (s->be->options & PR_O_PERSIST) ||
-						    (s->flags & SN_FORCE_PRST)) {
+						    (s->flags & SF_FORCE_PRST)) {
 							/* we found the server and we can use it */
 							txn->flags &= ~TX_CK_MASK;
 							txn->flags |= (srv->state != SRV_ST_STOPPED) ? TX_CK_VALID : TX_CK_DOWN;
-							s->flags |= SN_DIRECT | SN_ASSIGNED;
+							s->flags |= SF_DIRECT | SF_ASSIGNED;
 							s->target = &srv->obj_type;
 							break;
 						} else {
@@ -7674,7 +7674,7 @@
 				if (!srv && !(txn->flags & (TX_CK_DOWN|TX_CK_EXPIRED|TX_CK_OLD))) {
 					/* no server matched this cookie or we deliberately skipped it */
 					txn->flags &= ~TX_CK_MASK;
-					if ((s->flags & (SN_IGNORE_PRST | SN_ASSIGNED)))
+					if ((s->flags & (SF_IGNORE_PRST | SF_ASSIGNED)))
 						txn->flags |= TX_CK_UNUSED;
 					else
 						txn->flags |= TX_CK_INVALID;
@@ -7731,7 +7731,7 @@
 			}
 
 			/* Look for the appsession cookie unless persistence must be ignored */
-			if (!(s->flags & SN_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
+			if (!(s->flags & SF_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
 				int cmp_len, value_len;
 				char *value_begin;
 
@@ -8220,7 +8220,7 @@
 
 			srv = objt_server(s->target);
 			/* now check if we need to process it for persistence */
-			if (!(s->flags & SN_IGNORE_PRST) &&
+			if (!(s->flags & SF_IGNORE_PRST) &&
 			    (att_end - att_beg == s->be->cookie_len) && (s->be->cookie_name != NULL) &&
 			    (memcmp(att_beg, s->be->cookie_name, att_end - att_beg) == 0)) {
 				/* assume passive cookie by default */
@@ -8238,7 +8238,7 @@
 					 */
 				}
 				else if ((srv && (s->be->ck_opts & PR_CK_INS)) ||
-				    ((s->flags & SN_DIRECT) && (s->be->ck_opts & PR_CK_IND))) {
+				    ((s->flags & SF_DIRECT) && (s->be->ck_opts & PR_CK_IND))) {
 					/* this cookie must be deleted */
 					if (*prev == ':' && next == hdr_end) {
 						/* whole header */
@@ -8296,7 +8296,7 @@
 				}
 			}
 			/* next, let's see if the cookie is our appcookie, unless persistence must be ignored */
-			else if (!(s->flags & SN_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
+			else if (!(s->flags & SF_IGNORE_PRST) && (s->be->appsession_name != NULL)) {
 				int cmp_len, value_len;
 				char *value_begin;
 
@@ -8822,10 +8822,10 @@
 	struct http_txn *txn = &s->txn;
 
 	/* release any possible compression context */
-	if (s->flags & SN_COMP_READY)
+	if (s->flags & SF_COMP_READY)
 		s->comp_algo->end(&s->comp_ctx);
 	s->comp_algo = NULL;
-	s->flags &= ~SN_COMP_READY;
+	s->flags &= ~SF_COMP_READY;
 
 	/* these ones will have been dynamically allocated */
 	pool_free2(pool2_requri, txn->uri);
@@ -9917,7 +9917,7 @@
 
 			txn->meth = find_http_meth(msg->chn->buf->p, msg->sl.rq.m_l);
 			if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
-				s->flags |= SN_REDIRECTABLE;
+				s->flags |= SF_REDIRECTABLE;
 
 			if (unlikely(msg->sl.rq.v_l == 0) && !http_upgrade_v09_to_v10(txn))
 				return 0;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 83669f3..1c2cb8a 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -357,15 +357,15 @@
  * Note that a pending send_proxy message accounts for data.
  *
  * It can return one of :
- *  - SN_ERR_NONE if everything's OK
- *  - SN_ERR_SRVTO if there are no more servers
- *  - SN_ERR_SRVCL if the connection was refused by the server
- *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
- *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
- *  - SN_ERR_INTERNAL for any other purely internal errors
- * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+ *  - SF_ERR_NONE if everything's OK
+ *  - SF_ERR_SRVTO if there are no more servers
+ *  - SF_ERR_SRVCL if the connection was refused by the server
+ *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+ *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+ *  - SF_ERR_INTERNAL for any other purely internal errors
+ * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
  *
- * The connection's fd is inserted only when SN_ERR_NONE is returned, otherwise
+ * The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise
  * it's invalid and the caller has nothing to do.
  */
 
@@ -389,7 +389,7 @@
 		break;
 	default:
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_INTERNAL;
+		return SF_ERR_INTERNAL;
 	}
 
 	fd = conn->t.sock.fd = create_server_socket(conn);
@@ -423,7 +423,7 @@
 
 		/* this is a resource error */
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_RESOURCE;
+		return SF_ERR_RESOURCE;
 	}
 
 	if (fd >= global.maxsock) {
@@ -434,7 +434,7 @@
 		close(fd);
 		conn->err_code = CO_ER_CONF_FDLIM;
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_PRXCOND; /* it is a configuration limit */
+		return SF_ERR_PRXCOND; /* it is a configuration limit */
 	}
 
 	if ((fcntl(fd, F_SETFL, O_NONBLOCK)==-1) ||
@@ -443,7 +443,7 @@
 		close(fd);
 		conn->err_code = CO_ER_SOCK_ERR;
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_INTERNAL;
+		return SF_ERR_INTERNAL;
 	}
 
 	if (be->options & PR_O_TCP_SRV_KA)
@@ -539,7 +539,7 @@
 					 be->id);
 			}
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_RESOURCE;
+			return SF_ERR_RESOURCE;
 		}
 	}
 
@@ -578,7 +578,7 @@
 			close(fd);
 			send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg);
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_RESOURCE;
+			return SF_ERR_RESOURCE;
 		} else if (errno == ETIMEDOUT) {
 			//qfprintf(stderr,"Connect(): ETIMEDOUT");
 			port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
@@ -586,7 +586,7 @@
 			close(fd);
 			conn->err_code = CO_ER_SOCK_ERR;
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_SRVTO;
+			return SF_ERR_SRVTO;
 		} else {
 			// (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM)
 			//qfprintf(stderr,"Connect(): %d", errno);
@@ -595,7 +595,7 @@
 			close(fd);
 			conn->err_code = CO_ER_SOCK_ERR;
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_SRVCL;
+			return SF_ERR_SRVCL;
 		}
 	}
 
@@ -612,13 +612,13 @@
 	if (conn_xprt_init(conn) < 0) {
 		conn_force_close(conn);
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_RESOURCE;
+		return SF_ERR_RESOURCE;
 	}
 
 	if (data)
 		conn_data_want_send(conn);  /* prepare to send data if any */
 
-	return SN_ERR_NONE;  /* connection is OK */
+	return SF_ERR_NONE;  /* connection is OK */
 }
 
 
@@ -1157,10 +1157,10 @@
 				if (s->listener->counters)
 					s->listener->counters->denied_req++;
 
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_PRXCOND;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_R;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_PRXCOND;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_R;
 				return 0;
 			}
 			else if (rule->action >= TCP_ACT_TRK_SC0 && rule->action <= TCP_ACT_TRK_SCMAX) {
@@ -1318,10 +1318,10 @@
 				if (s->listener->counters)
 					s->listener->counters->denied_resp++;
 
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_PRXCOND;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_D;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_PRXCOND;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_D;
 				return 0;
 			}
 			else if (rule->action == TCP_ACT_CLOSE) {
@@ -1387,10 +1387,10 @@
 				if (s->listener->counters)
 					s->listener->counters->denied_conn++;
 
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_PRXCOND;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_R;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_PRXCOND;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_R;
 				result = 0;
 				break;
 			}
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index adc1b46..7cc63c0 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -401,15 +401,15 @@
  * Note that a pending send_proxy message accounts for data.
  *
  * It can return one of :
- *  - SN_ERR_NONE if everything's OK
- *  - SN_ERR_SRVTO if there are no more servers
- *  - SN_ERR_SRVCL if the connection was refused by the server
- *  - SN_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
- *  - SN_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
- *  - SN_ERR_INTERNAL for any other purely internal errors
- * Additionnally, in the case of SN_ERR_RESOURCE, an emergency log will be emitted.
+ *  - SF_ERR_NONE if everything's OK
+ *  - SF_ERR_SRVTO if there are no more servers
+ *  - SF_ERR_SRVCL if the connection was refused by the server
+ *  - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
+ *  - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
+ *  - SF_ERR_INTERNAL for any other purely internal errors
+ * Additionnally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
  *
- * The connection's fd is inserted only when SN_ERR_NONE is returned, otherwise
+ * The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise
  * it's invalid and the caller has nothing to do.
  */
 int uxst_connect_server(struct connection *conn, int data, int delack)
@@ -431,7 +431,7 @@
 		break;
 	default:
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_INTERNAL;
+		return SF_ERR_INTERNAL;
 	}
 
 	if ((fd = conn->t.sock.fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
@@ -463,7 +463,7 @@
 
 		/* this is a resource error */
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_RESOURCE;
+		return SF_ERR_RESOURCE;
 	}
 
 	if (fd >= global.maxsock) {
@@ -474,7 +474,7 @@
 		close(fd);
 		conn->err_code = CO_ER_CONF_FDLIM;
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_PRXCOND; /* it is a configuration limit */
+		return SF_ERR_PRXCOND; /* it is a configuration limit */
 	}
 
 	if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
@@ -482,7 +482,7 @@
 		close(fd);
 		conn->err_code = CO_ER_SOCK_ERR;
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_INTERNAL;
+		return SF_ERR_INTERNAL;
 	}
 
 	/* if a send_proxy is there, there are data */
@@ -516,19 +516,19 @@
 			close(fd);
 			send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg);
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_RESOURCE;
+			return SF_ERR_RESOURCE;
 		}
 		else if (errno == ETIMEDOUT) {
 			close(fd);
 			conn->err_code = CO_ER_SOCK_ERR;
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_SRVTO;
+			return SF_ERR_SRVTO;
 		}
 		else {	// (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM)
 			close(fd);
 			conn->err_code = CO_ER_SOCK_ERR;
 			conn->flags |= CO_FL_ERROR;
-			return SN_ERR_SRVCL;
+			return SF_ERR_SRVCL;
 		}
 	}
 	else {
@@ -556,13 +556,13 @@
 	if (conn_xprt_init(conn) < 0) {
 		conn_force_close(conn);
 		conn->flags |= CO_FL_ERROR;
-		return SN_ERR_RESOURCE;
+		return SF_ERR_RESOURCE;
 	}
 
 	if (data)
 		conn_data_want_send(conn);  /* prepare to send data if any */
 
-	return SN_ERR_NONE;  /* connection is OK */
+	return SF_ERR_NONE;  /* connection is OK */
 }
 
 
diff --git a/src/proxy.c b/src/proxy.c
index df8bc1e..dfe01ff 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -920,13 +920,13 @@
 
 /* Set current stream's backend to <be>. Nothing is done if the
  * stream already had a backend assigned, which is indicated by
- * s->flags & SN_BE_ASSIGNED.
+ * s->flags & SF_BE_ASSIGNED.
  * All flags, stats and counters which need be updated are updated.
  * Returns 1 if done, 0 in case of internal error, eg: lack of resource.
  */
 int stream_set_backend(struct stream *s, struct proxy *be)
 {
-	if (s->flags & SN_BE_ASSIGNED)
+	if (s->flags & SF_BE_ASSIGNED)
 		return 1;
 	s->be = be;
 	be->beconn++;
@@ -941,7 +941,7 @@
 
 	if (be->options2 & PR_O2_RSPBUG_OK)
 		s->txn.rsp.err_pos = -1; /* let buggy responses pass */
-	s->flags |= SN_BE_ASSIGNED;
+	s->flags |= SF_BE_ASSIGNED;
 
 	/* If the target backend requires HTTP processing, we have to allocate
 	 * a struct hdr_idx for it if we did not have one.
diff --git a/src/queue.c b/src/queue.c
index 14e4be6..1f27c49 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -122,7 +122,7 @@
 	pendconn_free(ps);
 
 	/* we want to note that the stream has now been assigned a server */
-	strm->flags |= SN_ASSIGNED;
+	strm->flags |= SF_ASSIGNED;
 	strm->target = &srv->obj_type;
 	stream_add_srv_conn(strm, srv);
 	srv->served++;
@@ -151,7 +151,7 @@
 	p->strm = strm;
 	p->srv = srv = objt_server(strm->target);
 
-	if (strm->flags & SN_ASSIGNED && srv) {
+	if (strm->flags & SF_ASSIGNED && srv) {
 		LIST_ADDQ(&srv->pendconns, &p->list);
 		srv->nbpend++;
 		strm->logs.srv_queue_size += srv->nbpend;
@@ -180,13 +180,13 @@
 		struct stream *strm = pc->strm;
 
 		if ((strm->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP &&
-		    !(strm->flags & SN_FORCE_PRST)) {
+		    !(strm->flags & SF_FORCE_PRST)) {
 			/* The REDISP option was specified. We will ignore
 			 * cookie and force to balance or use the dispatcher.
 			 */
 
 			/* it's left to the dispatcher to choose a server */
-			strm->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
+			strm->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
 
 			pendconn_free(pc);
 			task_wakeup(strm->task, TASK_WOKEN_RES);
diff --git a/src/server.c b/src/server.c
index aee08b0..a50f9e1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -163,7 +163,7 @@
 }
 
 /* Shutdown all connections of a server. The caller must pass a termination
- * code in <why>, which must be one of SN_ERR_* indicating the reason for the
+ * code in <why>, which must be one of SF_ERR_* indicating the reason for the
  * shutdown.
  */
 void srv_shutdown_streams(struct server *srv, int why)
@@ -176,7 +176,7 @@
 }
 
 /* Shutdown all connections of all backup servers of a proxy. The caller must
- * pass a termination code in <why>, which must be one of SN_ERR_* indicating
+ * pass a termination code in <why>, which must be one of SF_ERR_* indicating
  * the reason for the shutdown.
  */
 void srv_shutdown_backup_streams(struct proxy *px, int why)
@@ -244,7 +244,7 @@
 		s->proxy->lbprm.set_server_status_down(s);
 
 	if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
-		srv_shutdown_streams(s, SN_ERR_DOWN);
+		srv_shutdown_streams(s, SF_ERR_DOWN);
 
 	/* we might have streams queued on this server and waiting for
 	 * a connection. Those which are redispatchable will be queued
@@ -318,7 +318,7 @@
 	 */
 	if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
 	    !(s->flags & SRV_F_BACKUP) && s->eweight)
-		srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
+		srv_shutdown_backup_streams(s->proxy, SF_ERR_UP);
 
 	/* check if we can handle some connections queued at the proxy. We
 	 * will take as many as we can handle.
@@ -438,7 +438,7 @@
 				s->proxy->lbprm.set_server_status_down(s);
 
 			if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
-				srv_shutdown_streams(s, SN_ERR_DOWN);
+				srv_shutdown_streams(s, SF_ERR_DOWN);
 
 			/* we might have streams queued on this server and waiting for
 			 * a connection. Those which are redispatchable will be queued
@@ -600,7 +600,7 @@
 			 */
 			if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
 			    !(s->flags & SRV_F_BACKUP) && s->eweight)
-				srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
+				srv_shutdown_backup_streams(s->proxy, SF_ERR_UP);
 
 			/* check if we can handle some connections queued at the proxy. We
 			 * will take as many as we can handle.
diff --git a/src/stream.c b/src/stream.c
index 36ef2ca..3bc337e 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -423,7 +423,7 @@
 	LIST_INIT(&s->back_refs);
 	LIST_INIT(&s->buffer_wait);
 
-	s->flags |= SN_INITIALIZED;
+	s->flags |= SF_INITIALIZED;
 	s->unique_id = NULL;
 
 	t->process = l->handler;
@@ -586,8 +586,8 @@
 		pendconn_free(s->pend_pos);
 
 	if (objt_server(s->target)) { /* there may be requests left pending in queue */
-		if (s->flags & SN_CURR_SESS) {
-			s->flags &= ~SN_CURR_SESS;
+		if (s->flags & SF_CURR_SESS) {
+			s->flags &= ~SF_CURR_SESS;
 			objt_server(s->target)->cur_sess--;
 		}
 		if (may_dequeue_tasks(objt_server(s->target), s->be))
@@ -943,8 +943,8 @@
 	if (objt_server(s->target)) {
 		health_adjust(objt_server(s->target), HANA_STATUS_L4_ERR);
 
-		if (s->flags & SN_CURR_SESS) {
-			s->flags &= ~SN_CURR_SESS;
+		if (s->flags & SF_CURR_SESS) {
+			s->flags &= ~SF_CURR_SESS;
 			objt_server(s->target)->cur_sess--;
 		}
 	}
@@ -986,14 +986,14 @@
 	 */
 	if (objt_server(s->target) &&
 	    (si->conn_retries == 0 ||
-	     (!(s->flags & SN_DIRECT) && s->be->srv_act > 1 &&
+	     (!(s->flags & SF_DIRECT) && s->be->srv_act > 1 &&
 	      ((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_RR))) &&
-	    s->be->options & PR_O_REDISP && !(s->flags & SN_FORCE_PRST)) {
+	    s->be->options & PR_O_REDISP && !(s->flags & SF_FORCE_PRST)) {
 		sess_change_server(s, NULL);
 		if (may_dequeue_tasks(objt_server(s->target), s->be))
 			process_srv_queue(objt_server(s->target));
 
-		s->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
+		s->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET);
 		si->state = SI_ST_REQ;
 	} else {
 		if (objt_server(s->target))
@@ -1101,7 +1101,7 @@
 		conn_err = connect_server(s);
 		srv = objt_server(s->target);
 
-		if (conn_err == SN_ERR_NONE) {
+		if (conn_err == SF_ERR_NONE) {
 			/* state = SI_ST_CON or SI_ST_EST now */
 			if (srv)
 				srv_inc_sess_ctr(srv);
@@ -1113,7 +1113,7 @@
 		/* We have received a synchronous error. We might have to
 		 * abort, retry immediately or redispatch.
 		 */
-		if (conn_err == SN_ERR_INTERNAL) {
+		if (conn_err == SF_ERR_INTERNAL) {
 			if (!si->err_type) {
 				si->err_type = SI_ET_CONN_OTHER;
 			}
@@ -1164,7 +1164,7 @@
 			 * load-balance first and go to the INI state.
 			 */
 			si->exp = TICK_ETERNITY;
-			if (unlikely(!(s->flags & SN_ASSIGNED)))
+			if (unlikely(!(s->flags & SF_ASSIGNED)))
 				si->state = SI_ST_REQ;
 			else {
 				s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
@@ -1236,7 +1236,7 @@
 		 * marked "assigned".
 		 * FIXME: Should we force a redispatch attempt when the server is down ?
 		 */
-		if (s->flags & SN_ASSIGNED)
+		if (s->flags & SF_ASSIGNED)
 			si->state = SI_ST_ASS;
 		else
 			si->state = SI_ST_REQ;
@@ -1250,23 +1250,23 @@
  */
 static void sess_set_term_flags(struct stream *s)
 {
-	if (!(s->flags & SN_FINST_MASK)) {
+	if (!(s->flags & SF_FINST_MASK)) {
 		if (s->si[1].state < SI_ST_REQ) {
 
 			s->fe->fe_counters.failed_req++;
 			if (s->listener->counters)
 				s->listener->counters->failed_req++;
 
-			s->flags |= SN_FINST_R;
+			s->flags |= SF_FINST_R;
 		}
 		else if (s->si[1].state == SI_ST_QUE)
-			s->flags |= SN_FINST_Q;
+			s->flags |= SF_FINST_Q;
 		else if (s->si[1].state < SI_ST_EST)
-			s->flags |= SN_FINST_C;
+			s->flags |= SF_FINST_C;
 		else if (s->si[1].state == SI_ST_EST || s->si[1].prev_state == SI_ST_EST)
-			s->flags |= SN_FINST_D;
+			s->flags |= SF_FINST_D;
 		else
-			s->flags |= SN_FINST_L;
+			s->flags |= SF_FINST_L;
 	}
 }
 
@@ -1303,7 +1303,7 @@
 			 * error code to ignore the ERR_LOCAL which is not a
 			 * real error.
 			 */
-			s->flags &= ~(SN_ERR_MASK | SN_FINST_MASK);
+			s->flags &= ~(SF_ERR_MASK | SF_FINST_MASK);
 
 			si_shutr(si);
 			si_shutw(si);
@@ -1372,7 +1372,7 @@
 		req->analysers);
 
 	/* now check whether we have some switching rules for this request */
-	if (!(s->flags & SN_BE_ASSIGNED)) {
+	if (!(s->flags & SF_BE_ASSIGNED)) {
 		struct switching_rule *rule;
 
 		list_for_each_entry(rule, &s->fe->switching_rules, list) {
@@ -1414,7 +1414,7 @@
 		 * measure also takes care of correctly setting the default
 		 * backend if any.
 		 */
-		if (!(s->flags & SN_BE_ASSIGNED))
+		if (!(s->flags & SF_BE_ASSIGNED))
 			if (!stream_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be))
 				goto sw_failed;
 	}
@@ -1441,9 +1441,9 @@
 		if (ret) {
 			/* no rule, or the rule matches */
 			if (prst_rule->type == PERSIST_TYPE_FORCE) {
-				s->flags |= SN_FORCE_PRST;
+				s->flags |= SF_FORCE_PRST;
 			} else {
-				s->flags |= SN_IGNORE_PRST;
+				s->flags |= SF_IGNORE_PRST;
 			}
 			break;
 		}
@@ -1456,10 +1456,10 @@
 	channel_abort(&s->req);
 	channel_abort(&s->res);
 
-	if (!(s->flags & SN_ERR_MASK))
-		s->flags |= SN_ERR_RESOURCE;
-	if (!(s->flags & SN_FINST_MASK))
-		s->flags |= SN_FINST_R;
+	if (!(s->flags & SF_ERR_MASK))
+		s->flags |= SF_ERR_RESOURCE;
+	if (!(s->flags & SF_FINST_MASK))
+		s->flags |= SF_FINST_R;
 
 	s->txn.status = 500;
 	s->req.analysers = 0;
@@ -1485,7 +1485,7 @@
 		req->buf->i + req->buf->o,
 		req->analysers);
 
-	if (!(s->flags & SN_ASSIGNED)) {
+	if (!(s->flags & SF_ASSIGNED)) {
 		list_for_each_entry(rule, &px->server_rules, list) {
 			int ret;
 
@@ -1499,8 +1499,8 @@
 
 				if ((srv->state != SRV_ST_STOPPED) ||
 				    (px->options & PR_O_PERSIST) ||
-				    (s->flags & SN_FORCE_PRST)) {
-					s->flags |= SN_DIRECT | SN_ASSIGNED;
+				    (s->flags & SF_FORCE_PRST)) {
+					s->flags |= SF_DIRECT | SF_ASSIGNED;
 					s->target = &srv->obj_type;
 					break;
 				}
@@ -1571,7 +1571,7 @@
 				struct stksess *ts;
 
 				if ((ts = stktable_lookup_key(rule->table.t, key)) != NULL) {
-					if (!(s->flags & SN_ASSIGNED)) {
+					if (!(s->flags & SF_ASSIGNED)) {
 						struct eb32_node *node;
 						void *ptr;
 
@@ -1584,8 +1584,8 @@
 							srv = container_of(node, struct server, conf.id);
 							if ((srv->state != SRV_ST_STOPPED) ||
 							    (px->options & PR_O_PERSIST) ||
-							    (s->flags & SN_FORCE_PRST)) {
-								s->flags |= SN_DIRECT | SN_ASSIGNED;
+							    (s->flags & SF_FORCE_PRST)) {
+								s->flags |= SF_DIRECT | SF_ASSIGNED;
 								s->target = &srv->obj_type;
 							}
 						}
@@ -1848,10 +1848,10 @@
 				s->fe->fe_counters.cli_aborts++;
 				if (srv)
 					srv->counters.cli_aborts++;
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_CLICL;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_D;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_CLICL;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_D;
 			}
 		}
 	}
@@ -1869,10 +1869,10 @@
 				s->fe->fe_counters.srv_aborts++;
 				if (srv)
 					srv->counters.srv_aborts++;
-				if (!(s->flags & SN_ERR_MASK))
-					s->flags |= SN_ERR_SRVCL;
-				if (!(s->flags & SN_FINST_MASK))
-					s->flags |= SN_FINST_D;
+				if (!(s->flags & SF_ERR_MASK))
+					s->flags |= SF_ERR_SRVCL;
+				if (!(s->flags & SF_FINST_MASK))
+					s->flags |= SF_FINST_D;
 			}
 		}
 		/* note: maybe we should process connection errors here ? */
@@ -1924,8 +1924,8 @@
 		si_b->state = SI_ST_CLO;
 		srv = objt_server(s->target);
 		if (srv) {
-			if (s->flags & SN_CURR_SESS) {
-				s->flags &= ~SN_CURR_SESS;
+			if (s->flags & SF_CURR_SESS) {
+				s->flags &= ~SF_CURR_SESS;
 				srv->cur_sess--;
 			}
 			sess_change_server(s, NULL);
@@ -2207,7 +2207,7 @@
 	 * seen any analyser who could set an error status.
 	 */
 	srv = objt_server(s->target);
-	if (unlikely(!(s->flags & SN_ERR_MASK))) {
+	if (unlikely(!(s->flags & SF_ERR_MASK))) {
 		if (req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) {
 			/* Report it if the client got an error or a read timeout expired */
 			req->analysers = 0;
@@ -2216,28 +2216,28 @@
 				s->fe->fe_counters.cli_aborts++;
 				if (srv)
 					srv->counters.cli_aborts++;
-				s->flags |= SN_ERR_CLICL;
+				s->flags |= SF_ERR_CLICL;
 			}
 			else if (req->flags & CF_READ_TIMEOUT) {
 				s->be->be_counters.cli_aborts++;
 				s->fe->fe_counters.cli_aborts++;
 				if (srv)
 					srv->counters.cli_aborts++;
-				s->flags |= SN_ERR_CLITO;
+				s->flags |= SF_ERR_CLITO;
 			}
 			else if (req->flags & CF_WRITE_ERROR) {
 				s->be->be_counters.srv_aborts++;
 				s->fe->fe_counters.srv_aborts++;
 				if (srv)
 					srv->counters.srv_aborts++;
-				s->flags |= SN_ERR_SRVCL;
+				s->flags |= SF_ERR_SRVCL;
 			}
 			else {
 				s->be->be_counters.srv_aborts++;
 				s->fe->fe_counters.srv_aborts++;
 				if (srv)
 					srv->counters.srv_aborts++;
-				s->flags |= SN_ERR_SRVTO;
+				s->flags |= SF_ERR_SRVTO;
 			}
 			sess_set_term_flags(s);
 		}
@@ -2249,28 +2249,28 @@
 				s->fe->fe_counters.srv_aborts++;
 				if (srv)
 					srv->counters.srv_aborts++;
-				s->flags |= SN_ERR_SRVCL;
+				s->flags |= SF_ERR_SRVCL;
 			}
 			else if (res->flags & CF_READ_TIMEOUT) {
 				s->be->be_counters.srv_aborts++;
 				s->fe->fe_counters.srv_aborts++;
 				if (srv)
 					srv->counters.srv_aborts++;
-				s->flags |= SN_ERR_SRVTO;
+				s->flags |= SF_ERR_SRVTO;
 			}
 			else if (res->flags & CF_WRITE_ERROR) {
 				s->be->be_counters.cli_aborts++;
 				s->fe->fe_counters.cli_aborts++;
 				if (srv)
 					srv->counters.cli_aborts++;
-				s->flags |= SN_ERR_CLICL;
+				s->flags |= SF_ERR_CLICL;
 			}
 			else {
 				s->be->be_counters.cli_aborts++;
 				s->fe->fe_counters.cli_aborts++;
 				if (srv)
 					srv->counters.cli_aborts++;
-				s->flags |= SN_ERR_CLITO;
+				s->flags |= SF_ERR_CLITO;
 			}
 			sess_set_term_flags(s);
 		}
@@ -2423,7 +2423,7 @@
 			}
 
 			srv = objt_server(s->target);
-			if (si_b->state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SN_REDIRECTABLE))
+			if (si_b->state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SF_REDIRECTABLE))
 				http_perform_server_redirect(s, si_b);
 		} while (si_b->state == SI_ST_ASS);
 	}
@@ -2588,7 +2588,7 @@
 	if (likely((si_f->state != SI_ST_CLO) ||
 		   (si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) {
 
-		if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED))
+		if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
 			stream_process_counters(s);
 
 		if (si_f->state == SI_ST_EST && obj_type(si_f->end) != OBJ_TYPE_APPCTX)
@@ -2665,7 +2665,7 @@
 	}
 
 	s->fe->feconn--;
-	if (s->flags & SN_BE_ASSIGNED)
+	if (s->flags & SF_BE_ASSIGNED)
 		s->be->beconn--;
 	jobs--;
 	if (s->listener) {
@@ -2705,21 +2705,21 @@
 
 		if (s->fe->mode == PR_MODE_HTTP) {
 			s->fe->fe_counters.p.http.rsp[n]++;
-			if (s->comp_algo && (s->flags & SN_COMP_READY))
+			if (s->comp_algo && (s->flags & SF_COMP_READY))
 				s->fe->fe_counters.p.http.comp_rsp++;
 		}
-		if ((s->flags & SN_BE_ASSIGNED) &&
+		if ((s->flags & SF_BE_ASSIGNED) &&
 		    (s->be->mode == PR_MODE_HTTP)) {
 			s->be->be_counters.p.http.rsp[n]++;
 			s->be->be_counters.p.http.cum_req++;
-			if (s->comp_algo && (s->flags & SN_COMP_READY))
+			if (s->comp_algo && (s->flags & SF_COMP_READY))
 				s->be->be_counters.p.http.comp_rsp++;
 		}
 	}
 
 	/* let's do a final log if we need it */
 	if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
-	    !(s->flags & SN_MONITOR) &&
+	    !(s->flags & SF_MONITOR) &&
 	    (!(s->fe->options & PR_O_NULLNOLOG) || req->total)) {
 		s->do_log(s);
 	}
@@ -2814,45 +2814,45 @@
 	int err = 0, fin = 0;
 
 	if (err_type & SI_ET_QUEUE_ABRT) {
-		err = SN_ERR_CLICL;
-		fin = SN_FINST_Q;
+		err = SF_ERR_CLICL;
+		fin = SF_FINST_Q;
 	}
 	else if (err_type & SI_ET_CONN_ABRT) {
-		err = SN_ERR_CLICL;
-		fin = SN_FINST_C;
+		err = SF_ERR_CLICL;
+		fin = SF_FINST_C;
 	}
 	else if (err_type & SI_ET_QUEUE_TO) {
-		err = SN_ERR_SRVTO;
-		fin = SN_FINST_Q;
+		err = SF_ERR_SRVTO;
+		fin = SF_FINST_Q;
 	}
 	else if (err_type & SI_ET_QUEUE_ERR) {
-		err = SN_ERR_SRVCL;
-		fin = SN_FINST_Q;
+		err = SF_ERR_SRVCL;
+		fin = SF_FINST_Q;
 	}
 	else if (err_type & SI_ET_CONN_TO) {
-		err = SN_ERR_SRVTO;
-		fin = SN_FINST_C;
+		err = SF_ERR_SRVTO;
+		fin = SF_FINST_C;
 	}
 	else if (err_type & SI_ET_CONN_ERR) {
-		err = SN_ERR_SRVCL;
-		fin = SN_FINST_C;
+		err = SF_ERR_SRVCL;
+		fin = SF_FINST_C;
 	}
 	else if (err_type & SI_ET_CONN_RES) {
-		err = SN_ERR_RESOURCE;
-		fin = SN_FINST_C;
+		err = SF_ERR_RESOURCE;
+		fin = SF_FINST_C;
 	}
 	else /* SI_ET_CONN_OTHER and others */ {
-		err = SN_ERR_INTERNAL;
-		fin = SN_FINST_C;
+		err = SF_ERR_INTERNAL;
+		fin = SF_FINST_C;
 	}
 
-	if (!(s->flags & SN_ERR_MASK))
+	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= err;
-	if (!(s->flags & SN_FINST_MASK))
+	if (!(s->flags & SF_FINST_MASK))
 		s->flags |= fin;
 }
 
-/* kill a stream and set the termination flags to <why> (one of SN_ERR_*) */
+/* kill a stream and set the termination flags to <why> (one of SF_ERR_*) */
 void stream_shutdown(struct stream *stream, int why)
 {
 	if (stream->req.flags & (CF_SHUTW|CF_SHUTW_NOW))
@@ -2861,7 +2861,7 @@
 	channel_shutw_now(&stream->req);
 	channel_shutr_now(&stream->res);
 	stream->task->nice = 1024;
-	if (!(stream->flags & SN_ERR_MASK))
+	if (!(stream->flags & SF_ERR_MASK))
 		stream->flags |= why;
 	task_wakeup(stream->task, TASK_WOKEN_OTHER);
 }