Trait uds::UnixDatagramExt[][src]

pub trait UnixDatagramExt: AsRawFd + FromRawFd + Sized {
    fn local_unix_addr(&self) -> Result<UnixSocketAddr, Error> { ... }
fn peer_unix_addr(&self) -> Result<UnixSocketAddr, Error> { ... }
fn bind_to_unix_addr(&self, addr: &UnixSocketAddr) -> Result<(), Error> { ... }
fn connect_to_unix_addr(&self, addr: &UnixSocketAddr) -> Result<(), Error> { ... }
fn send_fds_to(
        &self,
        datagram: &[u8],
        fds: &[RawFd],
        addr: &UnixSocketAddr
    ) -> Result<usize, Error> { ... }
fn send_fds(&self, datagram: &[u8], fds: &[RawFd]) -> Result<usize, Error> { ... }
fn recv_fds_from(
        &self,
        buf: &mut [u8],
        fd_buf: &mut [RawFd]
    ) -> Result<(usize, usize, UnixSocketAddr), Error> { ... }
fn recv_fds(
        &self,
        buf: &mut [u8],
        fd_buf: &mut [RawFd]
    ) -> Result<(usize, usize), Error> { ... }
fn initial_pair_credentials(&self) -> Result<ConnCredentials, Error> { ... } }

Extension trait for std::os::unix::net::UnixDatagram and nonblocking equivalents.

Provided methods

fn local_unix_addr(&self) -> Result<UnixSocketAddr, Error>[src]

Get the address of this socket, as a type that fully supports abstract addresses.

fn peer_unix_addr(&self) -> Result<UnixSocketAddr, Error>[src]

Get the address of the connected socket, as a type that fully supports abstract addresses.

fn bind_to_unix_addr(&self, addr: &UnixSocketAddr) -> Result<(), Error>[src]

Create a path or abstract name for the socket.

fn connect_to_unix_addr(&self, addr: &UnixSocketAddr) -> Result<(), Error>[src]

Connect the socket to a path-based or abstract named socket.

fn send_fds_to(
    &self,
    datagram: &[u8],
    fds: &[RawFd],
    addr: &UnixSocketAddr
) -> Result<usize, Error>
[src]

Send file descriptors along with the datagram, on an unconnected socket.

fn send_fds(&self, datagram: &[u8], fds: &[RawFd]) -> Result<usize, Error>[src]

Send file descriptors along with the datagram, on a connected socket.

fn recv_fds_from(
    &self,
    buf: &mut [u8],
    fd_buf: &mut [RawFd]
) -> Result<(usize, usize, UnixSocketAddr), Error>
[src]

Receive file descriptors along with the datagram, on an unconnected socket

fn recv_fds(
    &self,
    buf: &mut [u8],
    fd_buf: &mut [RawFd]
) -> Result<(usize, usize), Error>
[src]

Receive file descriptors along with the datagram, on a connected socket

fn initial_pair_credentials(&self) -> Result<ConnCredentials, Error>[src]

Get the credentials of the process that created a socket pair.

This information is only available on Linux, and only for sockets that was created with pair() or the underlying socketpair(). For sockets that have merely been "connected" to an address or not connected at all, an error of kind NotConnected or InvalidInput is returned.

The use cases of this function gotta be very narrow:

  • It will return the credentials of the current process unless the side of the socket this method is called on was received via FD-passing or inherited from a parent.
  • If it was created by the direct parent process, one might as well use getppid() and go from there?
  • A returned pid can be repurposed by the OS before the call returns.
  • uids or groups will be those in effect when the pair was created, and will not reflect changes in privileges.

Despite these limitations, the feature is supported by Linux at least (but not macOS or FreeBSD), so might as well expose it.

Loading content...

Implementations on Foreign Types

impl UnixDatagramExt for UnixDatagram[src]

impl UnixDatagramExt for UnixDatagram[src]

impl UnixDatagramExt for UnixDatagram[src]

Loading content...

Implementors

Loading content...