blob: 8ca7290e51f3462f71e863075bd2deb143ca3f04 [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>
Thierry FOURNIERec3c37d2015-09-10 18:28:10 +020026#include <types/action.h>
Willy Tarreaue6b98942007-10-29 01:09:36 +010027#include <types/task.h>
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020028#include <proto/stick_table.h>
Willy Tarreaue6b98942007-10-29 01:09:36 +010029
David du Colombier6f5ccb12011-03-10 22:26:24 +010030int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote);
Willy Tarreaue6b98942007-10-29 01:09:36 +010031void tcpv4_add_listener(struct listener *listener);
32void tcpv6_add_listener(struct listener *listener);
Willy Tarreau092d8652014-07-07 20:22:12 +020033int tcp_pause_listener(struct listener *l);
Willy Tarreauf0837b22012-11-24 10:24:27 +010034int tcp_connect_server(struct connection *conn, int data, int delack);
Willy Tarreau239d7182012-07-23 18:53:03 +020035int tcp_connect_probe(struct connection *conn);
Willy Tarreau59b94792012-05-11 16:16:40 +020036int tcp_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
37int tcp_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
Willy Tarreau2b57cb82013-06-10 19:56:38 +020038int tcp_drain(int fd);
Willy Tarreau87b09662015-04-03 00:22:06 +020039int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit);
40int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit);
Willy Tarreaue73ef852015-04-04 16:41:45 +020041int tcp_exec_req_rules(struct session *sess);
Willy Tarreaue6b98942007-10-29 01:09:36 +010042
Thierry FOURNIERcc87a112014-12-12 19:41:33 +010043/* TCP keywords. */
Thierry FOURNIER36481b82015-08-19 09:01:53 +020044void tcp_req_conn_keywords_register(struct action_kw_list *kw_list);
45void tcp_req_cont_keywords_register(struct action_kw_list *kw_list);
46void tcp_res_cont_keywords_register(struct action_kw_list *kw_list);
Thierry FOURNIERcc87a112014-12-12 19:41:33 +010047
Thierry FOURNIERa123ad82015-07-24 09:12:15 +020048/* Export some samples. */
49int smp_fetch_src(const struct arg *args, struct sample *smp, const char *kw, void *private);
50
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020051
Thierry FOURNIER0ea5c7f2015-08-05 19:05:19 +020052/* for a tcp-request action ACT_TCP_TRK_*, return a tracking index starting at
Willy Tarreau34c2fb62013-12-02 23:29:05 +010053 * zero for SC0. Unknown actions also return zero.
Willy Tarreaud5ca9ab2013-05-28 17:40:25 +020054 */
55static inline int tcp_trk_idx(int trk_action)
56{
Thierry FOURNIER0ea5c7f2015-08-05 19:05:19 +020057 return trk_action - ACT_ACTION_TRK_SC0;
Willy Tarreaud5ca9ab2013-05-28 17:40:25 +020058}
Willy Tarreau9ba2dcc2010-06-14 21:04:55 +020059
Willy Tarreaue6b98942007-10-29 01:09:36 +010060#endif /* _PROTO_PROTO_TCP_H */
61
62/*
63 * Local variables:
64 * c-indent-level: 8
65 * c-basic-offset: 8
66 * End:
67 */