MEDIUM: checks: add send/expect tcp based check
This is a generic health check which can be used to match a
banner or send a request and analyse a server response.
It works in a send/expect ways and many exchange can be done between
HAProxy and a server to decide the server status, making HAProxy able to
speak the server's protocol.
It can send arbitrary regular or binary strings and match content as a
regular or binary string or a regex.
Signed-off-by: Baptiste Assmann <bedis9@gmail.com>
diff --git a/include/types/checks.h b/include/types/checks.h
index 09a4eee..d7d9725 100644
--- a/include/types/checks.h
+++ b/include/types/checks.h
@@ -106,4 +106,21 @@
unsigned char lr[HANA_OBS_SIZE]; /* result for l4/l7: 0 = ignore, 1 - error, 2 - OK */
};
+/* bits for tcpcheck_rule->action */
+enum {
+ TCPCHK_ACT_SEND = 1, /* send action, regular string format */
+ TCPCHK_ACT_EXPECT, /* expect action, either regular or binary string */
+};
+
+struct tcpcheck_rule {
+ struct list list; /* list linked to from the proxy */
+ int action; /* action: send or expect */
+ /* match type uses NON-NULL pointer from either string or expect_regex below */
+ /* sent string is string */
+ char *string; /* sent or expected string */
+ int string_len; /* string lenght */
+ regex_t *expect_regex; /* expected */
+ int inverse; /* 0 = regular match, 1 = inverse match */
+};
+
#endif /* _TYPES_CHECKS_H */