pub struct ProtocolSession { /* private fields */ }Expand description
Protocol session
Implementations§
Source§impl ProtocolSession
impl ProtocolSession
Sourcepub fn new_server(cipher_suite: CipherSuite) -> Self
pub fn new_server(cipher_suite: CipherSuite) -> Self
Create a new server-side session
Sourcepub fn new_client(cipher_suite: CipherSuite) -> Self
pub fn new_client(cipher_suite: CipherSuite) -> Self
Create a new client-side session
Sourcepub fn local_session_id(&self) -> &SessionIdBytes
pub fn local_session_id(&self) -> &SessionIdBytes
Get local session ID
Sourcepub fn remote_session_id(&self) -> Option<&SessionIdBytes>
pub fn remote_session_id(&self) -> Option<&SessionIdBytes>
Get remote session ID
Sourcepub fn state(&self) -> ProtocolState
pub fn state(&self) -> ProtocolState
Get current state
Sourcepub fn set_state(&mut self, state: ProtocolState)
pub fn set_state(&mut self, state: ProtocolState)
Set state
Sourcepub fn set_remote_session_id(&mut self, id: SessionIdBytes)
pub fn set_remote_session_id(&mut self, id: SessionIdBytes)
Set remote session ID
Sourcepub fn set_tls_auth(&mut self, key: HmacAuth)
pub fn set_tls_auth(&mut self, key: HmacAuth)
Enable tls-auth
Sourcepub fn process_packet(&mut self, data: &[u8]) -> Result<ProcessedPacket>
pub fn process_packet(&mut self, data: &[u8]) -> Result<ProcessedPacket>
Process incoming packet
Sourcepub fn create_hard_reset_response(&mut self) -> Result<Bytes>
pub fn create_hard_reset_response(&mut self) -> Result<Bytes>
Create a hard reset response packet
Sourcepub fn create_control_packet(&mut self, tls_data: Bytes) -> Result<Bytes>
pub fn create_control_packet(&mut self, tls_data: Bytes) -> Result<Bytes>
Create a control packet with TLS data
Sourcepub fn create_ack_packet(&mut self) -> Option<Bytes>
pub fn create_ack_packet(&mut self) -> Option<Bytes>
Create an ACK packet
Sourcepub fn install_keys(&mut self, key_material: &KeyMaterial, is_server: bool)
pub fn install_keys(&mut self, key_material: &KeyMaterial, is_server: bool)
Install data channel keys
Sourcepub fn encrypt_data(&mut self, data: &[u8]) -> Result<Bytes>
pub fn encrypt_data(&mut self, data: &[u8]) -> Result<Bytes>
Encrypt data for transmission
Sourcepub fn get_retransmits(&mut self) -> Vec<Bytes>
pub fn get_retransmits(&mut self) -> Vec<Bytes>
Get packets needing retransmission
Sourcepub fn should_send_ack(&self) -> bool
pub fn should_send_ack(&self) -> bool
Check if we should send an ACK
Sourcepub fn next_timeout(&self) -> Option<Duration>
pub fn next_timeout(&self) -> Option<Duration>
Get next timeout
Sourcepub fn is_established(&self) -> bool
pub fn is_established(&self) -> bool
Check if session is established
Sourcepub fn rotate_key(&mut self)
pub fn rotate_key(&mut self)
Rotate to next key ID (for rekeying)
Auto Trait Implementations§
impl Freeze for ProtocolSession
impl RefUnwindSafe for ProtocolSession
impl Send for ProtocolSession
impl Sync for ProtocolSession
impl Unpin for ProtocolSession
impl UnwindSafe for ProtocolSession
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