lib: compile liblttng-ctl as C++
[lttng-tools.git] / src / common / sessiond-comm / inet.h
CommitLineData
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
6364a07a
DG
11#include <limits.h>
12
13#include "sessiond-comm.h"
14
7966af57
SM
15#ifdef __cplusplus
16extern "C" {
17#endif
18
d831c249
DG
19/* See man tcp(7) for more detail about this value. */
20#define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries"
21#define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout"
22
23/*
24 * The timeout value of a connect() is computed with an algorithm inside the
25 * kernel using the defined TCP SYN retries so the end value in time is
26 * approximative. According to tcp(7) man page, a value of 5 is roughly 180
27 * seconds of timeout. With that information, we've computed a factor of 36
28 * (180/5) by considering that it grows linearly. This is of course uncertain
29 * but this is the best approximation we can do at runtime.
30 */
31#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36
32
33/*
34 * Maximum timeout value in seconds of a TCP connection for both send/recv and
35 * connect operations.
36 */
4bd69c5f 37LTTNG_EXPORT extern unsigned long lttcomm_inet_tcp_timeout;
d831c249 38
6364a07a
DG
39/* Stub */
40struct lttcomm_sock;
41
42/* Net family callback */
43extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type,
44 int proto);
45
46extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock);
47extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock);
48extern int lttcomm_close_inet_sock(struct lttcomm_sock *sock);
49extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock);
50extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog);
51
52extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
53 size_t len, int flags);
c2d69327
JG
54extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
55 const void *buf, size_t len, int flags);
6364a07a 56
d831c249
DG
57/* Initialize inet communication layer. */
58extern void lttcomm_inet_init(void);
59
7966af57
SM
60#ifdef __cplusplus
61}
62#endif
63
6364a07a 64#endif /* _LTTCOMM_INET_H */
This page took 0.056221 seconds and 4 git commands to generate.