MINOR: arg: Add an argument type to keep a reference on opaque data
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Aug 2020 11:56:00 +0000 (13:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2020 09:36:50 +0000 (11:36 +0200)
The ARGT_PTR argument type may now be used to keep a reference to opaque data in
the argument array used by sample fetches and converters. It is a generic way to
point on data. I guess it could be used for some other arguments, like proxy,
server, map or stick-table.

(cherry picked from commit e02fc4d0dd57c92bbe96f3ff2ae0b890405458f2)
[wt: needed by next commit]
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit bf1fcab0670c3a94270d19c50a23a88b3d0edfba)
Signed-off-by: Willy Tarreau <w@1wt.eu>

include/types/arg.h

index a9778f2..0f8a1ec 100644 (file)
@@ -63,6 +63,7 @@ enum {
        ARGT_REG,      /* a pointer to a regex */
        ARGT_VAR,      /* contains a variable description. */
        ARGT_PBUF_FNUM, /* a protocol buffer field number */
+       ARGT_PTR,       /* a pointer to opaque data */
        /* please update arg_type_names[] in args.c if you add entries here */
 };
 
@@ -106,6 +107,7 @@ union arg_data {
        struct my_regex *reg;
        struct pbuf_fid fid;
        struct var_desc var;
+       void *ptr;
 };
 
 struct arg {