pub struct SFrameHeader {
pub kid: u64,
pub ctr: u64,
}Expand description
Decoded SFrame header fields.
Wire format (draft-ietf-sframe-enc §4.3):
┌─┬──────────┬──────────┬───────────────┬───────────────┐
│V│ K (3) │ C (4) │ KID (var) │ CTR (var) │
└─┴──────────┴──────────┴───────────────┴───────────────┘V(1 bit) — version, always0for SFrame v1.K(3 bits) — KID length in bytes minus one (0 → 1 byte, 7 → 8 bytes).C(4 bits) — CTR length in bytes minus one (0 → 1 byte, 15 → 16 bytes).KID— Key ID:(epoch << 16) | leaf_index.CTR— monotonic per-sender counter, big-endian.
Fields§
§kid: u64Key ID: encodes both epoch and sender leaf index.
ctr: u64Per-sender monotonic counter.
Implementations§
Source§impl SFrameHeader
impl SFrameHeader
Sourcepub fn kid_from(epoch: u64, leaf_index: u32) -> u64
pub fn kid_from(epoch: u64, leaf_index: u32) -> u64
Constructs the KID from an epoch and a leaf index.
Uses the lower 16 bits of leaf_index (supports up to 65 535 senders
per epoch) and the full 48 available bits of epoch.
Sourcepub fn epoch_from_kid(kid: u64) -> u64
pub fn epoch_from_kid(kid: u64) -> u64
Extracts the epoch from a KID.
Sourcepub fn leaf_from_kid(kid: u64) -> u32
pub fn leaf_from_kid(kid: u64) -> u32
Extracts the leaf index from a KID.
Trait Implementations§
Source§impl Clone for SFrameHeader
impl Clone for SFrameHeader
Source§fn clone(&self) -> SFrameHeader
fn clone(&self) -> SFrameHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SFrameHeader
Source§impl Debug for SFrameHeader
impl Debug for SFrameHeader
impl Eq for SFrameHeader
Source§impl PartialEq for SFrameHeader
impl PartialEq for SFrameHeader
Source§fn eq(&self, other: &SFrameHeader) -> bool
fn eq(&self, other: &SFrameHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SFrameHeader
Auto Trait Implementations§
impl Freeze for SFrameHeader
impl RefUnwindSafe for SFrameHeader
impl Send for SFrameHeader
impl Sync for SFrameHeader
impl Unpin for SFrameHeader
impl UnsafeUnpin for SFrameHeader
impl UnwindSafe for SFrameHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
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>
Converts
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>
Converts
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