Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 62c3be2 | 2012-01-20 13:12:32 +0100 | [diff] [blame] | 2 | * include/proto/backend.h |
| 3 | * Functions prototypes for the backend. |
| 4 | * |
| 5 | * Copyright (C) 2000-2012 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 | */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 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> |
Willy Tarreau | f89c187 | 2009-10-01 11:19:37 +0200 | [diff] [blame] | 28 | #include <types/proxy.h> |
| 29 | #include <types/server.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 30 | #include <types/session.h> |
| 31 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 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); |
Krzysztof Piotr Oledzki | 15514c2 | 2010-01-04 16:03:09 +0100 | [diff] [blame] | 37 | const char *backend_lb_algo_str(int algo); |
Willy Tarreau | a93c74b | 2012-05-08 18:14:39 +0200 | [diff] [blame] | 38 | int backend_parse_balance(const char **args, char **err, struct proxy *curproxy); |
Willy Tarreau | 32389b7 | 2012-04-23 23:13:20 +0200 | [diff] [blame] | 39 | int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 40 | |
Krzysztof Oledzki | 8513094 | 2007-10-22 16:21:10 +0200 | [diff] [blame] | 41 | int be_downtime(struct proxy *px); |
Willy Tarreau | c5d9c80 | 2009-10-01 09:17:05 +0200 | [diff] [blame] | 42 | void recount_servers(struct proxy *px); |
| 43 | void update_backend_weight(struct proxy *px); |
Willy Tarreau | ca7d4b9 | 2009-10-01 09:21:55 +0200 | [diff] [blame] | 44 | struct server *get_server_sh(struct proxy *px, const char *addr, int len); |
| 45 | 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] | 46 | |
| 47 | /* This function returns non-zero if a server with the given weight and state |
| 48 | * is usable for LB, otherwise zero. |
| 49 | */ |
| 50 | static inline int srv_is_usable(int state, int weight) |
| 51 | { |
| 52 | if (!weight) |
| 53 | return 0; |
Willy Tarreau | 62c3be2 | 2012-01-20 13:12:32 +0100 | [diff] [blame] | 54 | if (state & (SRV_GOINGDOWN | SRV_MAINTAIN)) |
Willy Tarreau | c5d9c80 | 2009-10-01 09:17:05 +0200 | [diff] [blame] | 55 | return 0; |
| 56 | if (!(state & SRV_RUNNING)) |
| 57 | return 0; |
| 58 | return 1; |
| 59 | } |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 60 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 61 | #endif /* _PROTO_BACKEND_H */ |
| 62 | |
| 63 | /* |
| 64 | * Local variables: |
| 65 | * c-indent-level: 8 |
| 66 | * c-basic-offset: 8 |
| 67 | * End: |
| 68 | */ |