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.
This commit is contained in:
Willy Tarreau 2013-12-11 16:45:07 +01:00
parent 1a53a3af13
commit 8e85ad5211
2 changed files with 44 additions and 33 deletions

View File

@ -13,6 +13,28 @@
#ifndef _TYPES_CHECKS_H
#define _TYPES_CHECKS_H
#include <sys/time.h>
#include <common/config.h>
#include <common/mini-clist.h>
#include <common/regex.h>
#include <types/connection.h>
#include <types/obj_type.h>
#include <types/task.h>
#include <types/server.h>
/* 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 */

View File

@ -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;