Skip to content

Commit

Permalink
Add Protocol::UDPLITE
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Apr 6, 2023
1 parent 3b44984 commit f011ec4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<c_int> for Protocol {
Expand Down
20 changes: 20 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit f011ec4

Please sign in to comment.