Skip to content

Commit

Permalink
apple adding tcp_connection_info struct
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 16, 2023
1 parent ccdae50 commit 6b66949
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Expand Up @@ -309,6 +309,7 @@ fn test_apple(target: &str) {

// FIXME: The size is changed in recent macOSes.
"malloc_zone_t" => true,
"tcp_connection_info" => true,

_ => false,
}
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/apple.txt
Expand Up @@ -1366,6 +1366,7 @@ TAB1
TAB2
TAB3
TABDLY
TCP_CONNECTION_INFO
TCP_FASTOPEN
TCP_KEEPALIVE
TCP_KEEPCNT
Expand Down Expand Up @@ -2245,6 +2246,7 @@ task_info
task_inspect_t
task_terminate
task_threads
tcp_connection_info
telldir
thread_basic_info_t
thread_extended_info_t
Expand Down
42 changes: 42 additions & 0 deletions src/unix/bsd/apple/mod.rs
Expand Up @@ -1138,6 +1138,47 @@ s! {
#[cfg(not(libc_union))]
pub ifc_ifcu: *mut ifreq,
}

#[repr(C, align(8))]
pub struct tcp_connection_info {
pub tcpi_state: u8,
pub tcpi_snd_wscale: u8,
pub tcpi_rcv_wscale: u8,
pub tcpi_options: u32,
pub tcpi_flags: u32,
pub tcpi_rto: u32,
pub tcpi_maxseg: u32,
pub tcpi_snd_ssthresh: u32,
pub tcpi_snd_cwnd: u32,
pub tcpi_snd_wnd: u32,
pub tcpi_snd_sbbytes: u32,
pub tcpi_rcv_wnd: u32,
pub tcpi_rttcur: u32,
pub tcpi_srtt: u32,
pub tcpi_rttvar: u32,
pub tcpi_tfo_cookie_req: u8,
pub tcpi_tfo_cookie_rcv: u8,
pub tcpi_tfo_syn_loss: u8,
pub tcpi_tfo_syn_data_sent: u8,
pub tcpi_tfo_syn_data_acked: u8,
pub tcpi_tfo_syn_data_rcv: u8,
pub tcpi_tfo_cookie_req_rcv: u8,
pub tcpi_tfo_cookie_sent: u8,
pub tcpi_tfo_cookie_invalid: u8,
pub tcpi_tfo_cookie_wrong: u8,
pub tcpi_tfo_no_cookie_rcv: u8,
pub tcpi_tfo_heuristics_disable: u8,
pub tcpi_tfo_send_blackhole: u8,
pub tcpi_tfo_recv_blackhole: u8,
pub tcpi_tfo_onebyte_proxy: u8,
pub tcpi_txpackets: u64,
pub tcpi_txbytes: u64,
pub tcpi_txretransmitbytes: u64,
pub tcpi_rxpackets: u64,
pub tcpi_rxbytes: u64,
pub tcpi_rxoutoforderbytes: u64,
pub tcpi_rxretransmitpackets: u64,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -4103,6 +4144,7 @@ pub const TCP_KEEPINTVL: ::c_int = 0x101;
pub const TCP_KEEPCNT: ::c_int = 0x102;
/// Enable/Disable TCP Fastopen on this socket
pub const TCP_FASTOPEN: ::c_int = 0x105;
pub const TCP_CONNECTION_INFO: ::c_int = 0x106;

pub const SOL_LOCAL: ::c_int = 0;

Expand Down

0 comments on commit 6b66949

Please sign in to comment.