1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI_LINUX_TCP_H 8 #define _UAPI_LINUX_TCP_H 9 #include <bits/tcphdr.h> 10 #include <linux/types.h> 11 #include <asm/byteorder.h> 12 #include <linux/socket.h> 13 union tcp_word_hdr { 14 struct tcphdr hdr; 15 __be32 words[5]; 16 }; 17 #define tcp_flag_word(tp) (((union tcp_word_hdr *) (tp))->words[3]) 18 enum { 19 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), 20 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), 21 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), 22 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), 23 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), 24 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), 25 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), 26 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), 27 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), 28 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) 29 }; 30 #define TCP_MSS_DEFAULT 536U 31 #define TCP_MSS_DESIRED 1220U 32 #define TCP_NODELAY 1 33 #define TCP_MAXSEG 2 34 #define TCP_CORK 3 35 #define TCP_KEEPIDLE 4 36 #define TCP_KEEPINTVL 5 37 #define TCP_KEEPCNT 6 38 #define TCP_SYNCNT 7 39 #define TCP_LINGER2 8 40 #define TCP_DEFER_ACCEPT 9 41 #define TCP_WINDOW_CLAMP 10 42 #define TCP_INFO 11 43 #define TCP_QUICKACK 12 44 #define TCP_CONGESTION 13 45 #define TCP_MD5SIG 14 46 #define TCP_THIN_LINEAR_TIMEOUTS 16 47 #define TCP_THIN_DUPACK 17 48 #define TCP_USER_TIMEOUT 18 49 #define TCP_REPAIR 19 50 #define TCP_REPAIR_QUEUE 20 51 #define TCP_QUEUE_SEQ 21 52 #define TCP_REPAIR_OPTIONS 22 53 #define TCP_FASTOPEN 23 54 #define TCP_TIMESTAMP 24 55 #define TCP_NOTSENT_LOWAT 25 56 #define TCP_CC_INFO 26 57 #define TCP_SAVE_SYN 27 58 #define TCP_SAVED_SYN 28 59 #define TCP_REPAIR_WINDOW 29 60 #define TCP_FASTOPEN_CONNECT 30 61 #define TCP_ULP 31 62 #define TCP_MD5SIG_EXT 32 63 #define TCP_FASTOPEN_KEY 33 64 #define TCP_FASTOPEN_NO_COOKIE 34 65 #define TCP_ZEROCOPY_RECEIVE 35 66 #define TCP_INQ 36 67 #define TCP_CM_INQ TCP_INQ 68 #define TCP_TX_DELAY 37 69 #define TCP_AO_ADD_KEY 38 70 #define TCP_AO_DEL_KEY 39 71 #define TCP_AO_INFO 40 72 #define TCP_AO_GET_KEYS 41 73 #define TCP_AO_REPAIR 42 74 #define TCP_REPAIR_ON 1 75 #define TCP_REPAIR_OFF 0 76 #define TCP_REPAIR_OFF_NO_WP - 1 77 struct tcp_repair_opt { 78 __u32 opt_code; 79 __u32 opt_val; 80 }; 81 struct tcp_repair_window { 82 __u32 snd_wl1; 83 __u32 snd_wnd; 84 __u32 max_window; 85 __u32 rcv_wnd; 86 __u32 rcv_wup; 87 }; 88 enum { 89 TCP_NO_QUEUE, 90 TCP_RECV_QUEUE, 91 TCP_SEND_QUEUE, 92 TCP_QUEUES_NR, 93 }; 94 enum tcp_fastopen_client_fail { 95 TFO_STATUS_UNSPEC, 96 TFO_COOKIE_UNAVAILABLE, 97 TFO_DATA_NOT_ACKED, 98 TFO_SYN_RETRANSMITTED, 99 }; 100 #define TCPI_OPT_TIMESTAMPS 1 101 #define TCPI_OPT_SACK 2 102 #define TCPI_OPT_WSCALE 4 103 #define TCPI_OPT_ECN 8 104 #define TCPI_OPT_ECN_SEEN 16 105 #define TCPI_OPT_SYN_DATA 32 106 #define TCPI_OPT_USEC_TS 64 107 enum tcp_ca_state { 108 TCP_CA_Open = 0, 109 #define TCPF_CA_Open (1 << TCP_CA_Open) 110 TCP_CA_Disorder = 1, 111 #define TCPF_CA_Disorder (1 << TCP_CA_Disorder) 112 TCP_CA_CWR = 2, 113 #define TCPF_CA_CWR (1 << TCP_CA_CWR) 114 TCP_CA_Recovery = 3, 115 #define TCPF_CA_Recovery (1 << TCP_CA_Recovery) 116 TCP_CA_Loss = 4 117 #define TCPF_CA_Loss (1 << TCP_CA_Loss) 118 }; 119 struct tcp_info { 120 __u8 tcpi_state; 121 __u8 tcpi_ca_state; 122 __u8 tcpi_retransmits; 123 __u8 tcpi_probes; 124 __u8 tcpi_backoff; 125 __u8 tcpi_options; 126 __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; 127 __u8 tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2; 128 __u32 tcpi_rto; 129 __u32 tcpi_ato; 130 __u32 tcpi_snd_mss; 131 __u32 tcpi_rcv_mss; 132 __u32 tcpi_unacked; 133 __u32 tcpi_sacked; 134 __u32 tcpi_lost; 135 __u32 tcpi_retrans; 136 __u32 tcpi_fackets; 137 __u32 tcpi_last_data_sent; 138 __u32 tcpi_last_ack_sent; 139 __u32 tcpi_last_data_recv; 140 __u32 tcpi_last_ack_recv; 141 __u32 tcpi_pmtu; 142 __u32 tcpi_rcv_ssthresh; 143 __u32 tcpi_rtt; 144 __u32 tcpi_rttvar; 145 __u32 tcpi_snd_ssthresh; 146 __u32 tcpi_snd_cwnd; 147 __u32 tcpi_advmss; 148 __u32 tcpi_reordering; 149 __u32 tcpi_rcv_rtt; 150 __u32 tcpi_rcv_space; 151 __u32 tcpi_total_retrans; 152 __u64 tcpi_pacing_rate; 153 __u64 tcpi_max_pacing_rate; 154 __u64 tcpi_bytes_acked; 155 __u64 tcpi_bytes_received; 156 __u32 tcpi_segs_out; 157 __u32 tcpi_segs_in; 158 __u32 tcpi_notsent_bytes; 159 __u32 tcpi_min_rtt; 160 __u32 tcpi_data_segs_in; 161 __u32 tcpi_data_segs_out; 162 __u64 tcpi_delivery_rate; 163 __u64 tcpi_busy_time; 164 __u64 tcpi_rwnd_limited; 165 __u64 tcpi_sndbuf_limited; 166 __u32 tcpi_delivered; 167 __u32 tcpi_delivered_ce; 168 __u64 tcpi_bytes_sent; 169 __u64 tcpi_bytes_retrans; 170 __u32 tcpi_dsack_dups; 171 __u32 tcpi_reord_seen; 172 __u32 tcpi_rcv_ooopack; 173 __u32 tcpi_snd_wnd; 174 __u32 tcpi_rcv_wnd; 175 __u32 tcpi_rehash; 176 __u16 tcpi_total_rto; 177 __u16 tcpi_total_rto_recoveries; 178 __u32 tcpi_total_rto_time; 179 }; 180 enum { 181 TCP_NLA_PAD, 182 TCP_NLA_BUSY, 183 TCP_NLA_RWND_LIMITED, 184 TCP_NLA_SNDBUF_LIMITED, 185 TCP_NLA_DATA_SEGS_OUT, 186 TCP_NLA_TOTAL_RETRANS, 187 TCP_NLA_PACING_RATE, 188 TCP_NLA_DELIVERY_RATE, 189 TCP_NLA_SND_CWND, 190 TCP_NLA_REORDERING, 191 TCP_NLA_MIN_RTT, 192 TCP_NLA_RECUR_RETRANS, 193 TCP_NLA_DELIVERY_RATE_APP_LMT, 194 TCP_NLA_SNDQ_SIZE, 195 TCP_NLA_CA_STATE, 196 TCP_NLA_SND_SSTHRESH, 197 TCP_NLA_DELIVERED, 198 TCP_NLA_DELIVERED_CE, 199 TCP_NLA_BYTES_SENT, 200 TCP_NLA_BYTES_RETRANS, 201 TCP_NLA_DSACK_DUPS, 202 TCP_NLA_REORD_SEEN, 203 TCP_NLA_SRTT, 204 TCP_NLA_TIMEOUT_REHASH, 205 TCP_NLA_BYTES_NOTSENT, 206 TCP_NLA_EDT, 207 TCP_NLA_TTL, 208 TCP_NLA_REHASH, 209 }; 210 #define TCP_MD5SIG_MAXKEYLEN 80 211 #define TCP_MD5SIG_FLAG_PREFIX 0x1 212 #define TCP_MD5SIG_FLAG_IFINDEX 0x2 213 struct tcp_md5sig { 214 struct sockaddr_storage tcpm_addr; 215 __u8 tcpm_flags; 216 __u8 tcpm_prefixlen; 217 __u16 tcpm_keylen; 218 int tcpm_ifindex; 219 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; 220 }; 221 struct tcp_diag_md5sig { 222 __u8 tcpm_family; 223 __u8 tcpm_prefixlen; 224 __u16 tcpm_keylen; 225 __be32 tcpm_addr[4]; 226 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; 227 }; 228 #define TCP_AO_MAXKEYLEN 80 229 #define TCP_AO_KEYF_IFINDEX (1 << 0) 230 #define TCP_AO_KEYF_EXCLUDE_OPT (1 << 1) 231 struct tcp_ao_add { 232 struct sockaddr_storage addr; 233 char alg_name[64]; 234 __s32 ifindex; 235 __u32 set_current : 1, set_rnext : 1, reserved : 30; 236 __u16 reserved2; 237 __u8 prefix; 238 __u8 sndid; 239 __u8 rcvid; 240 __u8 maclen; 241 __u8 keyflags; 242 __u8 keylen; 243 __u8 key[TCP_AO_MAXKEYLEN]; 244 } __attribute__((aligned(8))); 245 struct tcp_ao_del { 246 struct sockaddr_storage addr; 247 __s32 ifindex; 248 __u32 set_current : 1, set_rnext : 1, del_async : 1, reserved : 29; 249 __u16 reserved2; 250 __u8 prefix; 251 __u8 sndid; 252 __u8 rcvid; 253 __u8 current_key; 254 __u8 rnext; 255 __u8 keyflags; 256 } __attribute__((aligned(8))); 257 struct tcp_ao_info_opt { 258 __u32 set_current : 1, set_rnext : 1, ao_required : 1, set_counters : 1, accept_icmps : 1, reserved : 27; 259 __u16 reserved2; 260 __u8 current_key; 261 __u8 rnext; 262 __u64 pkt_good; 263 __u64 pkt_bad; 264 __u64 pkt_key_not_found; 265 __u64 pkt_ao_required; 266 __u64 pkt_dropped_icmp; 267 } __attribute__((aligned(8))); 268 struct tcp_ao_getsockopt { 269 struct sockaddr_storage addr; 270 char alg_name[64]; 271 __u8 key[TCP_AO_MAXKEYLEN]; 272 __u32 nkeys; 273 __u16 is_current : 1, is_rnext : 1, get_all : 1, reserved : 13; 274 __u8 sndid; 275 __u8 rcvid; 276 __u8 prefix; 277 __u8 maclen; 278 __u8 keyflags; 279 __u8 keylen; 280 __s32 ifindex; 281 __u64 pkt_good; 282 __u64 pkt_bad; 283 } __attribute__((aligned(8))); 284 struct tcp_ao_repair { 285 __be32 snt_isn; 286 __be32 rcv_isn; 287 __u32 snd_sne; 288 __u32 rcv_sne; 289 } __attribute__((aligned(8))); 290 #define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1 291 struct tcp_zerocopy_receive { 292 __u64 address; 293 __u32 length; 294 __u32 recv_skip_hint; 295 __u32 inq; 296 __s32 err; 297 __u64 copybuf_address; 298 __s32 copybuf_len; 299 __u32 flags; 300 __u64 msg_control; 301 __u64 msg_controllen; 302 __u32 msg_flags; 303 __u32 reserved; 304 }; 305 #endif 306