Skip to main content

Acl

Struct Acl 

Source
pub struct Acl<C: Config, const N: usize = 20, const S: usize = 4, const T: usize = 3> { /* private fields */ }
Expand description

A node’s Access Control List, and the decision it exists to make (§6.6).

N is how many entries the list holds across every fabric, and S and T how many subjects and targets one entry may name. All three default to the specification’s minima for a five-fabric node; Acl::CHECK refuses anything smaller, against the Config the list is parameterised by, so a node cannot promise a share of a list it does not have.

Implementations§

Source§

impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>

Source

pub const CHECK: ()

Compile-time proof that this list can keep §2.11.1.1’s promise, and that its entries are wide enough for §9.10.6.5 and §9.10.6.6.

at least four Access Control Entries available for every fabric supported by the node

S and T are the values SubjectsPerAccessControlEntry and TargetsPerAccessControlEntry report, and their constraints are 4 to 65534 and 3 to 65534 — so a narrower entry is a node whose own attribute is out of constraint.

Source§

impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>

Source

pub fn new() -> Self

An empty list — what a factory-fresh node has (§9.10.6.1).

Source

pub fn len(&self) -> usize

How many entries the list holds, across every fabric.

Source

pub fn is_empty(&self) -> bool

Whether the list is empty.

Source

pub fn entries(&self) -> impl Iterator<Item = &Entry<S, T>>

Every entry, in order.

Source

pub fn of_fabric( &self, fabric: FabricIndex, ) -> impl Iterator<Item = &Entry<S, T>>

The entries belonging to one fabric — what a read of the ACL attribute reports.

§9.10.6’s ACL attribute is F, fabric-scoped, so a client sees its own fabric’s entries and no others.

Source

pub fn len_of_fabric(&self, fabric: FabricIndex) -> usize

How many entries one fabric has, against Config::ACL_ENTRIES_PER_FABRIC.

Source

pub fn add(&mut self, entry: Entry<S, T>) -> Result<()>

Adds an entry.

Refuses one §6.6 does not permit to exist — a PASE entry, a Group entry at Administer, an entry on no fabric, or a malformed target — with ErrorCode::InvalidArgument, and a fabric already at its quota with ErrorCode::NoSpace.

Source

pub fn add_admin_for_fabric( &mut self, fabric: FabricIndex, subject: NodeId, ) -> Result<()>

Adds §11.18.6.8 step 7’s administrator entry for a fabric just joined.

AddNOC carries a CaseAdminSubject, and the specification fixes exactly what the resulting entry must be:

{ FabricIndex: <new>, Privilege: Administer, AuthMode: CASE,
  Subjects: [CaseAdminSubject], Targets: [] }   // entire node

It exists as a named constructor because the consequence of getting it wrong is not a visible failure. §11.18.6.8: “Unless such an Access Control Entry is added atomically as described here, there would be no way for the caller on its given Fabric to eventually add another Access Control Entry for CASE authentication mode” — the fabric is joined, the node advertises itself, and the moment the PASE session closes nobody can administer it again.

subject must be an operational node id or a CAT; anything else is ErrorCode::InvalidArgument, which is the condition §11.18.6.8 answers with InvalidAdminSubject.

Source

pub fn remove_fabric(&mut self, fabric: FabricIndex)

Removes every entry of one fabric — §6.6.4’s side-effect of RemoveFabric.

A fabric’s entries must not outlive it. Left behind, they would be matched by the next fabric to be issued the same index, handing a new administrator the privileges of a removed one.

Source

pub fn replace_fabric( &mut self, fabric: FabricIndex, entries: impl IntoIterator<Item = Entry<S, T>>, ) -> Result<()>

Replaces one fabric’s entries, which is how §10.6.4.3.1’s list write lands.

A write of the whole ACL attribute replaces only the accessing fabric’s entries; every other fabric’s are untouched, because they were never visible to the writer.

Source

pub fn granted( &self, node: &Node<'_>, subject: &SubjectDescriptor, endpoint: EndpointId, cluster: ClusterId, ) -> Granted

§6.6.6.2’s get_granted_privileges: every privilege this action holds here.

Follows the pseudocode clause by clause. The order of the checks is not cosmetic — a fabric mismatch is rejected before an auth mode, and both before any subject is compared — because each one is what makes the next one’s comparison meaningful.

Source

pub fn allows( &self, node: &Node<'_>, subject: &SubjectDescriptor, endpoint: EndpointId, cluster: ClusterId, required: Privilege, ) -> Outcome

Whether an action holding required may proceed.

The shape AccessControl wants. Restricted is never returned: §6.6.2.8’s Access Restriction List belongs to the ManagedDevice feature, which this build does not implement, and inventing a restriction would deny access the specification grants.

Trait Implementations§

Source§

impl<C: Config, const N: usize, const S: usize, const T: usize> Capacity for Acl<C, N, S, T>

Source§

const PER_FABRIC: usize = C::ACL_ENTRIES_PER_FABRIC

§9.10.6.7’s AccessControlEntriesPerFabric: the fixed share each fabric is promised.

Source§

const TOTAL: usize = N

Total slots, across every fabric.
Source§

impl<C: Debug + Config, const N: usize, const S: usize, const T: usize> Debug for Acl<C, N, S, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: Config, const N: usize, const S: usize, const T: usize> Default for Acl<C, N, S, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C, const N: usize, const S: usize, const T: usize> Forget for Acl<C, N, S, T>

§

impl<C, const N: usize, const S: usize, const T: usize> Freeze for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: Freeze, PhantomData<C>: Freeze,

§

impl<C, const N: usize, const S: usize, const T: usize> Move for Acl<C, N, S, T>

§

impl<C, const N: usize, const S: usize, const T: usize> RefUnwindSafe for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: RefUnwindSafe, PhantomData<C>: RefUnwindSafe,

§

impl<C, const N: usize, const S: usize, const T: usize> Send for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: Send, PhantomData<C>: Send,

§

impl<C, const N: usize, const S: usize, const T: usize> Sync for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: Sync, PhantomData<C>: Sync,

§

impl<C, const N: usize, const S: usize, const T: usize> Unpin for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: Unpin, PhantomData<C>: Unpin,

§

impl<C, const N: usize, const S: usize, const T: usize> UnsafeUnpin for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: UnsafeUnpin, PhantomData<C>: UnsafeUnpin,

§

impl<C, const N: usize, const S: usize, const T: usize> UnwindSafe for Acl<C, N, S, T>
where VecInner<Entry<S, T>, usize, VecStorageInner<[MaybeUninit<Entry<S, T>>; N]>>: UnwindSafe, PhantomData<C>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.