From 8e85ad5211849026c86ddcb32701eeb3035eb526 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 11 Dec 2013 16:45:07 +0100 Subject: [PATCH] REORG: checks: retrieve the check-specific defines from server.h to checks.h After the move of checks from servers to autonomous checks, we need a massive cleanup and reordering as it's becoming increasingly difficult to find the definitions of types and enums. Nothing was changed, blocks were just moved. --- include/types/checks.h | 44 ++++++++++++++++++++++++++++++++++++++++++ include/types/server.h | 33 ------------------------------- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/include/types/checks.h b/include/types/checks.h index 956df3a0c1..381c990fbd 100644 --- a/include/types/checks.h +++ b/include/types/checks.h @@ -13,6 +13,28 @@ #ifndef _TYPES_CHECKS_H #define _TYPES_CHECKS_H +#include + +#include +#include +#include + +#include +#include +#include +#include + + +/* bits for s->result used for health-checks */ +#define SRV_CHK_UNKNOWN 0x0000 +#define SRV_CHK_FAILED 0x0001 +#define SRV_CHK_PASSED 0x0002 +#define SRV_CHK_DISABLE 0x0004 + +/* check flags */ +#define CHK_STATE_RUNNING 0x0001 /* this check is currently running */ +#define CHK_STATE_DISABLED 0x0002 /* this check is currently administratively disabled */ + /* check status */ enum { HCHK_STATUS_UNKNOWN = 0, /* Unknown */ @@ -95,6 +117,28 @@ enum { HANA_OBS_SIZE }; +struct check { + struct connection *conn; /* connection state for health checks */ + unsigned short port; /* the port to use for the health checks */ + struct buffer *bi, *bo; /* input and output buffers to send/recv check */ + struct task *task; /* the task associated to the health check processing, NULL if disabled */ + struct timeval start; /* last health check start time */ + long duration; /* time in ms took to finish last health check */ + short status, code; /* check result, check code */ + char desc[HCHK_DESC_LEN]; /* health check descritpion */ + int use_ssl; /* use SSL for health checks */ + int send_proxy; /* send a PROXY protocol header with checks */ + struct tcpcheck_rule *current_step; /* current step when using tcpcheck */ + int inter, fastinter, downinter; /* checks: time in milliseconds */ + int result; /* health-check result : SRV_CHK_* */ + int state; /* health-check result : CHK_* */ + int health; /* 0 to rise-1 = bad; + * rise to rise+fall-1 = good */ + int rise, fall; /* time in iterations */ + int type; /* Check type, one of PR_O2_*_CHK */ + struct server *server; /* back-pointer to server */ +}; + struct check_status { short result; /* one of SRV_CHK_* */ char *info; /* human readable short info */ diff --git a/include/types/server.h b/include/types/server.h index a3775a7c88..7775369d61 100644 --- a/include/types/server.h +++ b/include/types/server.h @@ -67,16 +67,6 @@ #define SRV_STATUS_FULL 3 /* the/all server(s) are saturated */ #define SRV_STATUS_QUEUED 4 /* the/all server(s) are saturated but the connection was queued */ -/* bits for s->result used for health-checks */ -#define SRV_CHK_UNKNOWN 0x0000 /* initialized to this by default */ -#define SRV_CHK_FAILED 0x0001 /* server check failed, flag has precedence over SRV_CHK_PASSED */ -#define SRV_CHK_PASSED 0x0002 /* server check succeeded unless FAILED is also set */ -#define SRV_CHK_DISABLE 0x0004 /* server returned a "disable" code */ - -/* check flags */ -#define CHK_STATE_RUNNING 0x0001 /* this check is currently running */ -#define CHK_STATE_DISABLED 0x0002 /* this check is currently administratively disabled */ - /* various constants */ #define SRV_UWGHT_RANGE 256 #define SRV_UWGHT_MAX (SRV_UWGHT_RANGE) @@ -110,29 +100,6 @@ struct tree_occ { struct eb32_node node; }; -struct check { - struct connection *conn; /* connection state for health checks */ - - unsigned short port; /* the port to use for the health checks */ - struct buffer *bi, *bo; /* input and output buffers to send/recv check */ - struct task *task; /* the task associated to the health check processing, NULL if disabled */ - struct timeval start; /* last health check start time */ - long duration; /* time in ms took to finish last health check */ - short status, code; /* check result, check code */ - char desc[HCHK_DESC_LEN]; /* health check descritpion */ - int use_ssl; /* use SSL for health checks */ - int send_proxy; /* send a PROXY protocol header with checks */ - struct tcpcheck_rule *current_step; /* current step when using tcpcheck */ - int inter, fastinter, downinter; /* checks: time in milliseconds */ - int result; /* health-check result : SRV_CHK_* */ - int state; /* health-check result : CHK_* */ - int health; /* 0 to rise-1 = bad; - * rise to rise+fall-1 = good */ - int rise, fall; /* time in iterations */ - int type; /* Check type, one of PR_O2_*_CHK */ - struct server *server; /* back-pointer to server */ -}; - struct server { enum obj_type obj_type; /* object type == OBJ_TYPE_SERVER */ struct server *next;