MEDIUM: acl/pattern: use the same direction scheme
Patterns were using a bitmask to indicate if request or response was desired
in fetch functions and keywords. ACLs were using a bitmask in fetch keywords
and a single bit in fetch functions. ACLs were also using an ACL_PARTIAL bit
in fetch functions indicating that a non-final fetch was performed, which was
an abuse of the existing direction flag.
The change now consists in using :
- a capabilities field for fetch keywords => SMP_CAP_REQ/RES to indicate
if a keyword supports requests, responses, both, etc...
- an option field for fetch functions to indicate what the caller expects
(request/response, final/non-final)
The ACL_PARTIAL bit was reversed to get SMP_OPT_FINAL as it's more explicit
to know we're working on a final buffer than on a non-final one.
ACL_DIR_* were removed, as well as PATTERN_FETCH_*. L4 fetches were improved
to support being called on responses too since they're still available.
The <dir> field of all fetch functions was changed to <opt> which is now
unsigned.
The patch is large but mostly made of cosmetic changes to accomodate this, as
almost no logic change happened.
diff --git a/src/protocols.c b/src/protocols.c
index 8a95c2d..5b3e081 100644
--- a/src/protocols.c
+++ b/src/protocols.c
@@ -325,7 +325,7 @@
/* set temp integer to the number of connexions to the same listening socket */
static int
-acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
+acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
const struct arg *args, struct sample *smp)
{
smp->type = SMP_T_UINT;
@@ -335,7 +335,7 @@
/* set temp integer to the id of the socket (listener) */
static int
-acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, int dir,
+acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
const struct arg *args, struct sample *smp)
{
smp->type = SMP_T_UINT;