summaryrefslogtreecommitdiff
path: root/modules/proxy/mod_proxy.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/proxy/mod_proxy.h')
-rw-r--r--modules/proxy/mod_proxy.h79
1 files changed, 76 insertions, 3 deletions
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
index 72dab333..f1413c56 100644
--- a/modules/proxy/mod_proxy.h
+++ b/modules/proxy/mod_proxy.h
@@ -75,6 +75,22 @@ enum enctype {
enc_path, enc_search, enc_user, enc_fpath, enc_parm
};
+typedef enum {
+ NONE, TCP, OPTIONS, HEAD, GET, CPING, PROVIDER, EOT
+} hcmethod_t;
+
+typedef struct {
+ hcmethod_t method;
+ char *name;
+ int implemented;
+} proxy_hcmethods_t;
+
+typedef struct {
+ unsigned int bit;
+ char flag;
+ const char *name;
+} proxy_wstat_t;
+
#define BALANCER_PREFIX "balancer://"
#if APR_CHARSET_EBCDIC
@@ -139,7 +155,7 @@ typedef struct {
proxy_worker *reverse; /* reverse "module-driven" proxy worker */
const char *domain; /* domain name to use in absence of a domain name in the request */
const char *id;
- apr_pool_t *pool; /* Pool used for allocating this struct */
+ apr_pool_t *pool; /* Pool used for allocating this struct's elements */
int req; /* true if proxy requests are enabled */
int max_balancers; /* maximum number of allowed balancers */
int bgrowth; /* number of post-config balancers can added */
@@ -270,8 +286,11 @@ struct proxy_conn_pool {
proxy_conn_rec *conn; /* Single connection for prefork mpm */
};
-/* Keep below in sync with proxy_util.c! */
/* worker status bits */
+/*
+ * NOTE: Keep up-to-date w/ proxy_wstat_tbl[]
+ * in mod_proxy.c !
+ */
#define PROXY_WORKER_INITIALIZED 0x0001
#define PROXY_WORKER_IGNORE_ERRORS 0x0002
#define PROXY_WORKER_DRAIN 0x0004
@@ -282,6 +301,7 @@ struct proxy_conn_pool {
#define PROXY_WORKER_IN_ERROR 0x0080
#define PROXY_WORKER_HOT_STANDBY 0x0100
#define PROXY_WORKER_FREE 0x0200
+#define PROXY_WORKER_HC_FAIL 0x0400
/* worker status flags */
#define PROXY_WORKER_INITIALIZED_FLAG 'O'
@@ -294,9 +314,11 @@ struct proxy_conn_pool {
#define PROXY_WORKER_IN_ERROR_FLAG 'E'
#define PROXY_WORKER_HOT_STANDBY_FLAG 'H'
#define PROXY_WORKER_FREE_FLAG 'F'
+#define PROXY_WORKER_HC_FAIL_FLAG 'C'
#define PROXY_WORKER_NOT_USABLE_BITMAP ( PROXY_WORKER_IN_SHUTDOWN | \
-PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
+PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR | \
+PROXY_WORKER_HC_FAIL )
/* NOTE: these check the shared status */
#define PROXY_WORKER_IS_INITIALIZED(f) ( (f)->s->status & PROXY_WORKER_INITIALIZED )
@@ -310,6 +332,10 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
#define PROXY_WORKER_IS_GENERIC(f) ( (f)->s->status & PROXY_WORKER_GENERIC )
+#define PROXY_WORKER_IS_HCFAILED(f) ( (f)->s->status & PROXY_WORKER_HC_FAIL )
+
+#define PROXY_WORKER_IS(f, b) ( (f)->s->status & (b) )
+
/* default worker retry timeout in seconds */
#define PROXY_WORKER_DEFAULT_RETRY 60
@@ -349,6 +375,7 @@ typedef struct {
} proxy_hashes ;
/* Runtime worker status informations. Shared in scoreboard */
+/* The addition of member uds_path in 2.4.7 was an incompatible API change. */
typedef struct {
char name[PROXY_WORKER_MAX_NAME_SIZE];
char scheme[PROXY_WORKER_MAX_SCHEME_SIZE]; /* scheme to use ajp|http|https */
@@ -403,6 +430,14 @@ typedef struct {
unsigned int keepalive_set:1;
unsigned int disablereuse_set:1;
unsigned int was_malloced:1;
+ char hcuri[PROXY_WORKER_MAX_ROUTE_SIZE]; /* health check uri */
+ char hcexpr[PROXY_WORKER_MAX_SCHEME_SIZE]; /* name of condition expr for health check */
+ int passes; /* number of successes for check to pass */
+ int pcount; /* current count of passes */
+ int fails; /* number of failures for check to fail */
+ int fcount; /* current count of failures */
+ hcmethod_t method; /* method to use for health check */
+ apr_interval_time_t interval;
} proxy_worker_shared;
#define ALIGNED_PROXY_WORKER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
@@ -418,6 +453,11 @@ struct proxy_worker {
void *context; /* general purpose storage */
};
+/* default to health check every 30 seconds */
+#define HCHECK_WATHCHDOG_DEFAULT_INTERVAL (30)
+/* The watchdog runs every 2 seconds, which is also the minimal check */
+#define HCHECK_WATHCHDOG_INTERVAL (2)
+
/*
* Time to wait (in microseconds) to find out if more data is currently
* available at the backend.
@@ -508,6 +548,26 @@ struct proxy_balancer_method {
#define PROXY_DECLARE_DATA __declspec(dllimport)
#endif
+/* Using PROXY_DECLARE_OPTIONAL_HOOK instead of
+ * APR_DECLARE_EXTERNAL_HOOK allows build/make_nw_export.awk
+ * to distinguish between hooks that implement
+ * proxy_hook_xx and proxy_hook_get_xx in mod_proxy.c and
+ * those which don't.
+ */
+#define PROXY_DECLARE_OPTIONAL_HOOK APR_DECLARE_EXTERNAL_HOOK
+
+/* These 2 are in mod_proxy.c */
+extern PROXY_DECLARE_DATA proxy_hcmethods_t proxy_hcmethods[];
+extern PROXY_DECLARE_DATA proxy_wstat_t proxy_wstat_tbl[];
+
+/* Following 4 from health check */
+APR_DECLARE_OPTIONAL_FN(void, hc_show_exprs, (request_rec *));
+APR_DECLARE_OPTIONAL_FN(void, hc_select_exprs, (request_rec *, const char *));
+APR_DECLARE_OPTIONAL_FN(int, hc_valid_expr, (request_rec *, const char *));
+APR_DECLARE_OPTIONAL_FN(const char *, set_worker_hc_param,
+ (apr_pool_t *, server_rec *, proxy_worker *,
+ const char *, const char *, void *));
+
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
proxy_worker *worker, proxy_server_conf *conf, char *url,
const char *proxyhost, apr_port_t proxyport))
@@ -1019,6 +1079,12 @@ PROXY_DECLARE(int) ap_proxy_pass_brigade(apr_bucket_alloc_t *bucket_alloc,
APR_DECLARE_OPTIONAL_FN(int, ap_proxy_clear_connection,
(request_rec *r, apr_table_t *headers));
+/**
+ * @param socket socket to test
+ * @return TRUE if socket is connected/active
+ */
+PROXY_DECLARE(int) ap_proxy_is_socket_connected(apr_socket_t *socket);
+
#define PROXY_LBMETHOD "proxylbmethod"
/* The number of dynamic workers that can be added when reconfiguring.
@@ -1040,6 +1106,13 @@ int ap_proxy_lb_workers(void);
PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme);
/**
+ * Return the name of the health check method (eg: "OPTIONS").
+ * @param method method enum
+ * @return name of method
+ */
+PROXY_DECLARE (const char *) ap_proxy_show_hcmethod(hcmethod_t method);
+
+/**
* Strip a unix domain socket (UDS) prefix from the input URL
* @param p pool to allocate result from
* @param url a URL potentially prefixed with a UDS path