pub enum UnixControlData {
Rights(Vec<FileHandle>),
Credentials(ucred),
Security(FsString),
}Expand description
A control message for a Unix domain socket.
Variants§
Rights(Vec<FileHandle>)
“Send or receive a set of open file descriptors from another process. The data portion contains an integer array of the file descriptors.”
See https://man7.org/linux/man-pages/man7/unix.7.html.
Credentials(ucred)
“Send or receive UNIX credentials. This can be used for authentication. The credentials are passed as a struct ucred ancillary message.”
See https://man7.org/linux/man-pages/man7/unix.7.html.
Security(FsString)
“Receive the SELinux security context (the security label) of the peer socket. The received ancillary data is a null-terminated string containing the security context.”
See https://man7.org/linux/man-pages/man7/unix.7.html.
Implementations§
Source§impl UnixControlData
impl UnixControlData
Sourcepub fn new(
current_task: &CurrentTask,
message: ControlMsg,
) -> Result<Self, Errno>
pub fn new( current_task: &CurrentTask, message: ControlMsg, ) -> Result<Self, Errno>
Creates a new UnixControlData instance for the provided message_header. This includes
reading the associated data from the task (e.g., files from file descriptors).
Sourcepub fn unknown_creds() -> Self
pub fn unknown_creds() -> Self
Returns a UnixControlData message that can be used when passcred is enabled but no
credentials were sent.
Sourcepub fn into_controlmsg<L>(
self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
flags: SocketMessageFlags,
) -> Result<Option<ControlMsg>, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn into_controlmsg<L>(
self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
flags: SocketMessageFlags,
) -> Result<Option<ControlMsg>, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Constructs a ControlMsg for this control data, with a destination of task.
The provided task is used to create any required file descriptors, etc.
Sourcepub fn total_size(&self, current_task: &CurrentTask) -> usize
pub fn total_size(&self, current_task: &CurrentTask) -> usize
Returns the total size of all data in this message.
Sourcepub fn minimum_size(&self) -> usize
pub fn minimum_size(&self) -> usize
Returns the minimum size that can fit some amount of this message’s data. For example, the minimum size for an SCM_RIGHTS message is the size of a single FD. If the buffer is large enough for the minimum size but too small for the total size, the message is truncated and the MSG_CTRUNC flag is set.
Trait Implementations§
Source§impl Clone for UnixControlData
impl Clone for UnixControlData
Source§fn clone(&self) -> UnixControlData
fn clone(&self) -> UnixControlData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UnixControlData
impl !RefUnwindSafe for UnixControlData
impl Send for UnixControlData
impl Sync for UnixControlData
impl Unpin for UnixControlData
impl !UnwindSafe for UnixControlData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more