1 /*
2   include/proto/checks.h
3   Functions prototypes for the checks.
4 
5   Copyright (C) 2000-2009 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 _PROTO_CHECKS_H
23 #define _PROTO_CHECKS_H
24 
25 #include <types/task.h>
26 #include <common/config.h>
27 #include <types/mailers.h>
28 
29 const char *get_check_status_description(short check_status);
30 const char *get_check_status_info(short check_status);
31 void __health_adjust(struct server *s, short status);
32 
33 extern struct data_cb check_conn_cb;
34 
35 /* Use this one only. This inline version only ensures that we don't
36  * call the function when the observe mode is disabled.
37  */
health_adjust(struct server * s,short status)38 static inline void health_adjust(struct server *s, short status)
39 {
40 	HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
41 	/* return now if observing nor health check is not enabled */
42 	if (!s->observe || !s->check.task) {
43 		HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
44 		return;
45 	}
46 
47 	__health_adjust(s, status);
48 	HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
49 }
50 
51 const char *init_check(struct check *check, int type);
52 void free_check(struct check *check);
53 void deinit_srv_check(struct server *srv);
54 void deinit_srv_agent_check(struct server *srv);
55 
56 int init_email_alert(struct mailers *mailers, struct proxy *p, char **err);
57 void send_email_alert(struct server *s, int priority, const char *format, ...)
58 	__attribute__ ((format(printf, 3, 4)));
59 int srv_check_healthcheck_port(struct check *chk);
60 
61 /* Declared here, but the definitions are in flt_spoe.c */
62 int spoe_prepare_healthcheck_request(char **req, int *len);
63 int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen);
64 
65 #endif /* _PROTO_CHECKS_H */
66 
67 /*
68  * Local variables:
69  *  c-indent-level: 8
70  *  c-basic-offset: 8
71  * End:
72  */
73