pub struct Privilege { /* private fields */ }Expand description
Run-time platform privilege information.
Implementations§
Source§impl Privilege
impl Privilege
Sourcepub const fn new(has_privileges: bool, needs_privileges: bool) -> Self
pub const fn new(has_privileges: bool, needs_privileges: bool) -> Self
Create a new Privilege instance.
Sourcepub const fn has_privileges(&self) -> bool
pub const fn has_privileges(&self) -> bool
Are we running with the privileges required for raw sockets?
Sourcepub const fn needs_privileges(&self) -> bool
pub const fn needs_privileges(&self) -> bool
Does our platform always need privileges for ICMP?
Specifically, each platform requires privileges unless it supports the IPPROTO_ICMP socket
type which also allows the IP_HDRINCL socket option to be set.
Sourcepub fn acquire_privileges() -> Result<Self>
pub fn acquire_privileges() -> Result<Self>
Acquire privileges, if possible.
Check if CAP_NET_RAW is in the permitted set and if so raise it to the effective set.
Sourcepub fn drop_privileges() -> Result<()>
pub fn drop_privileges() -> Result<()>
Drop all privileges.
Clears the effective set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Privilege
impl RefUnwindSafe for Privilege
impl Send for Privilege
impl Sync for Privilege
impl Unpin for Privilege
impl UnwindSafe for Privilege
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
Mutably borrows from an owned value. Read more