Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 4aa573d | 2020-06-04 18:21:56 +0200 | [diff] [blame] | 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 | */ |
Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 21 | |
Willy Tarreau | 4aa573d | 2020-06-04 18:21:56 +0200 | [diff] [blame] | 22 | #ifndef _HAPROXY_CHECKS_H |
| 23 | #define _HAPROXY_CHECKS_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | 4aa573d | 2020-06-04 18:21:56 +0200 | [diff] [blame] | 25 | #include <haproxy/check-t.h> |
Willy Tarreau | a264d96 | 2020-06-04 22:29:18 +0200 | [diff] [blame] | 26 | #include <haproxy/proxy-t.h> |
Willy Tarreau | 1e56f92 | 2020-06-04 23:20:13 +0200 | [diff] [blame] | 27 | #include <haproxy/server-t.h> |
Gaetan Rivet | 13a5043 | 2020-02-21 18:13:44 +0100 | [diff] [blame] | 28 | |
Willy Tarreau | 51cd595 | 2020-06-05 12:25:38 +0200 | [diff] [blame] | 29 | extern struct data_cb check_conn_cb; |
| 30 | extern struct proxy checks_fe; |
Willy Tarreau | cee013e | 2020-06-05 11:40:38 +0200 | [diff] [blame] | 31 | |
Christopher Faulet | 7aa3271 | 2021-02-01 13:11:50 +0100 | [diff] [blame] | 32 | short get_check_status_result(short check_status); |
Krzysztof Piotr Oledzki | 0960541 | 2009-09-23 22:09:24 +0200 | [diff] [blame] | 33 | const char *get_check_status_description(short check_status); |
| 34 | const char *get_check_status_info(short check_status); |
Willy Tarreau | 51cd595 | 2020-06-05 12:25:38 +0200 | [diff] [blame] | 35 | int httpchk_build_status_header(struct server *s, struct buffer *buf); |
Willy Tarreau | 9fe7aae | 2013-12-31 23:47:37 +0100 | [diff] [blame] | 36 | void __health_adjust(struct server *s, short status); |
Willy Tarreau | 51cd595 | 2020-06-05 12:25:38 +0200 | [diff] [blame] | 37 | void set_server_check_status(struct check *check, short status, const char *desc); |
| 38 | void chk_report_conn_err(struct check *check, int errno_bck, int expired); |
Willy Tarreau | bcc6733 | 2020-06-05 15:31:31 +0200 | [diff] [blame] | 39 | void check_notify_failure(struct check *check); |
| 40 | void check_notify_stopping(struct check *check); |
| 41 | void check_notify_success(struct check *check); |
Willy Tarreau | cee013e | 2020-06-05 11:40:38 +0200 | [diff] [blame] | 42 | struct task *process_chk(struct task *t, void *context, unsigned short state); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 43 | |
Christopher Faulet | b381a50 | 2020-11-25 13:47:00 +0100 | [diff] [blame] | 44 | int check_buf_available(void *target); |
| 45 | struct buffer *check_get_buf(struct check *check, struct buffer *bptr); |
| 46 | void check_release_buf(struct check *check, struct buffer *bptr); |
Willy Tarreau | cee013e | 2020-06-05 11:40:38 +0200 | [diff] [blame] | 47 | const char *init_check(struct check *check, int type); |
Simon Horman | bfb5d33 | 2015-01-30 11:22:55 +0900 | [diff] [blame] | 48 | void free_check(struct check *check); |
Christopher Faulet | 7a1e2e1 | 2020-04-02 18:05:11 +0200 | [diff] [blame] | 49 | |
Christopher Faulet | ba7bc16 | 2016-11-07 21:07:38 +0100 | [diff] [blame] | 50 | /* Declared here, but the definitions are in flt_spoe.c */ |
Christopher Faulet | 8ef7525 | 2017-02-20 22:56:03 +0100 | [diff] [blame] | 51 | int spoe_prepare_healthcheck_request(char **req, int *len); |
| 52 | int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen); |
Christopher Faulet | ba7bc16 | 2016-11-07 21:07:38 +0100 | [diff] [blame] | 53 | |
Christopher Faulet | 0ae3d1d | 2020-04-06 17:54:24 +0200 | [diff] [blame] | 54 | int set_srv_agent_send(struct server *srv, const char *send); |
William Dauchy | 1c921cd | 2021-02-03 22:30:08 +0100 | [diff] [blame] | 55 | void set_srv_agent_addr(struct server *srv, struct sockaddr_storage *sk); |
William Dauchy | 4858fb2 | 2021-02-03 22:30:09 +0100 | [diff] [blame] | 56 | void set_srv_agent_port(struct server *srv, int port); |
Christopher Faulet | 0ae3d1d | 2020-04-06 17:54:24 +0200 | [diff] [blame] | 57 | |
Willy Tarreau | cee013e | 2020-06-05 11:40:38 +0200 | [diff] [blame] | 58 | /* Use this one only. This inline version only ensures that we don't |
| 59 | * call the function when the observe mode is disabled. |
| 60 | */ |
| 61 | static inline void health_adjust(struct server *s, short status) |
| 62 | { |
| 63 | HA_SPIN_LOCK(SERVER_LOCK, &s->lock); |
| 64 | /* return now if observing nor health check is not enabled */ |
| 65 | if (!s->observe || !s->check.task) { |
| 66 | HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock); |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | __health_adjust(s, status); |
| 71 | HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock); |
| 72 | } |
| 73 | |
Willy Tarreau | 4aa573d | 2020-06-04 18:21:56 +0200 | [diff] [blame] | 74 | #endif /* _HAPROXY_CHECKS_H */ |
Willy TARREAU | 3dc0644 | 2006-06-15 21:48:13 +0200 | [diff] [blame] | 75 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 76 | /* |
| 77 | * Local variables: |
| 78 | * c-indent-level: 8 |
| 79 | * c-basic-offset: 8 |
| 80 | * End: |
| 81 | */ |