pub struct CapabilityModel {
pub token: u64,
pub rights: u32,
pub owner: u64,
pub generation: u32,
pub parent_token: u64,
pub address_space: u64,
}Expand description
Model of a capability token
Fields§
§token: u64Unique token value
rights: u32Rights bitmask
owner: u64Owner process ID
generation: u32Generation counter (incremented on revocation)
parent_token: u64Parent token (0 = root capability)
address_space: u64Address space this capability belongs to
Implementations§
Source§impl CapabilityModel
impl CapabilityModel
Sourcepub fn encode(index: u32, rights: u32, generation: u32) -> u64
pub fn encode(index: u32, rights: u32, generation: u32) -> u64
Encode capability fields into a single u64 token
Layout: [generation:16][rights:16][index:32]
Sourcepub fn derive(
&self,
child_token: u64,
child_rights: u32,
child_owner: u64,
) -> Result<CapabilityModel, CapModelError>
pub fn derive( &self, child_token: u64, child_rights: u32, child_owner: u64, ) -> Result<CapabilityModel, CapModelError>
Derive a child capability with a subset of rights
Sourcepub fn has_rights(&self, required: u32) -> bool
pub fn has_rights(&self, required: u32) -> bool
Check if this capability has specific rights
Trait Implementations§
Source§impl Clone for CapabilityModel
impl Clone for CapabilityModel
Source§fn clone(&self) -> CapabilityModel
fn clone(&self) -> CapabilityModel
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CapabilityModel
impl Debug for CapabilityModel
Source§impl PartialEq for CapabilityModel
impl PartialEq for CapabilityModel
impl Copy for CapabilityModel
impl Eq for CapabilityModel
impl StructuralPartialEq for CapabilityModel
Auto Trait Implementations§
impl Freeze for CapabilityModel
impl RefUnwindSafe for CapabilityModel
impl Send for CapabilityModel
impl Sync for CapabilityModel
impl Unpin for CapabilityModel
impl UnwindSafe for CapabilityModel
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)