From 482ea04f5a04dee7e6357d5fba9c2ca96f1898a8 Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Thu, 6 Apr 2023 10:28:45 +0200 Subject: [PATCH] Add Protocol::UDPLITE --- src/lib.rs | 14 +++++++++++++- src/sys/unix.rs | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index dcb12c61..6169d9b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -318,9 +318,21 @@ impl Protocol { #[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))] pub const DCCP: Protocol = Protocol(sys::IPPROTO_DCCP); - #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] /// Protocol corresponding to `SCTP`. + #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] pub const SCTP: Protocol = Protocol(sys::IPPROTO_SCTP); + + /// Protocol corresponding to `UDPLITE`. + #[cfg(all( + feature = "all", + any( + target_os = "android", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "linux", + ) + ))] + pub const UDPLITE: Protocol = Protocol(sys::IPPROTO_UDPLITE); } impl From for Protocol { diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 102676ea..811849ee 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -93,6 +93,16 @@ pub(crate) use libc::IPPROTO_DCCP; pub(crate) use libc::IPPROTO_MPTCP; #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] pub(crate) use libc::IPPROTO_SCTP; +#[cfg(all( + feature = "all", + any( + target_os = "android", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "linux", + ) +))] +pub(crate) use libc::IPPROTO_UDPLITE; pub(crate) use libc::{IPPROTO_ICMP, IPPROTO_ICMPV6, IPPROTO_TCP, IPPROTO_UDP}; // Used in `SockAddr`. pub(crate) use libc::{ @@ -500,6 +510,16 @@ impl_debug!( libc::IPPROTO_DCCP, #[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "linux")))] libc::IPPROTO_SCTP, + #[cfg(all( + feature = "all", + any( + target_os = "android", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "linux", + ) + ))] + libc::IPPROTO_UDPLITE, ); /// Unix-only API.