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