pub struct FailSafe { /* private fields */ }Implementations§
Source§impl FailSafe
impl FailSafe
pub const fn new() -> FailSafe
pub fn init() -> impl Init<FailSafe>
Sourcepub fn check_failsafe_timeout<S, N>(
&mut self,
fabrics: &mut Fabrics,
sessions: &mut Sessions,
networks: N,
kv: S,
expire_sess_id: Option<u32>,
mdns_notif: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<Option<NonZero<u8>>, Error>where
S: KvBlobStoreAccess,
N: NetworksAccess,
pub fn check_failsafe_timeout<S, N>(
&mut self,
fabrics: &mut Fabrics,
sessions: &mut Sessions,
networks: N,
kv: S,
expire_sess_id: Option<u32>,
mdns_notif: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<Option<NonZero<u8>>, Error>where
S: KvBlobStoreAccess,
N: NetworksAccess,
Check if the fail-safe timer has expired and if so disarms and restores the state of the fabric as well as the basic info settings.
This should be called periodically to ensure that the fail-safe state is updated in a timely manner. Ideally, it should also be called at the beginning of any API that requires the fail-safe to be armed to ensure that the state is up to date.
Returns the local index of the fabric that ended up removed by the
rollback (see [Failsafe::expire]), if any - the caller must follow
up with a HandlerContext::notify_fabric_removed broadcast once the
Matter state lock is released.
Sourcepub fn expire<S, N>(
&mut self,
fabrics: &mut Fabrics,
sessions: &mut Sessions,
expire_sess_id: Option<u32>,
networks: N,
kv: S,
mdns_notif: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<Option<NonZero<u8>>, Error>where
S: KvBlobStoreAccess,
N: NetworksAccess,
pub fn expire<S, N>(
&mut self,
fabrics: &mut Fabrics,
sessions: &mut Sessions,
expire_sess_id: Option<u32>,
networks: N,
kv: S,
mdns_notif: impl FnMut(),
notify_change: impl FnMut(u16, u32),
) -> Result<Option<NonZero<u8>>, Error>where
S: KvBlobStoreAccess,
N: NetworksAccess,
Force the fail-safe context to expire immediately, rolling back any fabric / network changes that the in-flight commissioning had staged and resetting the breadcrumb to 0.
expire_sess_id is the optional session ID of the exchange that
triggered the expiry — typically passed when the trigger arrived
over PASE, so the response can still be sent before the slot is
reclaimed. None for the timeout-driven path or when the trigger
arrived over CASE.
Returns the local index of the fabric the rollback ended up removing,
if any: a fabric added by the in-flight AddNOC has no persisted copy
yet and is simply dropped, whereas a pre-existing fabric mutated by
UpdateNOC is resurrected from its persisted copy (and is thus NOT
reported as removed). The caller must follow up with a
HandlerContext::notify_fabric_removed broadcast for a reported
removal, once the Matter state lock is released.
pub fn arm( &mut self, timeout_secs: u16, breadcrumb: u64, session_mode: &SessionMode, pase: &mut Pase, ) -> Result<(), Error>
pub fn disarm<'a>( &mut self, session_mode: &SessionMode, fabrics: &'a mut Fabrics, ) -> Result<&'a mut Fabric, Error>
pub fn is_armed(&self) -> bool
Sourcepub fn pending_root_ca(&self) -> Option<&[u8]>
pub fn pending_root_ca(&self) -> Option<&[u8]>
Return the trusted root certificate that has been staged via
AddTrustedRootCertificate while the fail-safe is armed but has not
yet been bound to a fabric via AddNOC / UpdateNOC.
Once AddNOC or UpdateNOC is processed the root certificate is
owned by the (new or updated) fabric and is reported through the
fabric table; until then it has no fabric association but the spec
still requires it to appear in the TrustedRootCertificates list
(Matter Core spec, NodeOperationalCredentials cluster).
pub fn is_armed_for(&self, caller_fab_idx: u8) -> bool
Sourcepub fn has_pending_noc_for(&self, caller_fab_idx: NonZero<u8>) -> bool
pub fn has_pending_noc_for(&self, caller_fab_idx: NonZero<u8>) -> bool
Whether the current fail-safe context already has an in-flight
AddNOC or UpdateNOC for caller_fab_idx. Used by
SetVIDVerificationStatement to decide whether the VID-verification
mutation rides along with the pending fabric (and thus rolls back
on fail-safe expiry) or is committed to storage immediately.
pub fn check_armed(&self, session_mode: &SessionMode) -> Result<(), Error>
pub fn add_trusted_root_cert<C>(
&mut self,
crypto: C,
time: UtcTime,
session_mode: &SessionMode,
root_ca: &[u8],
buf: &mut [u8],
) -> Result<(), Error>where
C: Crypto,
pub fn add_csr_req<C>(
&mut self,
crypto: C,
session_mode: &SessionMode,
) -> Result<CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcSecretKeyRef::{constant#0}>, Error>where
C: Crypto,
pub fn update_csr_req<C>(
&mut self,
crypto: C,
session_mode: &SessionMode,
) -> Result<CryptoSensitiveRef<'_, rs_matter::::crypto::canon::CanonPkcSecretKeyRef::{constant#0}>, Error>where
C: Crypto,
pub fn update_noc<'a, C>(
&mut self,
crypto: C,
time: UtcTime,
fabrics: &'a mut Fabrics,
session_mode: &SessionMode,
icac: Option<&[u8]>,
noc: &[u8],
buf: &mut [u8],
mdns_notif: impl FnMut(),
) -> Result<&'a mut Fabric, Error>where
C: Crypto,
pub fn add_noc<'a, C>(
&mut self,
crypto: C,
time: UtcTime,
fabrics: &'a mut Fabrics,
session_mode: &SessionMode,
vendor_id: u16,
icac: Option<&[u8]>,
noc: &[u8],
ipk: &[u8],
case_admin_subject: u64,
buf: &mut [u8],
mdns_notif: impl FnMut(),
) -> Result<&'a mut Fabric, Error>where
C: Crypto,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FailSafe
impl RefUnwindSafe for FailSafe
impl Send for FailSafe
impl Sync for FailSafe
impl Unpin for FailSafe
impl UnsafeUnpin for FailSafe
impl UnwindSafe for FailSafe
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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