Revert stubbing of unix socket functions
[lttng-tools.git] / src / common / sessiond-comm / inet.h
1 /*
2 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef _LTTCOMM_INET_H
19 #define _LTTCOMM_INET_H
20
21 #include <limits.h>
22
23 #include "sessiond-comm.h"
24
25 /* See man tcp(7) for more detail about this value. */
26 #define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries"
27 #define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout"
28
29 /*
30 * The timeout value of a connect() is computed with an algorithm inside the
31 * kernel using the defined TCP SYN retries so the end value in time is
32 * approximative. According to tcp(7) man page, a value of 5 is roughly 180
33 * seconds of timeout. With that information, we've computed a factor of 36
34 * (180/5) by considering that it grows linearly. This is of course uncertain
35 * but this is the best approximation we can do at runtime.
36 */
37 #define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36
38
39 /*
40 * Maximum timeout value in seconds of a TCP connection for both send/recv and
41 * connect operations.
42 */
43 extern unsigned long lttcomm_inet_tcp_timeout;
44
45 /* Stub */
46 struct lttcomm_sock;
47
48 /* Net family callback */
49 extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type,
50 int proto);
51
52 extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock);
53 extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock);
54 extern int lttcomm_close_inet_sock(struct lttcomm_sock *sock);
55 extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock);
56 extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog);
57
58 extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
59 size_t len, int flags);
60 extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
61 const void *buf, size_t len, int flags);
62
63 /* Initialize inet communication layer. */
64 extern void lttcomm_inet_init(void);
65
66 #endif /* _LTTCOMM_INET_H */
This page took 0.035741 seconds and 4 git commands to generate.