]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: applet: add init function
authorThierry FOURNIER <tfournier@arpalert.org>
Fri, 11 Sep 2015 06:50:34 +0000 (08:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Sep 2015 23:03:48 +0000 (01:03 +0200)
this patch adds init function for the applet. the HAProxy standard
applet (peers, stats, lua) have no standard way for the applet
initialisation. This new function pointer have for goal to try to
standardize the applet initialization.

include/types/applet.h

index 6b46f4945143ff92be544b5a135ac61da5120ad2..13817b22aa3e6910f09f13ee7f235755097fe7e3 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <types/hlua.h>
 #include <types/obj_type.h>
+#include <types/proxy.h>
+#include <types/stream.h>
 #include <common/chunk.h>
 #include <common/config.h>
 
@@ -34,6 +36,8 @@ struct applet {
        enum obj_type obj_type;            /* object type = OBJ_TYPE_APPLET */
        /* 3 unused bytes here */
        char *name;                        /* applet's name to report in logs */
+       int (*init)(struct appctx *, struct proxy *px, struct stream *strm);   /* callback to init ressources, may be NULL.
+                                            expect 1 if ok, 0 if an error occurs, -1 if miss data. */
        void (*fct)(struct appctx *);      /* internal I/O handler, may never be NULL */
        void (*release)(struct appctx *);  /* callback to release resources, may be NULL */
 };