Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | include/proto/backend.h |
| 3 | Functions prototypes for the backend. |
| 4 | |
Willy Tarreau | efb453c | 2008-10-26 20:49:47 +0100 | [diff] [blame] | 5 | Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 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 | |
| 22 | #ifndef _PROTO_BACKEND_H |
| 23 | #define _PROTO_BACKEND_H |
| 24 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 25 | #include <common/config.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 26 | |
| 27 | #include <types/backend.h> |
| 28 | #include <types/session.h> |
| 29 | |
| 30 | #include <proto/queue.h> |
| 31 | |
| 32 | int assign_server(struct session *s); |
| 33 | int assign_server_address(struct session *s); |
| 34 | int assign_server_and_queue(struct session *s); |
| 35 | int connect_server(struct session *s); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 36 | int srv_redispatch_connect(struct session *t); |
Willy Tarreau | a0cbda6 | 2007-11-01 21:39:54 +0100 | [diff] [blame] | 37 | int backend_parse_balance(const char **args, char *err, |
| 38 | int errlen, struct proxy *curproxy); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 39 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 40 | void recalc_server_map(struct proxy *px); |
Krzysztof Oledzki | 8513094 | 2007-10-22 16:21:10 +0200 | [diff] [blame] | 41 | int be_downtime(struct proxy *px); |
Willy Tarreau | 5dc2fa6 | 2007-11-19 19:10:18 +0100 | [diff] [blame] | 42 | void init_server_map(struct proxy *p); |
Willy Tarreau | b625a08 | 2007-11-26 01:15:43 +0100 | [diff] [blame] | 43 | void fwrr_init_server_groups(struct proxy *p); |
Willy Tarreau | 5140623 | 2008-03-10 22:04:20 +0100 | [diff] [blame] | 44 | void fwlc_init_server_tree(struct proxy *p); |
Willy Tarreau | c5d9c80 | 2009-10-01 09:17:05 +0200 | [diff] [blame] | 45 | void recount_servers(struct proxy *px); |
| 46 | void update_backend_weight(struct proxy *px); |
Willy Tarreau | ca7d4b9 | 2009-10-01 09:21:55 +0200 | [diff] [blame^] | 47 | struct server *get_server_rr_with_conns(struct proxy *px, struct server *srvtoavoid); |
| 48 | struct server *get_server_sh(struct proxy *px, const char *addr, int len); |
| 49 | struct server *get_server_uh(struct proxy *px, char *uri, int uri_len); |
Willy Tarreau | c5d9c80 | 2009-10-01 09:17:05 +0200 | [diff] [blame] | 50 | |
| 51 | /* This function returns non-zero if a server with the given weight and state |
| 52 | * is usable for LB, otherwise zero. |
| 53 | */ |
| 54 | static inline int srv_is_usable(int state, int weight) |
| 55 | { |
| 56 | if (!weight) |
| 57 | return 0; |
| 58 | if (state & SRV_GOINGDOWN) |
| 59 | return 0; |
| 60 | if (!(state & SRV_RUNNING)) |
| 61 | return 0; |
| 62 | return 1; |
| 63 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 64 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 65 | #endif /* _PROTO_BACKEND_H */ |
| 66 | |
| 67 | /* |
| 68 | * Local variables: |
| 69 | * c-indent-level: 8 |
| 70 | * c-basic-offset: 8 |
| 71 | * End: |
| 72 | */ |