MEDIUM: pattern: replace type pattern_arg with type arg
arg is more complete than pattern_arg since it also covers ACL args,
so let's use this one instead.
diff --git a/include/proto/pattern.h b/include/proto/pattern.h
index 25a00d6..bb1181c 100644
--- a/include/proto/pattern.h
+++ b/include/proto/pattern.h
@@ -34,6 +34,6 @@
void pattern_register_fetches(struct pattern_fetch_kw_list *psl);
void pattern_register_convs(struct pattern_conv_kw_list *psl);
-int pattern_arg_ipmask(const char *arg_str, struct pattern_arg **arg_p, int *arg_i);
-int pattern_arg_str(const char *arg_str, struct pattern_arg **arg_p, int *arg_i);
+int pattern_arg_ipmask(const char *arg_str, struct arg **arg_p, int *arg_i);
+int pattern_arg_str(const char *arg_str, struct arg **arg_p, int *arg_i);
#endif
diff --git a/include/types/pattern.h b/include/types/pattern.h
index da383ba..e948264 100644
--- a/include/types/pattern.h
+++ b/include/types/pattern.h
@@ -22,9 +22,10 @@
#ifndef _TYPES_PATTERN_H
#define _TYPES_PATTERN_H
-#include <types/buffers.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <types/arg.h>
+#include <types/buffers.h>
/* pattern in and out types */
enum {
@@ -38,34 +39,12 @@
PATTERN_TYPES /* number of types, must always be last */
};
-
-/* pattern arg types */
-enum {
- PATTERN_ARG_TYPE_IP = 0, /* ipv4 type */
- PATTERN_ARG_TYPE_IPV6, /* ipv6 type */
- PATTERN_ARG_TYPE_INTEGER, /* unsigned 32bits integer type */
- PATTERN_ARG_TYPE_SINTEGER, /* signed 32bits integer type */
- PATTERN_ARG_TYPE_STRING /* string type */
-};
/* pattern fetch direction */
#define PATTERN_FETCH_REQ 1
#define PATTERN_FETCH_RTR 2
-union pattern_arg_data {
- struct in_addr ip; /* used for ipv4 type */
- struct in6_addr ipv6; /* used for ipv6 type */
- uint32_t integer; /* used for unsigned 32bits integer type */
- int sinteger; /* used for signed 32bits integer type */
- struct chunk str;
-};
-
-struct pattern_arg {
- int type; /* type of arg */
- union pattern_arg_data data; /* data */
-};
-
/* pattern result data */
union pattern_data {
struct in_addr ip; /* used for ipv4 type */
@@ -83,11 +62,11 @@
/* pattern conversion */
struct pattern_conv {
const char *kw; /* configuration keyword */
- int (*process)(const struct pattern_arg *arg_p,
+ int (*process)(const struct arg *arg_p,
int arg_i,
union pattern_data *data); /* process function */
int (*parse_args)(const char *arg_str,
- struct pattern_arg **arg_p,
+ struct arg **arg_p,
int *arg_i); /* argument parser. Can be NULL. */
unsigned int in_type; /* input needed pattern type */
unsigned int out_type; /* output pattern type */
@@ -97,7 +76,7 @@
struct pattern_conv_expr {
struct list list; /* member of a pattern expression */
struct pattern_conv *conv; /* pattern conversion */
- struct pattern_arg *arg_p; /* pointer on args */
+ struct arg *arg_p; /* pointer on args */
int arg_i; /* number of args */
};
@@ -107,11 +86,11 @@
int (*process)(struct proxy *px,
struct session *l4,
void *l7,
- int dir, const struct pattern_arg *arg_p,
+ int dir, const struct arg *arg_p,
int arg_i,
union pattern_data *data); /* fetch processing function */
int (*parse_args)(const char *arg_str,
- struct pattern_arg **arg_p,
+ struct arg **arg_p,
int *arg_i); /* argument parser. Can be NULL. */
unsigned long out_type; /* output pattern type */
int dir; /* usable directions */
@@ -121,7 +100,7 @@
struct pattern_expr {
struct list list; /* member of list of pattern, currently not used */
struct pattern_fetch *fetch; /* pattern fetch */
- struct pattern_arg *arg_p; /* pointer on args */
+ struct arg *arg_p; /* pointer on args */
int arg_i; /* number of args */
struct list conv_exprs; /* list of conversion expression to apply */
};