Fix: invalid discarded events on start/stop without event production
[lttng-tools.git] / src / common / sessiond-comm / inet.h
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef _LTTCOMM_INET_H
9 #define _LTTCOMM_INET_H
10
11 #include <limits.h>
12
13 #include "sessiond-comm.h"
14
15 /* See man tcp(7) for more detail about this value. */
16 #define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries"
17 #define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout"
18
19 /*
20 * The timeout value of a connect() is computed with an algorithm inside the
21 * kernel using the defined TCP SYN retries so the end value in time is
22 * approximative. According to tcp(7) man page, a value of 5 is roughly 180
23 * seconds of timeout. With that information, we've computed a factor of 36
24 * (180/5) by considering that it grows linearly. This is of course uncertain
25 * but this is the best approximation we can do at runtime.
26 */
27 #define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36
28
29 /*
30 * Maximum timeout value in seconds of a TCP connection for both send/recv and
31 * connect operations.
32 */
33 extern unsigned long lttcomm_inet_tcp_timeout;
34
35 /* Stub */
36 struct lttcomm_sock;
37
38 /* Net family callback */
39 extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type,
40 int proto);
41
42 extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock);
43 extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock);
44 extern int lttcomm_close_inet_sock(struct lttcomm_sock *sock);
45 extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock);
46 extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog);
47
48 extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
49 size_t len, int flags);
50 extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
51 const void *buf, size_t len, int flags);
52
53 /* Initialize inet communication layer. */
54 extern void lttcomm_inet_init(void);
55
56 #endif /* _LTTCOMM_INET_H */
This page took 0.030104 seconds and 4 git commands to generate.