MINOR: filters: Add stream_filters structure to hide filters info
From the stream point of view, this new structure is opaque. it hides filters
implementation details. So, impact for future optimizations will be reduced
(well, we hope so...).
Some small improvements has been made in filters.c to avoid useless checks.
diff --git a/include/proto/filters.h b/include/proto/filters.h
index 8eaaf3a..4ed81a8 100644
--- a/include/proto/filters.h
+++ b/include/proto/filters.h
@@ -110,6 +110,14 @@
struct flt_kw *flt_find_kw(const char *kw);
void flt_dump_kws(char **out);
+/* Helper function that returns the "global" state of filters attached to a
+ * stream. */
+static inline struct strm_flt *
+strm_flt(struct stream *s)
+{
+ return &s->strm_flt;
+}
+
static inline void
flt_set_forward_data(struct filter *filter, struct channel *chn)
{
@@ -145,7 +153,7 @@
struct stream *s = chn_strm(chn);
struct filter *f;
- list_for_each_entry(f, &s->strm_flt.filters, list) {
+ list_for_each_entry(f, &strm_flt(s)->filters, list) {
if (f == filter)
break;
FLT_NXT(f, chn) += len;
@@ -169,7 +177,7 @@
struct filter *f;
int before = 1;
- list_for_each_entry(f, &s->strm_flt.filters, list) {
+ list_for_each_entry(f, &strm_flt(s)->filters, list) {
if (f == filter)
before = 0;
if (before)
diff --git a/include/types/filters.h b/include/types/filters.h
index 4bfa1c2..20b0c95 100644
--- a/include/types/filters.h
+++ b/include/types/filters.h
@@ -197,6 +197,12 @@
struct list list; /* Next filter for the same proxy/stream */
};
+struct strm_flt {
+ struct list filters;
+ struct filter *current[2]; // 0: request, 1: response
+ int has_filters;
+};
+
#endif /* _TYPES_FILTERS_H */
/*
diff --git a/include/types/stream.h b/include/types/stream.h
index e2efc93..8687726 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -125,12 +125,6 @@
struct http_txn *txn; /* current HTTP transaction being processed. Should become a list. */
- struct {
- struct list filters;
- struct filter *current[2]; /* 0: request, 1: response */
- char has_filters;
- } strm_flt;
-
struct task *task; /* the task associated with this stream */
struct list list; /* position in global streams list */
struct list by_srv; /* position in server stream list */
@@ -146,6 +140,8 @@
struct stkctr stkctr[MAX_SESS_STKCTR]; /* content-aware stick counters */
+ struct strm_flt strm_flt; /* current state of filters active on this stream */
+
char **req_cap; /* array of captures from the request (may be NULL) */
char **res_cap; /* array of captures from the response (may be NULL) */
struct vars vars_txn; /* list of variables for the txn scope. */