pub struct SessionLayer { /* private fields */ }Expand description
The session table + session_nb allocator.
Implementations§
Source§impl SessionLayer
impl SessionLayer
Sourcepub fn resource_of(&self, session_nb: u16) -> Option<ResourceId>
pub fn resource_of(&self, session_nb: u16) -> Option<ResourceId>
Resource bound to session_nb, if open.
Sourcepub fn sessions(&self) -> Vec<(u16, ResourceId)>
pub fn sessions(&self) -> Vec<(u16, ResourceId)>
All open (session_nb, resource) pairs, ascending by session_nb.
Sourcepub fn create_session(&mut self, resource: ResourceId) -> Vec<u8> ⓘ
pub fn create_session(&mut self, resource: ResourceId) -> Vec<u8> ⓘ
Open a session to a module-provided resource (host-initiated):
returns the create_session SPDU to send. The session is recorded once
the module’s create_session_response(ok) arrives.
Sourcepub fn send_apdu(&self, session_nb: u16, apdu: &[u8]) -> Vec<u8> ⓘ
pub fn send_apdu(&self, session_nb: u16, apdu: &[u8]) -> Vec<u8> ⓘ
Wrap an APDU for sending on session_nb (session_number + body).
Sourcepub fn close(&mut self, session_nb: u16) -> Vec<u8> ⓘ
pub fn close(&mut self, session_nb: u16) -> Vec<u8> ⓘ
Begin closing session_nb: returns the close_session_request SPDU.
Sourcepub fn on_spdu(
&mut self,
spdu: &[u8],
provides: impl Fn(ResourceId) -> bool,
) -> SessionOut
pub fn on_spdu( &mut self, spdu: &[u8], provides: impl Fn(ResourceId) -> bool, ) -> SessionOut
Handle one inbound SPDU. provides answers “does the host provide this
resource?” for an incoming open_session_request.
Trait Implementations§
Source§impl Debug for SessionLayer
impl Debug for SessionLayer
Source§impl Default for SessionLayer
impl Default for SessionLayer
Source§fn default() -> SessionLayer
fn default() -> SessionLayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SessionLayer
impl RefUnwindSafe for SessionLayer
impl Send for SessionLayer
impl Sync for SessionLayer
impl Unpin for SessionLayer
impl UnsafeUnpin for SessionLayer
impl UnwindSafe for SessionLayer
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