MEDIUM: actions: Merge (http|tcp)-(request|reponse) action structs

This patch is the first of a serie which merge all the action structs. The
function "tcp-request content", "tcp-response-content", "http-request" and
"http-response" have the same values and the same process for some defined
actions, but the struct and the prototype of the declared function are
different.

This patch try to unify all of these entries.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index c9ccddd..1f63c57 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -117,8 +117,8 @@
 void http_reset_txn(struct stream *s);
 void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg);
 
-struct http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
-struct http_res_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
+struct act_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
+struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
 void free_http_req_rules(struct list *r);
 void free_http_res_rules(struct list *r);
 struct chunk *http_error_message(struct stream *s, int msgnum);
diff --git a/include/types/action.h b/include/types/action.h
new file mode 100644
index 0000000..b6c3afb
--- /dev/null
+++ b/include/types/action.h
@@ -0,0 +1,71 @@
+/*
+ * include/types/action.h
+ * This file contains TCP protocol definitions.
+ *
+ * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _TYPES_ACTION_H
+#define _TYPES_ACTION_H
+
+#include <types/stick_table.h>
+
+struct capture_prm {
+	struct sample_expr *expr;               /* expression used as the key */
+	struct cap_hdr *hdr;                    /* the capture storage */
+};
+
+struct act_rule {
+	struct list list;
+	struct acl_cond *cond;                 /* acl condition to meet */
+	unsigned int action;                   /* HTTP_REQ_* */
+	short deny_status;                     /* HTTP status to return to user when denying */
+	int (*action_ptr)(struct act_rule *rule, struct proxy *px,
+	                  struct session *sess, struct stream *s); /* ptr to custom action */
+	union {
+		struct {
+			char *realm;
+		} auth;                        /* arg used by "auth" */
+		struct {
+			char *name;            /* header name */
+			int name_len;          /* header name's length */
+			struct list fmt;       /* log-format compatible expression */
+			struct my_regex re;    /* used by replace-header and replace-value */
+		} hdr_add;                     /* args used by "add-header" and "set-header" */
+		struct redirect_rule *redir;   /* redirect rule or "http-request redirect" */
+		int nice;                      /* nice value for HTTP_REQ_ACT_SET_NICE */
+		int loglevel;                  /* log-level value for HTTP_REQ_ACT_SET_LOGL */
+		int tos;                       /* tos value for HTTP_REQ_ACT_SET_TOS */
+		int mark;                      /* nfmark value for HTTP_REQ_ACT_SET_MARK */
+		void *data;                    /* generic pointer for module or external rule */
+		struct {
+			char *ref;             /* MAP or ACL file name to update */
+			struct list key;       /* pattern to retrieve MAP or ACL key */
+			struct list value;     /* pattern to retrieve MAP value */
+		} map;
+		struct {
+			void *p[4];
+		} act;                         /* generic pointers to be used by custom actions */
+	} arg;                                 /* arguments used by some actions */
+
+	union {
+		struct capture_prm cap;
+		struct track_ctr_prm trk_ctr;
+	} act_prm;
+};
+
+#endif /* _TYPES_ACTION_H */
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 975df01..563d02d 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -27,8 +27,8 @@
 #include <common/mini-clist.h>
 #include <common/regex.h>
 
+#include <types/action.h>
 #include <types/hdr_idx.h>
-#include <types/stick_table.h>
 
 /* These are the flags that are found in txn->flags */
 
@@ -406,72 +406,6 @@
 struct http_txn;
 struct stream;
 
-struct http_req_rule {
-	struct list list;
-	struct acl_cond *cond;                 /* acl condition to meet */
-	unsigned int action;                   /* HTTP_REQ_* */
-	short deny_status;                     /* HTTP status to return to user when denying */
-	int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct stream *s);  /* ptr to custom action */
-	union {
-		struct {
-			char *realm;
-		} auth;                        /* arg used by "auth" */
-		struct {
-			char *name;            /* header name */
-			int name_len;          /* header name's length */
-			struct list fmt;       /* log-format compatible expression */
-			struct my_regex re;    /* used by replace-header and replace-value */
-		} hdr_add;                     /* args used by "add-header" and "set-header" */
-		struct redirect_rule *redir;   /* redirect rule or "http-request redirect" */
-		int nice;                      /* nice value for HTTP_REQ_ACT_SET_NICE */
-		int loglevel;                  /* log-level value for HTTP_REQ_ACT_SET_LOGL */
-		int tos;                       /* tos value for HTTP_REQ_ACT_SET_TOS */
-		int mark;                      /* nfmark value for HTTP_REQ_ACT_SET_MARK */
-		void *data;                    /* generic pointer for module or external rule */
-		struct {
-			char *ref;             /* MAP or ACL file name to update */
-			struct list key;       /* pattern to retrieve MAP or ACL key */
-			struct list value;     /* pattern to retrieve MAP value */
-		} map;
-		struct {
-			void *p[4];
-		} act;                         /* generic pointers to be used by custom actions */
-	} arg;                                 /* arguments used by some actions */
-
-	union {
-		struct track_ctr_prm trk_ctr;
-	} act_prm;
-};
-
-struct http_res_rule {
-	struct list list;
-	struct acl_cond *cond;                 /* acl condition to meet */
-	unsigned int action;                   /* HTTP_RES_* */
-	int (*action_ptr)(struct http_res_rule *rule, struct proxy *px, struct stream *s);  /* ptr to custom action */
-	union {
-		struct {
-			char *name;            /* header name */
-			int name_len;          /* header name's length */
-			struct list fmt;       /* log-format compatible expression */
-			struct my_regex re;    /* used by replace-header and replace-value */
-		} hdr_add;                     /* args used by "add-header" and "set-header" */
-		struct redirect_rule *redir;   /* redirect rule or "http-request redirect" */
-		int nice;                      /* nice value for HTTP_RES_ACT_SET_NICE */
-		int loglevel;                  /* log-level value for HTTP_RES_ACT_SET_LOGL */
-		int tos;                       /* tos value for HTTP_RES_ACT_SET_TOS */
-		int mark;                      /* nfmark value for HTTP_RES_ACT_SET_MARK */
-		void *data;                    /* generic pointer for module or external rule */
-		struct {
-			char *ref;             /* MAP or ACL file name to update */
-			struct list key;       /* pattern to retrieve MAP or ACL key */
-			struct list value;     /* pattern to retrieve MAP value */
-		} map;
-		struct {
-			void *p[4];
-		} act;                         /* generic pointers to be used by custom actions */
-	} arg;                                 /* arguments used by some actions */
-};
-
 /* This is an HTTP transaction. It contains both a request message and a
  * response message (which can be empty).
  */
@@ -519,13 +453,13 @@
 
 struct http_req_action_kw {
        const char *kw;
-       int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_req_rule *rule, char **err);
+       int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct act_rule *rule, char **err);
 	int match_pfx;
 };
 
 struct http_res_action_kw {
        const char *kw;
-       int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_res_rule *rule, char **err);
+       int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct act_rule *rule, char **err);
 	int match_pfx;
 };
 
diff --git a/include/types/proto_tcp.h b/include/types/proto_tcp.h
index 88f6999..4ab0985 100644
--- a/include/types/proto_tcp.h
+++ b/include/types/proto_tcp.h
@@ -25,6 +25,7 @@
 #include <common/config.h>
 #include <common/mini-clist.h>
 
+#include <types/action.h>
 #include <types/acl.h>
 #include <types/stream.h>
 
@@ -43,28 +44,10 @@
 	TCP_ACT_CUSTOM_CONT, /* Use for custom registered keywords. */
 };
 
-struct capture_prm {
-	struct sample_expr *expr;               /* expression used as the key */
-	struct cap_hdr *hdr;                    /* the capture storage */
-};
-
-struct tcp_rule {
-	struct list list;
-	struct acl_cond *cond;
-	int action;
-	int (*action_ptr)(struct tcp_rule *rule, struct proxy *px,
-	                  struct session *sess, struct stream *s);
-	union {
-		struct track_ctr_prm trk_ctr;
-		struct capture_prm cap;
-		void *data[4];
-	} act_prm;
-};
-
 struct tcp_action_kw {
 	const char *kw;
 	int (*parse)(const char **args, int *cur_arg, struct proxy *px,
-	             struct tcp_rule *rule, char **err);
+	             struct act_rule *rule, char **err);
 	int match_pfx;
 };