diff options
Diffstat (limited to 'vendor/rustix/src/net/types.rs')
-rw-r--r-- | vendor/rustix/src/net/types.rs | 173 |
1 files changed, 152 insertions, 21 deletions
diff --git a/vendor/rustix/src/net/types.rs b/vendor/rustix/src/net/types.rs index 53116f9c8..711174354 100644 --- a/vendor/rustix/src/net/types.rs +++ b/vendor/rustix/src/net/types.rs @@ -92,6 +92,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const NETLINK: Self = Self(c::AF_NETLINK as _); /// `AF_UNIX`, aka `AF_LOCAL` @@ -106,16 +107,18 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const AX25: Self = Self(c::AF_AX25 as _); /// `AF_IPX` #[cfg(not(any( - target_os = "espidf", target_os = "aix", + target_os = "espidf", + target_os = "vita", )))] pub const IPX: Self = Self(c::AF_IPX as _); /// `AF_APPLETALK` - #[cfg(not(target_os = "espidf"))] + #[cfg(not(any(target_os = "espidf", target_os = "vita")))] pub const APPLETALK: Self = Self(c::AF_APPLETALK as _); /// `AF_NETROM` #[cfg(not(any( @@ -126,6 +129,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const NETROM: Self = Self(c::AF_NETROM as _); /// `AF_BRIDGE` @@ -137,6 +141,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const BRIDGE: Self = Self(c::AF_BRIDGE as _); /// `AF_ATMPVC` @@ -148,6 +153,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const ATMPVC: Self = Self(c::AF_ATMPVC as _); /// `AF_X25` @@ -158,6 +164,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const X25: Self = Self(c::AF_X25 as _); /// `AF_ROSE` @@ -169,10 +176,11 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` - #[cfg(not(any(target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "vita")))] pub const DECnet: Self = Self(c::AF_DECnet as _); /// `AF_NETBEUI` #[cfg(not(any( @@ -183,6 +191,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const NETBEUI: Self = Self(c::AF_NETBEUI as _); /// `AF_SECURITY` @@ -194,6 +203,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const SECURITY: Self = Self(c::AF_SECURITY as _); /// `AF_KEY` @@ -204,6 +214,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const KEY: Self = Self(c::AF_KEY as _); /// `AF_PACKET` @@ -219,6 +230,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const PACKET: Self = Self(c::AF_PACKET as _); /// `AF_ASH` @@ -230,6 +242,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const ASH: Self = Self(c::AF_ASH as _); /// `AF_ECONET` @@ -241,6 +254,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const ECONET: Self = Self(c::AF_ECONET as _); /// `AF_ATMSVC` @@ -252,6 +266,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const ATMSVC: Self = Self(c::AF_ATMSVC as _); /// `AF_RDS` @@ -263,10 +278,11 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const RDS: Self = Self(c::AF_RDS as _); /// `AF_SNA` - #[cfg(not(any(target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "vita")))] pub const SNA: Self = Self(c::AF_SNA as _); /// `AF_IRDA` #[cfg(not(any( @@ -276,6 +292,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const IRDA: Self = Self(c::AF_IRDA as _); /// `AF_PPPOX` @@ -287,6 +304,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const PPPOX: Self = Self(c::AF_PPPOX as _); /// `AF_WANPIPE` @@ -298,6 +316,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const WANPIPE: Self = Self(c::AF_WANPIPE as _); /// `AF_LLC` @@ -309,6 +328,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const LLC: Self = Self(c::AF_LLC as _); /// `AF_CAN` @@ -320,6 +340,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const CAN: Self = Self(c::AF_CAN as _); /// `AF_TIPC` @@ -331,6 +352,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const TIPC: Self = Self(c::AF_TIPC as _); /// `AF_BLUETOOTH` @@ -340,6 +362,7 @@ impl AddressFamily { windows, target_os = "aix", target_os = "espidf", + target_os = "vita", )))] pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _); /// `AF_IUCV` @@ -351,6 +374,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const IUCV: Self = Self(c::AF_IUCV as _); /// `AF_RXRPC` @@ -362,6 +386,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const RXRPC: Self = Self(c::AF_RXRPC as _); /// `AF_ISDN` @@ -371,6 +396,7 @@ impl AddressFamily { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "vita", )))] pub const ISDN: Self = Self(c::AF_ISDN as _); /// `AF_PHONET` @@ -382,6 +408,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const PHONET: Self = Self(c::AF_PHONET as _); /// `AF_IEEE802154` @@ -393,6 +420,7 @@ impl AddressFamily { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const IEEE802154: Self = Self(c::AF_IEEE802154 as _); /// `AF_802` @@ -610,26 +638,58 @@ pub mod ipproto { /// `IPPROTO_ICMP` pub const ICMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ICMP as _)); /// `IPPROTO_IGMP` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const IGMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IGMP as _)); /// `IPPROTO_IPIP` - #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const IPIP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IPIP as _)); /// `IPPROTO_TCP` pub const TCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_TCP as _)); /// `IPPROTO_EGP` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const EGP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_EGP as _)); /// `IPPROTO_PUP` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const PUP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_PUP as _)); /// `IPPROTO_UDP` pub const UDP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_UDP as _)); /// `IPPROTO_IDP` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const IDP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IDP as _)); /// `IPPROTO_TP` - #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const TP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_TP as _)); /// `IPPROTO_DCCP` #[cfg(not(any( @@ -642,21 +702,44 @@ pub mod ipproto { target_os = "haiku", target_os = "nto", target_os = "openbsd", + target_os = "vita", )))] pub const DCCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_DCCP as _)); /// `IPPROTO_IPV6` pub const IPV6: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IPV6 as _)); /// `IPPROTO_RSVP` - #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const RSVP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_RSVP as _)); /// `IPPROTO_GRE` - #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const GRE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_GRE as _)); /// `IPPROTO_ESP` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const ESP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ESP as _)); /// `IPPROTO_AH` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const AH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_AH as _)); /// `IPPROTO_MTP` #[cfg(not(any( @@ -667,6 +750,7 @@ pub mod ipproto { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const MTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MTP as _)); /// `IPPROTO_BEETPH` @@ -677,7 +761,8 @@ pub mod ipproto { target_os = "aix", target_os = "espidf", target_os = "haiku", - target_os = "nto" + target_os = "nto", + target_os = "vita", )))] pub const BEETPH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_BEETPH as _)); /// `IPPROTO_ENCAP` @@ -687,10 +772,17 @@ pub mod ipproto { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "vita", )))] pub const ENCAP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ENCAP as _)); /// `IPPROTO_PIM` - #[cfg(not(any(solarish, target_os = "aix", target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "aix", + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const PIM: Protocol = Protocol(new_raw_protocol(c::IPPROTO_PIM as _)); /// `IPPROTO_COMP` #[cfg(not(any( @@ -700,7 +792,8 @@ pub mod ipproto { target_os = "aix", target_os = "espidf", target_os = "haiku", - target_os = "nto" + target_os = "nto", + target_os = "vita", )))] pub const COMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_COMP as _)); /// `IPPROTO_SCTP` @@ -709,7 +802,8 @@ pub mod ipproto { target_os = "dragonfly", target_os = "espidf", target_os = "haiku", - target_os = "openbsd" + target_os = "openbsd", + target_os = "vita", )))] pub const SCTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_SCTP as _)); /// `IPPROTO_UDPLITE` @@ -723,6 +817,7 @@ pub mod ipproto { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const UDPLITE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_UDPLITE as _)); /// `IPPROTO_MPLS` @@ -736,13 +831,14 @@ pub mod ipproto { target_os = "haiku", target_os = "netbsd", target_os = "nto", + target_os = "vita", )))] pub const MPLS: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPLS as _)); /// `IPPROTO_ETHERNET` #[cfg(linux_kernel)] pub const ETHERNET: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ETHERNET as _)); /// `IPPROTO_RAW` - #[cfg(not(target_os = "espidf"))] + #[cfg(not(any(target_os = "espidf", target_os = "vita")))] pub const RAW: Protocol = Protocol(new_raw_protocol(c::IPPROTO_RAW as _)); /// `IPPROTO_MPTCP` #[cfg(not(any( @@ -755,10 +851,16 @@ pub mod ipproto { target_os = "fuchsia", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const MPTCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPTCP as _)); /// `IPPROTO_FRAGMENT` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const FRAGMENT: Protocol = Protocol(new_raw_protocol(c::IPPROTO_FRAGMENT as _)); /// `IPPROTO_ICMPV6` pub const ICMPV6: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ICMPV6 as _)); @@ -772,10 +874,16 @@ pub mod ipproto { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] pub const MH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MH as _)); /// `IPPROTO_ROUTING` - #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "vita" + )))] pub const ROUTING: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ROUTING as _)); } @@ -1323,6 +1431,7 @@ bitflags! { target_os = "espidf", target_os = "haiku", target_os = "nto", + target_os = "vita", )))] const NONBLOCK = bitcast!(c::SOCK_NONBLOCK); @@ -1336,6 +1445,25 @@ bitflags! { } } +/// UNIX credentials of socket peer, for use with [`get_socket_peercred`] +/// [`SendAncillaryMessage::ScmCredentials`] and +/// [`RecvAncillaryMessage::ScmCredentials`]. +/// +/// [`get_socket_peercred`]: crate::net::sockopt::get_socket_peercred +/// [`SendAncillaryMessage::ScmCredentials`]: crate::net::SendAncillaryMessage::ScmCredentials +/// [`RecvAncillaryMessage::ScmCredentials`]: crate::net::RecvAncillaryMessage::ScmCredentials +#[cfg(linux_kernel)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] +#[repr(C)] +pub struct UCred { + /// Process ID of peer + pub pid: crate::pid::Pid, + /// User ID of peer + pub uid: crate::ugid::Uid, + /// Group ID of peer + pub gid: crate::ugid::Gid, +} + #[test] fn test_sizes() { use c::c_int; @@ -1361,4 +1489,7 @@ fn test_sizes() { let t: Option<Protocol> = Some(Protocol::from_raw(RawProtocol::new(4567).unwrap())); assert_eq!(4567_u32, transmute::<Option<Protocol>, u32>(t)); } + + #[cfg(linux_kernel)] + assert_eq_size!(UCred, libc::ucred); } |