]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: action: Add trk_idx inline function
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Sep 2017 09:54:51 +0000 (11:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 10:36:12 +0000 (11:36 +0100)
It returns tracking index corresponding to an action ACT_ACTION_TRK_SC*. It will
replace http_trk_idx and tcp_trk_idx.

include/proto/action.h

index fea40cf235c03b55697a7990bcb23958790edca7..ce94aa04962aa7da78fbf486f6de2602c03dcf05 100644 (file)
@@ -68,4 +68,12 @@ static inline void action_build_list(struct list *keywords, struct chunk *chk)
                *p = '\0';
 }
 
+/* for an action ACT_ACTION_TRK_SC*, return a tracking index starting at zero
+ * for SC0. Unknown actions also return zero.
+ */
+static inline int trk_idx(int trk_action)
+{
+       return trk_action - ACT_ACTION_TRK_SC0;
+}
+
 #endif /* _PROTO_ACTION_H */