Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Nov 27, 2023
1 parent 3ca9f00 commit 1af6aca
Showing 1 changed file with 47 additions and 71 deletions.
118 changes: 47 additions & 71 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,43 +822,41 @@ pub enum ControlMessageOwned {
TlsGetRecordType(TlsGetRecordType),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
IpTos(u8),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
Ipv6TClass(u8),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
IpTtl(u8),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
Ipv6HopLimit(u8),
Expand Down Expand Up @@ -1063,22 +1061,18 @@ impl ControlMessageOwned {
let tos = unsafe { ptr::read_unaligned(p as *const u8) };
ControlMessageOwned::IpTos(tos.into())
},
#[cfg(any(
target_os = "android",
target_os = "linux",
))]
#[cfg(linux_android)]
#[cfg(feature = "net")]
(libc::IPPROTO_IP, libc::IP_TOS) => {
let tos = unsafe { ptr::read_unaligned(p as *const u8) };
ControlMessageOwned::IpTos(tos.into())
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
(libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => {
Expand All @@ -1096,22 +1090,18 @@ impl ControlMessageOwned {
let ttl = unsafe { ptr::read_unaligned(p as *const u8) };
ControlMessageOwned::IpTtl(ttl.into())
},
#[cfg(any(
target_os = "android",
target_os = "linux",
))]
#[cfg(linux_android)]
#[cfg(feature = "net")]
(libc::IPPROTO_IP, libc::IP_TTL) => {
let ttl = unsafe { ptr::read_unaligned(p as *const u8) };
ControlMessageOwned::IpTtl(ttl.into())
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
(libc::IPPROTO_IPV6, libc::IPV6_HOPLIMIT) => {
Expand Down Expand Up @@ -1288,33 +1278,31 @@ pub enum ControlMessage<'a> {
TxTime(&'a u64),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
IpTos(&'a libc::c_int),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
Ipv6TClass(&'a libc::c_int),

#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
IpTtl(&'a libc::c_int),
Expand Down Expand Up @@ -1423,36 +1411,33 @@ impl<'a> ControlMessage<'a> {
tx_time as *const _ as *const u8
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTos(tos) => {
tos as *const _ as *const u8
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::Ipv6TClass(tclass) => {
tclass as *const _ as *const u8
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTtl(ttl) => {
Expand Down Expand Up @@ -1523,36 +1508,33 @@ impl<'a> ControlMessage<'a> {
mem::size_of_val(tx_time)
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTos(tos) => {
mem::size_of_val(tos)
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::Ipv6TClass(tclass) => {
mem::size_of_val(tclass)
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTtl(ttl) => {
Expand Down Expand Up @@ -1593,32 +1575,29 @@ impl<'a> ControlMessage<'a> {
#[cfg(target_os = "linux")]
ControlMessage::TxTime(_) => libc::SOL_SOCKET,
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTos(_) => libc::IPPROTO_IP,
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::Ipv6TClass(_) => libc::IPPROTO_IPV6,
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTtl(_) => libc::IPPROTO_IP,
Expand Down Expand Up @@ -1672,32 +1651,29 @@ impl<'a> ControlMessage<'a> {
libc::SCM_TXTIME
},
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTos(_) => libc::IP_TOS,
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::Ipv6TClass(_) => libc::IPV6_TCLASS,
#[cfg(any(
target_os = "freebsd",
apple_targets,
linux_android,
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "linux",
))]
#[cfg(feature = "net")]
ControlMessage::IpTtl(_) => libc::IP_TTL,
Expand Down

0 comments on commit 1af6aca

Please sign in to comment.