mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
The current "ADD" vs "ADDQ" is confusing because when thinking in terms
of appending at the end of a list, "ADD" naturally comes to mind, but
here it does the opposite, it inserts. Several times already it's been
incorrectly used where ADDQ was expected, the latest of which was a
fortunate accident explained in 6fa922562
("CLEANUP: stream: explain
why we queue the stream at the head of the server list").
Let's use more explicit (but slightly longer) names now:
LIST_ADD -> LIST_INSERT
LIST_ADDQ -> LIST_APPEND
LIST_ADDED -> LIST_INLIST
LIST_DEL -> LIST_DELETE
The same is true for MT_LISTs, including their "TRY" variant.
LIST_DEL_INIT keeps its short name to encourage to use it instead of the
lazier LIST_DELETE which is often less safe.
The change is large (~674 non-comment entries) but is mechanical enough
to remain safe. No permutation was performed, so any out-of-tree code
can easily map older names to new ones.
The list doc was updated.
130 lines
6.6 KiB
C
130 lines
6.6 KiB
C
/*
|
|
* include/haproxy/tcpcheck.h
|
|
* Functions prototypes for the TCP checks.
|
|
*
|
|
* Copyright 2000-2009,2020 Willy Tarreau <w@1wt.eu>
|
|
* Copyright 2007-2010 Krzysztof Piotr Oledzki <ole@ans.pl>
|
|
* Copyright 2013 Baptiste Assmann <bedis9@gmail.com>
|
|
* Copyright 2020 Gaetan Rivet <grive@u256.net>
|
|
* Copyright 2020 Christopher Faulet <cfaulet@haproxy.com>
|
|
*
|
|
* 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 _HAPROXY_TCPCHECK_H
|
|
#define _HAPROXY_TCPCHECK_H
|
|
|
|
#include <haproxy/action.h>
|
|
#include <haproxy/check-t.h>
|
|
#include <haproxy/pool-t.h>
|
|
#include <haproxy/proxy-t.h>
|
|
#include <haproxy/tcpcheck-t.h>
|
|
|
|
extern struct action_kw_list tcp_check_keywords;
|
|
extern struct pool_head *pool_head_tcpcheck_rule;
|
|
|
|
int tcpcheck_get_step_id(const struct check *check, const struct tcpcheck_rule *rule);
|
|
struct tcpcheck_rule *get_first_tcpcheck_rule(const struct tcpcheck_rules *rules);
|
|
|
|
struct tcpcheck_ruleset *create_tcpcheck_ruleset(const char *name);
|
|
struct tcpcheck_ruleset *find_tcpcheck_ruleset(const char *name);
|
|
void free_tcpcheck_ruleset(struct tcpcheck_ruleset *rs);
|
|
|
|
void free_tcpcheck(struct tcpcheck_rule *rule, int in_pool);
|
|
void deinit_proxy_tcpcheck(struct proxy *px);
|
|
|
|
struct tcpcheck_var *create_tcpcheck_var(const struct ist name);
|
|
void free_tcpcheck_var(struct tcpcheck_var *var);
|
|
int dup_tcpcheck_vars(struct list *dst, const struct list *src);
|
|
void free_tcpcheck_vars(struct list *vars);
|
|
|
|
int add_tcpcheck_expect_str(struct tcpcheck_rules *rules, const char *str);
|
|
int add_tcpcheck_send_strs(struct tcpcheck_rules *rules, const char * const *strs);
|
|
int tcpcheck_add_http_rule(struct tcpcheck_rule *chk, struct tcpcheck_rules *rules, char **errmsg);
|
|
|
|
void free_tcpcheck_http_hdr(struct tcpcheck_http_hdr *hdr);
|
|
|
|
enum tcpcheck_eval_ret tcpcheck_mysql_expect_iniths(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_mysql_expect_ok(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_ldap_expect_bindrsp(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_spop_expect_agenthello(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_agent_expect_reply(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpcheck_rule *rule);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_send(struct check *check, struct tcpcheck_rule *rule);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_rule *rule);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_expect_http(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_expect(struct check *check, struct tcpcheck_rule *rule, int last_read);
|
|
enum tcpcheck_eval_ret tcpcheck_eval_action_kw(struct check *check, struct tcpcheck_rule *rule);
|
|
int tcpcheck_main(struct check *check);
|
|
struct tcpcheck_rule *parse_tcpcheck_action(char **args, int cur_arg, struct proxy *px,
|
|
struct list *rules, struct action_kw *kw,
|
|
const char *file, int line, char **errmsg);
|
|
struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, struct proxy *px, struct list *rules,
|
|
const char *file, int line, char **errmsg);
|
|
struct tcpcheck_rule *parse_tcpcheck_send(char **args, int cur_arg, struct proxy *px, struct list *rules,
|
|
const char *file, int line, char **errmsg);
|
|
struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg, struct proxy *px, struct list *rules,
|
|
const char *file, int line, char **errmsg);
|
|
struct tcpcheck_rule *parse_tcpcheck_comment(char **args, int cur_arg, struct proxy *px, struct list *rules,
|
|
const char *file, int line, char **errmsg);
|
|
struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct proxy *px,
|
|
struct list *rules, unsigned int proto,
|
|
const char *file, int line, char **errmsg);
|
|
|
|
int proxy_parse_tcp_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_redis_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_ssl_hello_chk_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_smtpchk_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_pgsql_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_mysql_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_ldap_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
|
|
const char *file, int line);
|
|
|
|
|
|
/* Return the struct action_kw associated to a keyword */
|
|
static inline struct action_kw *action_kw_tcp_check_lookup(const char *kw)
|
|
{
|
|
return action_lookup(&tcp_check_keywords.list, kw);
|
|
}
|
|
|
|
static inline void action_kw_tcp_check_build_list(struct buffer *chk)
|
|
{
|
|
action_build_list(&tcp_check_keywords.list, chk);
|
|
}
|
|
|
|
static inline void tcp_check_keywords_register(struct action_kw_list *kw_list)
|
|
{
|
|
LIST_APPEND(&tcp_check_keywords.list, &kw_list->list);
|
|
}
|
|
|
|
#endif /* _HAPROXY_TCPCHECK_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|