REORG: applet: move the applet definitions out of stream_interface

We're tidying the definitions so that appctx lives on its own. A new
set of applet.h files has been added for this purpose.
diff --git a/include/proto/applet.h b/include/proto/applet.h
new file mode 100644
index 0000000..61bca02
--- /dev/null
+++ b/include/proto/applet.h
@@ -0,0 +1,73 @@
+/*
+ * include/proto/applet.h
+ * This file contains applet function prototypes
+ *
+ * Copyright (C) 2000-2015 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _PROTO_APPLET_H
+#define _PROTO_APPLET_H
+
+#include <stdlib.h>
+
+#include <common/config.h>
+#include <types/applet.h>
+#include <proto/connection.h>
+
+/* Initializes all required fields for a new appctx. Note that it does the
+ * minimum acceptable initialization for an appctx. This means only the
+ * 3 integer states st0, st1, st2 are zeroed.
+ */
+static inline void appctx_init(struct appctx *appctx)
+{
+	appctx->st0 = appctx->st1 = appctx->st2 = 0;
+}
+
+/* Tries to allocate a new appctx and initialize its main fields. The appctx
+ * is returned on success, NULL on failure. The appctx must be released using
+ * pool_free2(connection) or appctx_free(), since it's allocated from the
+ * connection pool. <applet> is assigned as the applet, but it can be NULL.
+ */
+static inline struct appctx *appctx_new(struct si_applet *applet)
+{
+	struct appctx *appctx;
+
+	appctx = pool_alloc2(pool2_connection);
+	if (likely(appctx != NULL)) {
+		appctx->obj_type = OBJ_TYPE_APPCTX;
+		appctx->applet = applet;
+		appctx_init(appctx);
+	}
+	return appctx;
+}
+
+/* Releases an appctx previously allocated by appctx_new(). Note that
+ * we share the connection pool.
+ */
+static inline void appctx_free(struct appctx *appctx)
+{
+	pool_free2(pool2_connection, appctx);
+}
+
+#endif /* _PROTO_APPLET_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */
diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h
index 61e39bf..cbbb802 100644
--- a/include/proto/dumpstats.h
+++ b/include/proto/dumpstats.h
@@ -24,6 +24,7 @@
 #define _PROTO_DUMPSTATS_H
 
 #include <common/config.h>
+#include <types/applet.h>
 #include <types/stream_interface.h>
 
 /* Flags for applet.ctx.stats.flags */
diff --git a/include/proto/obj_type.h b/include/proto/obj_type.h
index a02e1d6..6d6577c 100644
--- a/include/proto/obj_type.h
+++ b/include/proto/obj_type.h
@@ -24,6 +24,7 @@
 
 #include <common/config.h>
 #include <common/memory.h>
+#include <types/applet.h>
 #include <types/connection.h>
 #include <types/listener.h>
 #include <types/obj_type.h>
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index ec52f1e..2645961 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -27,6 +27,7 @@
 #include <common/config.h>
 #include <types/stream.h>
 #include <types/stream_interface.h>
+#include <proto/applet.h>
 #include <proto/channel.h>
 #include <proto/connection.h>
 
@@ -103,41 +104,6 @@
 		return &LIST_ELEM(si, struct stream *, si[0])->si[1];
 }
 
-/* Initializes all required fields for a new appctx. Note that it does the
- * minimum acceptable initialization for an appctx. This means only the
- * 3 integer states st0, st1, st2 are zeroed.
- */
-static inline void appctx_init(struct appctx *appctx)
-{
-	appctx->st0 = appctx->st1 = appctx->st2 = 0;
-}
-
-/* Tries to allocate a new appctx and initialize its main fields. The appctx
- * is returned on success, NULL on failure. The appctx must be released using
- * pool_free2(connection) or appctx_free(), since it's allocated from the
- * connection pool. <applet> is assigned as the applet, but it can be NULL.
- */
-static inline struct appctx *appctx_new(struct si_applet *applet)
-{
-	struct appctx *appctx;
-
-	appctx = pool_alloc2(pool2_connection);
-	if (likely(appctx != NULL)) {
-		appctx->obj_type = OBJ_TYPE_APPCTX;
-		appctx->applet = applet;
-		appctx_init(appctx);
-	}
-	return appctx;
-}
-
-/* Releases an appctx previously allocated by appctx_new(). Note that
- * we share the connection pool.
- */
-static inline void appctx_free(struct appctx *appctx)
-{
-	pool_free2(pool2_connection, appctx);
-}
-
 /* initializes a stream interface in the SI_ST_INI state. It's detached from
  * any endpoint and only keeps its side which is expected to have already been
  * set.