#![allow(clippy::module_name_repetitions)]
use core::mem::size_of;
use crate::in_port_t;
pub type tcp_seq_t = u32;
pub type tcp_cc_t = u32;
pub type tcp6_seq_t = tcp_seq_t;
pub type tcp6hdr_t = tcphdr_t;
#[repr(C)]
pub struct tcphdr_t {
pub th_sport: in_port_t,
pub th_dport: in_port_t,
pub th_seq: tcp_seq_t,
pub th_ack: tcp_seq_t,
#[cfg(target_endian = "little")]
pub th_off: u8,
#[cfg(target_endian = "big")]
pub th_off: u8,
pub th_flags: u8,
pub th_win: u16,
pub th_sum: u16,
pub th_urp: u16,
}
pub const TH_FIN: i32 = 0x01;
pub const TH_SYN: i32 = 0x02;
pub const TH_RST: i32 = 0x04;
pub const TH_PUSH: i32 = 0x08;
pub const TH_ACK: i32 = 0x10;
pub const TH_URG: i32 = 0x20;
pub const TH_ECE: i32 = 0x40;
pub const TH_CWR: i32 = 0x80;
pub const TH_FLAGS: i32 = TH_FIN | TH_SYN | TH_RST | TH_ACK | TH_URG | TH_ECE | TH_CWR;
pub const TH_ACCEPT: i32 = TH_FIN | TH_SYN | TH_RST | TH_ACK;
pub const TCPOPT_EOL: i32 = 0;
pub const TCPOPT_NOP: i32 = 1;
pub const TCPOPT_MAXSEG: i32 = 2;
pub const TCPOLEN_MAXSEG: i32 = 4;
pub const TCPOPT_WINDOW: i32 = 3;
pub const TCPOLEN_WINDOW: i32 = 3;
pub const TCPOPT_SACK_PERMITTED: i32 = 4;
pub const TCPOLEN_SACK_PERMITTED: i32 = 2;
pub const TCPOPT_SACK: i32 = 5;
pub const TCPOLEN_SACK: i32 = 8;
pub const TCPOPT_TIMESTAMP: i32 = 8;
pub const TCPOLEN_TIMESTAMP: i32 = 10;
pub const TCPOLEN_TSTAMP_APPA: i32 = TCPOLEN_TIMESTAMP + 2;
pub const TCPOPT_TSTAMP_HDR: i32 =
TCPOPT_NOP << 24 | TCPOPT_NOP << 16 | TCPOPT_TIMESTAMP << 8 | TCPOLEN_TIMESTAMP;
pub const MAX_TCPOPTLEN: i32 = 40;
pub const TCPOPT_CC: i32 = 11;
pub const TCPOPT_CCNEW: i32 = 12;
pub const TCPOPT_CCECHO: i32 = 13;
pub const TCPOLEN_CC: i32 = 6;
pub const TCPOLEN_CC_APPA: i32 = TCPOLEN_CC + 2;
#[must_use]
pub const fn TCPOPT_CC_HDR(ccopt: i32) -> i32 {
TCPOPT_NOP << 24 | TCPOPT_NOP << 16 | ccopt << 8 | TCPOLEN_CC
}
pub const TCPOPT_SIGNATURE: i32 = 19;
pub const TCPOLEN_SIGNATURE: i32 = 18;
pub const TCPOPT_MULTIPATH: i32 = 30;
pub const TCPOPT_FASTOPEN: i32 = 34;
pub const TCPOLEN_FASTOPEN_REQ: i32 = 2;
pub const TCPOPT_SACK_PERMIT_HDR: i32 =
TCPOPT_NOP << 24 | TCPOPT_NOP << 16 | TCPOPT_SACK_PERMITTED << 8 | TCPOLEN_SACK_PERMITTED;
pub const TCPOPT_SACK_HDR: i32 = TCPOPT_NOP << 24 | TCPOPT_NOP << 16 | TCPOPT_SACK << 8;
pub const MAX_SACK_BLKS: i32 = 6;
pub const TCP_MAX_SACK: i32 = 4;
pub const TCP_MSS: i32 = 512;
pub const TCP_MINMSS: i32 = 216;
pub const TCP6_MSS: i32 = 1024;
pub const TCP_MAXWIN: i32 = 65535;
pub const TTCP_CLIENT_SND_WND: i32 = 4096;
pub const TCP_MAX_WINSHIFT: i32 = 14;
pub const TCP_MAXHLEN: usize = 0xf << 2;
pub const TCP_MAXOLEN: usize = TCP_MAXHLEN - size_of::<tcphdr_t>();
pub const TCP_NODELAY: i32 = 0x01;
pub const TCP_MAXSEG: i32 = 0x02;
pub const TCP_NOPUSH: i32 = 0x04;
pub const TCP_NOOPT: i32 = 0x08;
pub const TCP_KEEPALIVE: i32 = 0x10;
pub const TCP_CONNECTIONTIMEOUT: i32 = 0x20;
pub const PERSIST_TIMEOUT: i32 = 0x40;
pub const TCP_RXT_CONNDROPTIME: i32 = 0x80;
pub const TCP_RXT_FINDROP: i32 = 0x100;
pub const TCP_KEEPINTVL: i32 = 0x101;
pub const TCP_KEEPCNT: i32 = 0x102;
pub const TCP_SENDMOREACKS: i32 = 0x103;
pub const TCP_ENABLE_ECN: i32 = 0x104;
pub const TCP_FASTOPEN: i32 = 0x105;
pub const TCP_CONNECTION_INFO: i32 = 0x106;
pub const TCP_NOTSENT_LOWAT: i32 = 0x201;
pub const TCPCI_OPT_TIMESTAMPS: i32 = 0x0000_0001;
pub const TCPCI_OPT_SACK: i32 = 0x0000_0002;
pub const TCPCI_OPT_WSCALE: i32 = 0x0000_0004;
pub const TCPCI_OPT_ECN: i32 = 0x0000_0008;
pub const TCPCI_FLAG_LOSSRECOVERY: i32 = 0x0000_0001;
pub const TCPCI_FLAG_REORDERING_DETECTED: i32 = 0x0000_0002;