3
This file defines function prototypes for proxy management.
5
Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
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
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.
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
2
* include/proto/proxy.h
3
* This file defines function prototypes for proxy management.
5
* Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
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
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.
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
22
22
#ifndef _PROTO_PROXY_H
23
23
#define _PROTO_PROXY_H
35
35
void stop_proxy(struct proxy *p);
36
36
void pause_proxies(void);
37
37
void listen_proxies(void);
38
int session_set_backend(struct session *s, struct proxy *be);
39
40
const char *proxy_cap_str(int cap);
40
41
const char *proxy_mode_str(int mode);
41
struct proxy *findproxy(const char *name, int mode, int cap);
42
struct proxy *findproxy_mode(const char *name, int mode, int cap);
43
struct proxy *findproxy(const char *name, int cap);
42
44
struct server *findserver(const struct proxy *px, const char *name);
43
45
int proxy_cfg_ensure_no_http(struct proxy *curproxy);
46
int get_backend_server(const char *bk_name, const char *sv_name,
47
struct proxy **bk, struct server **sv);
46
50
* This function returns a string containing the type of the proxy in a format
67
71
/* increase the number of cumulated connections on the designated frontend */
68
static void inline proxy_inc_fe_ctr(struct proxy *fe)
72
static void inline proxy_inc_fe_ctr(struct listener *l, struct proxy *fe)
74
fe->counters.cum_feconn++;
76
l->counters->cum_conn++;
71
78
update_freq_ctr(&fe->fe_sess_per_sec, 1);
72
if (fe->fe_sess_per_sec.curr_ctr > fe->fe_sps_max)
73
fe->fe_sps_max = fe->fe_sess_per_sec.curr_ctr;
79
if (fe->fe_sess_per_sec.curr_ctr > fe->counters.fe_sps_max)
80
fe->counters.fe_sps_max = fe->fe_sess_per_sec.curr_ctr;
76
83
/* increase the number of cumulated connections on the designated backend */
77
84
static void inline proxy_inc_be_ctr(struct proxy *be)
86
be->counters.cum_beconn++;
80
87
update_freq_ctr(&be->be_sess_per_sec, 1);
81
if (be->be_sess_per_sec.curr_ctr > be->be_sps_max)
82
be->be_sps_max = be->be_sess_per_sec.curr_ctr;
88
if (be->be_sess_per_sec.curr_ctr > be->counters.be_sps_max)
89
be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr;
92
/* increase the number of cumulated requests on the designated frontend */
93
static void inline proxy_inc_fe_req_ctr(struct proxy *fe)
95
fe->counters.cum_fe_req++;
96
update_freq_ctr(&fe->fe_req_per_sec, 1);
97
if (fe->fe_req_per_sec.curr_ctr > fe->counters.fe_rps_max)
98
fe->counters.fe_rps_max = fe->fe_req_per_sec.curr_ctr;
85
101
#endif /* _PROTO_PROXY_H */