blob: 4cae8d8e26fddad767558096d9a61dd461070aff [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_TCP_H
20#define _UAPI_LINUX_TCP_H
21#include <linux/types.h>
22#include <asm/byteorder.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#include <linux/socket.h>
24struct tcphdr {
Tao Baod7db5942015-01-28 10:07:51 -080025 __be16 source;
26 __be16 dest;
Tao Baod7db5942015-01-28 10:07:51 -080027 __be32 seq;
28 __be32 ack_seq;
Ben Cheng655a7c02013-10-16 16:09:24 -070029#ifdef __LITTLE_ENDIAN_BITFIELD
Tao Baod7db5942015-01-28 10:07:51 -080030 __u16 res1 : 4, doff : 4, fin : 1, syn : 1, rst : 1, psh : 1, ack : 1, urg : 1, ece : 1, cwr : 1;
Ben Cheng655a7c02013-10-16 16:09:24 -070031#elif defined(__BIG_ENDIAN_BITFIELD)
Tao Baod7db5942015-01-28 10:07:51 -080032 __u16 doff : 4, res1 : 4, cwr : 1, ece : 1, urg : 1, ack : 1, psh : 1, rst : 1, syn : 1, fin : 1;
Ben Cheng655a7c02013-10-16 16:09:24 -070033#else
34#error "Adjust your <asm/byteorder.h> defines"
Tao Baod7db5942015-01-28 10:07:51 -080035#endif
36 __be16 window;
37 __sum16 check;
38 __be16 urg_ptr;
Ben Cheng655a7c02013-10-16 16:09:24 -070039};
40union tcp_word_hdr {
Tao Baod7db5942015-01-28 10:07:51 -080041 struct tcphdr hdr;
42 __be32 words[5];
Ben Cheng655a7c02013-10-16 16:09:24 -070043};
Tao Baod7db5942015-01-28 10:07:51 -080044#define tcp_flag_word(tp) (((union tcp_word_hdr *) (tp))->words[3])
Ben Cheng655a7c02013-10-16 16:09:24 -070045enum {
Tao Baod7db5942015-01-28 10:07:51 -080046 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000),
Tao Baod7db5942015-01-28 10:07:51 -080047 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000),
48 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000),
49 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000),
50 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000),
Tao Baod7db5942015-01-28 10:07:51 -080051 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000),
52 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000),
53 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000),
54 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000),
Tao Baod7db5942015-01-28 10:07:51 -080055 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000)
Ben Cheng655a7c02013-10-16 16:09:24 -070056};
Ben Cheng655a7c02013-10-16 16:09:24 -070057#define TCP_MSS_DEFAULT 536U
58#define TCP_MSS_DESIRED 1220U
59#define TCP_NODELAY 1
60#define TCP_MAXSEG 2
Ben Cheng655a7c02013-10-16 16:09:24 -070061#define TCP_CORK 3
62#define TCP_KEEPIDLE 4
63#define TCP_KEEPINTVL 5
64#define TCP_KEEPCNT 6
Ben Cheng655a7c02013-10-16 16:09:24 -070065#define TCP_SYNCNT 7
66#define TCP_LINGER2 8
67#define TCP_DEFER_ACCEPT 9
68#define TCP_WINDOW_CLAMP 10
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define TCP_INFO 11
70#define TCP_QUICKACK 12
71#define TCP_CONGESTION 13
72#define TCP_MD5SIG 14
Ben Cheng655a7c02013-10-16 16:09:24 -070073#define TCP_THIN_LINEAR_TIMEOUTS 16
74#define TCP_THIN_DUPACK 17
75#define TCP_USER_TIMEOUT 18
76#define TCP_REPAIR 19
Ben Cheng655a7c02013-10-16 16:09:24 -070077#define TCP_REPAIR_QUEUE 20
78#define TCP_QUEUE_SEQ 21
79#define TCP_REPAIR_OPTIONS 22
80#define TCP_FASTOPEN 23
Ben Cheng655a7c02013-10-16 16:09:24 -070081#define TCP_TIMESTAMP 24
Christopher Ferris38062f92014-07-09 15:33:25 -070082#define TCP_NOTSENT_LOWAT 25
Christopher Ferris05d08e92016-02-04 13:16:38 -080083#define TCP_CC_INFO 26
84#define TCP_SAVE_SYN 27
85#define TCP_SAVED_SYN 28
Christopher Ferris49f525c2016-12-12 14:55:36 -080086#define TCP_REPAIR_WINDOW 29
Christopher Ferris525ce912017-07-26 13:12:53 -070087#define TCP_FASTOPEN_CONNECT 30
Christopher Ferris1308ad32017-11-14 17:32:13 -080088#define TCP_ULP 31
89#define TCP_MD5SIG_EXT 32
Christopher Ferris934ec942018-01-31 15:29:16 -080090#define TCP_FASTOPEN_KEY 33
91#define TCP_FASTOPEN_NO_COOKIE 34
Christopher Ferris9ce28842018-10-25 12:11:39 -070092#define TCP_ZEROCOPY_RECEIVE 35
93#define TCP_INQ 36
94#define TCP_CM_INQ TCP_INQ
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070095#define TCP_TX_DELAY 37
Christopher Ferris9ce28842018-10-25 12:11:39 -070096#define TCP_REPAIR_ON 1
97#define TCP_REPAIR_OFF 0
98#define TCP_REPAIR_OFF_NO_WP - 1
Christopher Ferris49f525c2016-12-12 14:55:36 -080099struct tcp_repair_opt {
Tao Baod7db5942015-01-28 10:07:51 -0800100 __u32 opt_code;
101 __u32 opt_val;
Ben Cheng655a7c02013-10-16 16:09:24 -0700102};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800103struct tcp_repair_window {
104 __u32 snd_wl1;
105 __u32 snd_wnd;
106 __u32 max_window;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800107 __u32 rcv_wnd;
108 __u32 rcv_wup;
109};
Ben Cheng655a7c02013-10-16 16:09:24 -0700110enum {
Tao Baod7db5942015-01-28 10:07:51 -0800111 TCP_NO_QUEUE,
112 TCP_RECV_QUEUE,
113 TCP_SEND_QUEUE,
Tao Baod7db5942015-01-28 10:07:51 -0800114 TCP_QUEUES_NR,
Ben Cheng655a7c02013-10-16 16:09:24 -0700115};
Christopher Ferris38062f92014-07-09 15:33:25 -0700116#define TCPI_OPT_TIMESTAMPS 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700117#define TCPI_OPT_SACK 2
118#define TCPI_OPT_WSCALE 4
119#define TCPI_OPT_ECN 8
Christopher Ferris38062f92014-07-09 15:33:25 -0700120#define TCPI_OPT_ECN_SEEN 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700121#define TCPI_OPT_SYN_DATA 32
122enum tcp_ca_state {
Tao Baod7db5942015-01-28 10:07:51 -0800123 TCP_CA_Open = 0,
124#define TCPF_CA_Open (1 << TCP_CA_Open)
125 TCP_CA_Disorder = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800126#define TCPF_CA_Disorder (1 << TCP_CA_Disorder)
127 TCP_CA_CWR = 2,
128#define TCPF_CA_CWR (1 << TCP_CA_CWR)
129 TCP_CA_Recovery = 3,
Tao Baod7db5942015-01-28 10:07:51 -0800130#define TCPF_CA_Recovery (1 << TCP_CA_Recovery)
131 TCP_CA_Loss = 4
132#define TCPF_CA_Loss (1 << TCP_CA_Loss)
Ben Cheng655a7c02013-10-16 16:09:24 -0700133};
134struct tcp_info {
Tao Baod7db5942015-01-28 10:07:51 -0800135 __u8 tcpi_state;
136 __u8 tcpi_ca_state;
137 __u8 tcpi_retransmits;
Tao Baod7db5942015-01-28 10:07:51 -0800138 __u8 tcpi_probes;
139 __u8 tcpi_backoff;
140 __u8 tcpi_options;
141 __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800142 __u8 tcpi_delivery_rate_app_limited : 1;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800143 __u32 tcpi_rto;
Tao Baod7db5942015-01-28 10:07:51 -0800144 __u32 tcpi_ato;
145 __u32 tcpi_snd_mss;
146 __u32 tcpi_rcv_mss;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800147 __u32 tcpi_unacked;
Tao Baod7db5942015-01-28 10:07:51 -0800148 __u32 tcpi_sacked;
149 __u32 tcpi_lost;
150 __u32 tcpi_retrans;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800151 __u32 tcpi_fackets;
Tao Baod7db5942015-01-28 10:07:51 -0800152 __u32 tcpi_last_data_sent;
153 __u32 tcpi_last_ack_sent;
154 __u32 tcpi_last_data_recv;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800155 __u32 tcpi_last_ack_recv;
Tao Baod7db5942015-01-28 10:07:51 -0800156 __u32 tcpi_pmtu;
157 __u32 tcpi_rcv_ssthresh;
158 __u32 tcpi_rtt;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800159 __u32 tcpi_rttvar;
Tao Baod7db5942015-01-28 10:07:51 -0800160 __u32 tcpi_snd_ssthresh;
161 __u32 tcpi_snd_cwnd;
162 __u32 tcpi_advmss;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800163 __u32 tcpi_reordering;
Tao Baod7db5942015-01-28 10:07:51 -0800164 __u32 tcpi_rcv_rtt;
165 __u32 tcpi_rcv_space;
166 __u32 tcpi_total_retrans;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800167 __u64 tcpi_pacing_rate;
Tao Baod7db5942015-01-28 10:07:51 -0800168 __u64 tcpi_max_pacing_rate;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800169 __u64 tcpi_bytes_acked;
170 __u64 tcpi_bytes_received;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800171 __u32 tcpi_segs_out;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172 __u32 tcpi_segs_in;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700173 __u32 tcpi_notsent_bytes;
174 __u32 tcpi_min_rtt;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800175 __u32 tcpi_data_segs_in;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700176 __u32 tcpi_data_segs_out;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800177 __u64 tcpi_delivery_rate;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800178 __u64 tcpi_busy_time;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800179 __u64 tcpi_rwnd_limited;
180 __u64 tcpi_sndbuf_limited;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700181 __u32 tcpi_delivered;
182 __u32 tcpi_delivered_ce;
183 __u64 tcpi_bytes_sent;
184 __u64 tcpi_bytes_retrans;
185 __u32 tcpi_dsack_dups;
186 __u32 tcpi_reord_seen;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800187 __u32 tcpi_rcv_ooopack;
188 __u32 tcpi_snd_wnd;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800189};
190enum {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800191 TCP_NLA_PAD,
192 TCP_NLA_BUSY,
193 TCP_NLA_RWND_LIMITED,
194 TCP_NLA_SNDBUF_LIMITED,
Christopher Ferris525ce912017-07-26 13:12:53 -0700195 TCP_NLA_DATA_SEGS_OUT,
196 TCP_NLA_TOTAL_RETRANS,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800197 TCP_NLA_PACING_RATE,
198 TCP_NLA_DELIVERY_RATE,
199 TCP_NLA_SND_CWND,
200 TCP_NLA_REORDERING,
201 TCP_NLA_MIN_RTT,
202 TCP_NLA_RECUR_RETRANS,
203 TCP_NLA_DELIVERY_RATE_APP_LMT,
Christopher Ferris76a1d452018-06-27 14:12:29 -0700204 TCP_NLA_SNDQ_SIZE,
205 TCP_NLA_CA_STATE,
206 TCP_NLA_SND_SSTHRESH,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700207 TCP_NLA_DELIVERED,
208 TCP_NLA_DELIVERED_CE,
209 TCP_NLA_BYTES_SENT,
210 TCP_NLA_BYTES_RETRANS,
211 TCP_NLA_DSACK_DUPS,
212 TCP_NLA_REORD_SEEN,
Christopher Ferrisd842e432019-03-07 10:21:59 -0800213 TCP_NLA_SRTT,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800214};
Ben Cheng655a7c02013-10-16 16:09:24 -0700215#define TCP_MD5SIG_MAXKEYLEN 80
Christopher Ferris1308ad32017-11-14 17:32:13 -0800216#define TCP_MD5SIG_FLAG_PREFIX 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700217struct tcp_md5sig {
Elliott Hughes64f355f2017-08-30 16:10:24 -0700218 struct sockaddr_storage tcpm_addr;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800219 __u8 tcpm_flags;
220 __u8 tcpm_prefixlen;
Tao Baod7db5942015-01-28 10:07:51 -0800221 __u16 tcpm_keylen;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800222 __u32 __tcpm_pad;
223 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
224};
225struct tcp_diag_md5sig {
226 __u8 tcpm_family;
227 __u8 tcpm_prefixlen;
228 __u16 tcpm_keylen;
229 __be32 tcpm_addr[4];
Tao Baod7db5942015-01-28 10:07:51 -0800230 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800231};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700232struct tcp_zerocopy_receive {
233 __u64 address;
234 __u32 length;
235 __u32 recv_skip_hint;
236};
Ben Cheng655a7c02013-10-16 16:09:24 -0700237#endif