blob: 17404d44a8fc0e07c6ba7f11e1422347b6ffe84e [file] [log] [blame]
Willy Tarreaue6b98942007-10-29 01:09:36 +01001/*
Willy Tarreaub1d67742010-03-29 19:36:59 +02002 * include/proto/proto_tcp.h
3 * This file contains TCP socket protocol definitions.
4 *
Willy Tarreaud4c33c82013-01-07 21:59:07 +01005 * Copyright (C) 2000-2013 Willy Tarreau - w@1wt.eu
Willy Tarreaub1d67742010-03-29 19:36:59 +02006 *
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 Tarreaue6b98942007-10-29 01:09:36 +010021
22#ifndef _PROTO_PROTO_TCP_H
23#define _PROTO_PROTO_TCP_H
24
25#include <common/config.h>
Willy Tarreaue6b98942007-10-29 01:09:36 +010026#include <types/task.h>
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020027#include <proto/stick_table.h>
Willy Tarreaue6b98942007-10-29 01:09:36 +010028
David du Colombier6f5ccb12011-03-10 22:26:24 +010029int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote);
Willy Tarreaue6b98942007-10-29 01:09:36 +010030void tcpv4_add_listener(struct listener *listener);
31void tcpv6_add_listener(struct listener *listener);
Willy Tarreau092d8652014-07-07 20:22:12 +020032int tcp_pause_listener(struct listener *l);
Willy Tarreauf0837b22012-11-24 10:24:27 +010033int tcp_connect_server(struct connection *conn, int data, int delack);
Willy Tarreau239d7182012-07-23 18:53:03 +020034int tcp_connect_probe(struct connection *conn);
Willy Tarreau59b94792012-05-11 16:16:40 +020035int tcp_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
36int tcp_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
Willy Tarreau2b57cb82013-06-10 19:56:38 +020037int tcp_drain(int fd);
Willy Tarreau87b09662015-04-03 00:22:06 +020038int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit);
39int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit);
Willy Tarreaue73ef852015-04-04 16:41:45 +020040int tcp_exec_req_rules(struct session *sess);
Willy Tarreaue6b98942007-10-29 01:09:36 +010041
Thierry FOURNIERcc87a112014-12-12 19:41:33 +010042/* TCP keywords. */
Thierry FOURNIER36481b82015-08-19 09:01:53 +020043void tcp_req_conn_keywords_register(struct action_kw_list *kw_list);
44void tcp_req_cont_keywords_register(struct action_kw_list *kw_list);
45void tcp_res_cont_keywords_register(struct action_kw_list *kw_list);
Thierry FOURNIERcc87a112014-12-12 19:41:33 +010046
Thierry FOURNIERa123ad82015-07-24 09:12:15 +020047/* Export some samples. */
48int smp_fetch_src(const struct arg *args, struct sample *smp, const char *kw, void *private);
49
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020050
Thierry FOURNIER0ea5c7f2015-08-05 19:05:19 +020051/* for a tcp-request action ACT_TCP_TRK_*, return a tracking index starting at
Willy Tarreau34c2fb62013-12-02 23:29:05 +010052 * zero for SC0. Unknown actions also return zero.
Willy Tarreaud5ca9ab2013-05-28 17:40:25 +020053 */
54static inline int tcp_trk_idx(int trk_action)
55{
Thierry FOURNIER0ea5c7f2015-08-05 19:05:19 +020056 return trk_action - ACT_ACTION_TRK_SC0;
Willy Tarreaud5ca9ab2013-05-28 17:40:25 +020057}
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020058
Willy Tarreaue6b98942007-10-29 01:09:36 +010059#endif /* _PROTO_PROTO_TCP_H */
60
61/*
62 * Local variables:
63 * c-indent-level: 8
64 * c-basic-offset: 8
65 * End:
66 */