/src/haproxy/include/haproxy/check.h
Line | Count | Source |
1 | | /* |
2 | | * include/haproxy/check.h |
3 | | * Functions prototypes for the checks. |
4 | | * |
5 | | * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu |
6 | | * |
7 | | * This library is free software; you can redistribute it and/or |
8 | | * modify it under the terms of the GNU Lesser General Public |
9 | | * License as published by the Free Software Foundation, version 2.1 |
10 | | * exclusively. |
11 | | * |
12 | | * This library is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | | * Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General Public |
18 | | * License along with this library; if not, write to the Free Software |
19 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | | */ |
21 | | |
22 | | #ifndef _HAPROXY_CHECKS_H |
23 | | #define _HAPROXY_CHECKS_H |
24 | | |
25 | | #include <haproxy/check-t.h> |
26 | | #include <haproxy/proxy-t.h> |
27 | | #include <haproxy/server-t.h> |
28 | | #include <haproxy/trace-t.h> |
29 | | #include <haproxy/log.h> |
30 | | |
31 | | extern struct trace_source trace_check; |
32 | | |
33 | | /* Details about these events are defined in <src/check.c> */ |
34 | | #define CHK_EV_TASK_WAKE (1ULL << 0) |
35 | | #define CHK_EV_HCHK_START (1ULL << 1) |
36 | | #define CHK_EV_HCHK_WAKE (1ULL << 2) |
37 | | #define CHK_EV_HCHK_RUN (1ULL << 3) |
38 | | #define CHK_EV_HCHK_END (1ULL << 4) |
39 | | #define CHK_EV_HCHK_SUCC (1ULL << 5) |
40 | | #define CHK_EV_HCHK_ERR (1ULL << 6) |
41 | | #define CHK_EV_HCHK (CHK_EV_HCHK_START|CHK_EV_HCHK_WAKE|CHK_EV_HCHK_RUN|\ |
42 | | CHK_EV_HCHK_END|CHK_EV_HCHK_SUCC|CHK_EV_HCHK_ERR) |
43 | | |
44 | 0 | #define CHK_EV_TCPCHK_EVAL (1ULL << 7) |
45 | 0 | #define CHK_EV_TCPCHK_ERR (1ULL << 8) |
46 | 0 | #define CHK_EV_TCPCHK_CONN (1ULL << 9) |
47 | 0 | #define CHK_EV_TCPCHK_SND (1ULL << 10) |
48 | 0 | #define CHK_EV_TCPCHK_EXP (1ULL << 11) |
49 | 0 | #define CHK_EV_TCPCHK_ACT (1ULL << 12) |
50 | 0 | #define CHK_EV_TCPCHK (CHK_EV_TCPCHK_EVAL|CHK_EV_TCPCHK_ERR|CHK_EV_TCPCHK_CONN|\ |
51 | 0 | CHK_EV_TCPCHK_SND|CHK_EV_TCPCHK_EXP|CHK_EV_TCPCHK_ACT) |
52 | | |
53 | 0 | #define CHK_EV_RX_DATA (1ULL << 13) |
54 | 0 | #define CHK_EV_RX_BLK (1ULL << 14) |
55 | 0 | #define CHK_EV_RX_ERR (1ULL << 15) |
56 | 0 | #define CHK_EV_RX (CHK_EV_RX_DATA|CHK_EV_RX_BLK|CHK_EV_RX_ERR) |
57 | | |
58 | 0 | #define CHK_EV_TX_DATA (1ULL << 16) |
59 | 0 | #define CHK_EV_TX_BLK (1ULL << 17) |
60 | 0 | #define CHK_EV_TX_ERR (1ULL << 18) |
61 | 0 | #define CHK_EV_TX (CHK_EV_TX_DATA|CHK_EV_TX_BLK|CHK_EV_TX_ERR) |
62 | | |
63 | | extern struct data_cb check_conn_cb; |
64 | | extern struct proxy checks_fe; |
65 | | |
66 | | short get_check_status_result(short check_status); |
67 | | const char *get_check_status_description(short check_status); |
68 | | const char *get_check_status_info(short check_status); |
69 | | int httpchk_build_status_header(struct server *s, struct buffer *buf); |
70 | | void __health_adjust(struct server *s, short status); |
71 | | void check_append_info(struct buffer *msg, struct check *check); |
72 | | void set_server_check_status(struct check *check, short status, const char *desc); |
73 | | void chk_report_conn_err(struct check *check, int errno_bck, int expired); |
74 | | void check_notify_failure(struct check *check); |
75 | | void check_notify_stopping(struct check *check); |
76 | | void check_notify_success(struct check *check); |
77 | | struct task *process_chk(struct task *t, void *context, unsigned int state); |
78 | | |
79 | | struct task *srv_chk_io_cb(struct task *t, void *ctx, unsigned int state); |
80 | | |
81 | | int check_buf_available(void *target); |
82 | | struct buffer *check_get_buf(struct check *check, struct buffer *bptr, unsigned int small_buffer); |
83 | | void check_release_buf(struct check *check, struct buffer *bptr); |
84 | | |
85 | | static inline struct ist check_generate_unique_id(struct check *check, struct lf_expr *format) |
86 | 0 | { |
87 | 0 | if (!isttest(check->unique_id)) { |
88 | 0 | generate_unique_id(&check->unique_id, check->sess, NULL, format); |
89 | 0 | } |
90 | |
|
91 | 0 | return check->unique_id; |
92 | 0 | } Unexecuted instantiation: cfgparse.c:check_generate_unique_id Unexecuted instantiation: cli.c:check_generate_unique_id Unexecuted instantiation: http_ana.c:check_generate_unique_id Unexecuted instantiation: resolvers.c:check_generate_unique_id Unexecuted instantiation: server.c:check_generate_unique_id Unexecuted instantiation: stats-proxy.c:check_generate_unique_id Unexecuted instantiation: stats.c:check_generate_unique_id Unexecuted instantiation: stconn.c:check_generate_unique_id Unexecuted instantiation: stream.c:check_generate_unique_id Unexecuted instantiation: tcpcheck.c:check_generate_unique_id Unexecuted instantiation: vars.c:check_generate_unique_id Unexecuted instantiation: backend.c:check_generate_unique_id Unexecuted instantiation: cfgparse-listen.c:check_generate_unique_id Unexecuted instantiation: check.c:check_generate_unique_id Unexecuted instantiation: dns.c:check_generate_unique_id Unexecuted instantiation: extcheck.c:check_generate_unique_id Unexecuted instantiation: http_fetch.c:check_generate_unique_id Unexecuted instantiation: flt_spoe.c:check_generate_unique_id |
93 | | |
94 | | const char *init_check(struct check *check, int type); |
95 | | void free_check(struct check *check); |
96 | | void check_purge(struct check *check); |
97 | | |
98 | | int init_srv_check(struct server *srv); |
99 | | int init_srv_agent_check(struct server *srv); |
100 | | int start_check_task(struct check *check, int mininter, int nbcheck, int srvpos); |
101 | | |
102 | | int set_srv_agent_send(struct server *srv, const char *send); |
103 | | |
104 | | /* set agent addr and appropriate flag */ |
105 | | static inline void set_srv_agent_addr(struct server *srv, struct sockaddr_storage *sk) |
106 | 0 | { |
107 | 0 | srv->agent.addr = *sk; |
108 | 0 | srv->flags |= SRV_F_AGENTADDR; |
109 | 0 | } Unexecuted instantiation: cfgparse.c:set_srv_agent_addr Unexecuted instantiation: cli.c:set_srv_agent_addr Unexecuted instantiation: http_ana.c:set_srv_agent_addr Unexecuted instantiation: resolvers.c:set_srv_agent_addr Unexecuted instantiation: server.c:set_srv_agent_addr Unexecuted instantiation: stats-proxy.c:set_srv_agent_addr Unexecuted instantiation: stats.c:set_srv_agent_addr Unexecuted instantiation: stconn.c:set_srv_agent_addr Unexecuted instantiation: stream.c:set_srv_agent_addr Unexecuted instantiation: tcpcheck.c:set_srv_agent_addr Unexecuted instantiation: vars.c:set_srv_agent_addr Unexecuted instantiation: backend.c:set_srv_agent_addr Unexecuted instantiation: cfgparse-listen.c:set_srv_agent_addr Unexecuted instantiation: check.c:set_srv_agent_addr Unexecuted instantiation: dns.c:set_srv_agent_addr Unexecuted instantiation: extcheck.c:set_srv_agent_addr Unexecuted instantiation: http_fetch.c:set_srv_agent_addr Unexecuted instantiation: flt_spoe.c:set_srv_agent_addr |
110 | | |
111 | | /* set agent port and appropriate flag */ |
112 | | static inline void set_srv_agent_port(struct server *srv, int port) |
113 | 0 | { |
114 | 0 | srv->agent.port = port; |
115 | 0 | srv->flags |= SRV_F_AGENTPORT; |
116 | 0 | } Unexecuted instantiation: cfgparse.c:set_srv_agent_port Unexecuted instantiation: cli.c:set_srv_agent_port Unexecuted instantiation: http_ana.c:set_srv_agent_port Unexecuted instantiation: resolvers.c:set_srv_agent_port Unexecuted instantiation: server.c:set_srv_agent_port Unexecuted instantiation: stats-proxy.c:set_srv_agent_port Unexecuted instantiation: stats.c:set_srv_agent_port Unexecuted instantiation: stconn.c:set_srv_agent_port Unexecuted instantiation: stream.c:set_srv_agent_port Unexecuted instantiation: tcpcheck.c:set_srv_agent_port Unexecuted instantiation: vars.c:set_srv_agent_port Unexecuted instantiation: backend.c:set_srv_agent_port Unexecuted instantiation: cfgparse-listen.c:set_srv_agent_port Unexecuted instantiation: check.c:set_srv_agent_port Unexecuted instantiation: dns.c:set_srv_agent_port Unexecuted instantiation: extcheck.c:set_srv_agent_port Unexecuted instantiation: http_fetch.c:set_srv_agent_port Unexecuted instantiation: flt_spoe.c:set_srv_agent_port |
117 | | |
118 | | /* Use this one only. This inline version only ensures that we don't |
119 | | * call the function when the observe mode is disabled. |
120 | | */ |
121 | | static inline void health_adjust(struct server *s, short status) |
122 | 0 | { |
123 | | /* return now if observing nor health check is not enabled */ |
124 | 0 | if (!s->observe || !s->check.task) |
125 | 0 | return; |
126 | | |
127 | 0 | __health_adjust(s, status); |
128 | 0 | } Unexecuted instantiation: cfgparse.c:health_adjust Unexecuted instantiation: cli.c:health_adjust Unexecuted instantiation: http_ana.c:health_adjust Unexecuted instantiation: resolvers.c:health_adjust Unexecuted instantiation: server.c:health_adjust Unexecuted instantiation: stats-proxy.c:health_adjust Unexecuted instantiation: stats.c:health_adjust Unexecuted instantiation: stconn.c:health_adjust Unexecuted instantiation: stream.c:health_adjust Unexecuted instantiation: tcpcheck.c:health_adjust Unexecuted instantiation: vars.c:health_adjust Unexecuted instantiation: backend.c:health_adjust Unexecuted instantiation: cfgparse-listen.c:health_adjust Unexecuted instantiation: check.c:health_adjust Unexecuted instantiation: dns.c:health_adjust Unexecuted instantiation: extcheck.c:health_adjust Unexecuted instantiation: http_fetch.c:health_adjust Unexecuted instantiation: flt_spoe.c:health_adjust |
129 | | |
130 | | #endif /* _HAPROXY_CHECKS_H */ |
131 | | |
132 | | /* |
133 | | * Local variables: |
134 | | * c-indent-level: 8 |
135 | | * c-basic-offset: 8 |
136 | | * End: |
137 | | */ |