[][src]Enum interprocess::os::unix::udsocket::AncillaryData

pub enum AncillaryData<'a> {
    FileDescriptors(Cow<'a, [c_int]>),
    Credentials {
        pid: pid_t,
        uid: uid_t,
        gid: gid_t,
    },
}

Ancillary data to be sent through a Unix domain socket or read from an input buffer.

Ancillary data gives unique possibilities to Unix domain sockets which no other POSIX API has: passing file descriptors between two processes which do not have a parent-child relationship. It also can be used to transfer credentials of a process reliably.

Variants

FileDescriptors(Cow<'a, [c_int]>)

One or more file descriptors to be sent.

Credentials

Credentials to be sent. The specified values are checked by the system when sent for all users except for the superuser — for senders, this means that the correct values need to be filled out, otherwise, an error is returned; for receivers, this means that the credentials are to be trusted for authentification purposes. For convenience, the credentials function provides a value which is known to be valid when sent.

Fields of Credentials

pid: pid_t

The process identificator (PID) for the process.

uid: uid_t

The user identificator (UID) of the user who started the process.

gid: gid_t

The group identificator (GID) of the user who started the process.

Implementations

impl<'a> AncillaryData<'a>[src]

pub const ENCODED_SIZE_OF_CREDENTIALS: usize[src]

The size of a single AncillaryData::Credentials element when packed into the Unix ancillary data format. Useful for allocating a buffer when you expect to receive credentials.

pub const fn encoded_size_of_file_descriptors(num_descriptors: usize) -> usize[src]

Calculates the size of an AncillaryData::FileDescriptors element with the specified amount of file descriptors when packed into the Unix ancillary data format. Useful for allocating a buffer when you expect to receive a specific amount of file descriptors.

pub fn clone_ref(&'a self) -> Self[src]

Inexpensievly clones self by borrowing the FileDescriptors variant or copying the Credentials variant.

pub fn encoded_size(&self) -> usize[src]

Returns the size of an ancillary data element when packed into the Unix ancillary data format.

impl AncillaryData<'static>[src]

pub fn credentials() -> Self[src]

Fetches the credentials of the process from the system and returns a value which can be safely sent to another process without the system complaining about an unauthorized attempt to impersonate another process/user/group.

If you want to send credentials to another process, this is usually the function you need to obtain the desired ancillary payload.

Trait Implementations

impl<'a> Clone for AncillaryData<'a>[src]

impl<'a> Debug for AncillaryData<'a>[src]

impl<'a> Eq for AncillaryData<'a>[src]

impl<'a> Hash for AncillaryData<'a>[src]

impl<'a> PartialEq<AncillaryData<'a>> for AncillaryData<'a>[src]

impl<'a> StructuralEq for AncillaryData<'a>[src]

impl<'a> StructuralPartialEq for AncillaryData<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for AncillaryData<'a>

impl<'a> Send for AncillaryData<'a>

impl<'a> Sync for AncillaryData<'a>

impl<'a> Unpin for AncillaryData<'a>

impl<'a> UnwindSafe for AncillaryData<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.