Enforce const-correctness in UNIX socket wrappers
[lttng-tools.git] / src / common / sessiond-comm / inet.h
CommitLineData
6364a07a
DG
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
6364a07a
DG
21#include <limits.h>
22
23#include "sessiond-comm.h"
24
d831c249
DG
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 */
43extern unsigned long lttcomm_inet_tcp_timeout;
44
6364a07a
DG
45/* Stub */
46struct lttcomm_sock;
47
48/* Net family callback */
49extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type,
50 int proto);
51
52extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock);
53extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock);
54extern int lttcomm_close_inet_sock(struct lttcomm_sock *sock);
55extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock);
56extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog);
57
58extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
59 size_t len, int flags);
c2d69327
JG
60extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
61 const void *buf, size_t len, int flags);
6364a07a 62
d831c249
DG
63/* Initialize inet communication layer. */
64extern void lttcomm_inet_init(void);
65
6364a07a 66#endif /* _LTTCOMM_INET_H */
This page took 0.036313 seconds and 4 git commands to generate.