~ubuntu-branches/ubuntu/trusty/haproxy/trusty-updates

« back to all changes in this revision

Viewing changes to include/proto/proxy.h

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2010-04-15 20:00:34 UTC
  • mfrom: (1.2.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20100415200034-mtlky4sy39tk0dfi
Tags: upstream-1.4.4
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  include/proto/proxy.h
3
 
  This file defines function prototypes for proxy management.
4
 
 
5
 
  Copyright (C) 2000-2008 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
 
*/
 
2
 * include/proto/proxy.h
 
3
 * This file defines function prototypes for proxy management.
 
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
21
 
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);
38
39
 
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);
44
48
 
45
49
/*
46
50
 * This function returns a string containing the type of the proxy in a format
65
69
}
66
70
 
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)
69
73
{
70
 
        fe->cum_feconn++;
 
74
        fe->counters.cum_feconn++;
 
75
        if (l->counters)
 
76
                l->counters->cum_conn++;
 
77
 
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;
74
81
}
75
82
 
76
83
/* increase the number of cumulated connections on the designated backend */
77
84
static void inline proxy_inc_be_ctr(struct proxy *be)
78
85
{
79
 
        be->cum_beconn++;
 
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;
 
90
}
 
91
 
 
92
/* increase the number of cumulated requests on the designated frontend */
 
93
static void inline proxy_inc_fe_req_ctr(struct proxy *fe)
 
94
{
 
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;
83
99
}
84
100
 
85
101
#endif /* _PROTO_PROXY_H */