REORG: connection: move the target pointer from si to connection

The target is per connection and is directly used by the connection, so
we need it there. It's not needed anymore in the SI however.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 7205b2c..abc7e22 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -310,6 +310,67 @@
 	return (c->flags & (CO_FL_DATA_WR_SH | CO_FL_SOCK_WR_SH)) == CO_FL_DATA_WR_SH;
 }
 
+static inline void clear_target(struct target *dest)
+{
+	dest->type = TARG_TYPE_NONE;
+	dest->ptr.v = NULL;
+}
+
+static inline void set_target_client(struct target *dest, struct listener *l)
+{
+	dest->type = TARG_TYPE_CLIENT;
+	dest->ptr.l = l;
+}
+
+static inline void set_target_server(struct target *dest, struct server *s)
+{
+	dest->type = TARG_TYPE_SERVER;
+	dest->ptr.s = s;
+}
+
+static inline void set_target_proxy(struct target *dest, struct proxy *p)
+{
+	dest->type = TARG_TYPE_PROXY;
+	dest->ptr.p = p;
+}
+
+static inline void set_target_applet(struct target *dest, struct si_applet *a)
+{
+	dest->type = TARG_TYPE_APPLET;
+	dest->ptr.a = a;
+}
+
+static inline void set_target_task(struct target *dest, struct task *t)
+{
+	dest->type = TARG_TYPE_TASK;
+	dest->ptr.t = t;
+}
+
+static inline struct target *copy_target(struct target *dest, struct target *src)
+{
+	*dest = *src;
+	return dest;
+}
+
+static inline int target_match(struct target *a, struct target *b)
+{
+	return a->type == b->type && a->ptr.v == b->ptr.v;
+}
+
+static inline struct server *target_srv(struct target *t)
+{
+	if (!t || t->type != TARG_TYPE_SERVER)
+		return NULL;
+	return t->ptr.s;
+}
+
+static inline struct listener *target_client(struct target *t)
+{
+	if (!t || t->type != TARG_TYPE_CLIENT)
+		return NULL;
+	return t->ptr.l;
+}
+
 #endif /* _PROTO_CONNECTION_H */
 
 /*