ytls_traits/t_io.rs
1//! ytls I/O traits
2
3/// TLS State Machine Left (Ciphertext) or "Network" I/O egress side
4pub trait TlsLeftOut {
5 /// Send encoded record data out.
6 fn send_record_out(&mut self, data: &[u8]) -> ();
7}
8
9/// TLS State Machine Left (Ciphertext) or "Network" I/O ingress side
10pub trait TlsLeftIn {
11 /// Provide the Ingress buffer in
12 fn left_buf_in(&self) -> &[u8];
13 // State machine requires Left I/O to send out len egress bytes
14 //fn left_buf_mark_send_out(&mut self, _len: usize) -> ()
15 /// State machine requires Left I/O to discard processed ingress bytes
16 fn left_buf_mark_discard_in(&mut self, _len: usize) -> ();
17}
18
19/// TLS State Machine Right (Cleartext) or "Application" I/O side
20pub trait TlsRight {
21 /// State machine provides decrypted traffic
22 fn on_decrypted(&mut self, _data: &[u8]) -> ();
23 /// State machine asks traffic to be encrypted
24 fn on_encrypt(&self) -> &[u8];
25 /// State machine requires Right I/O to discard encrypted ingress bytes.
26 fn right_buf_mark_discard_out(&mut self, _len: usize) -> ();
27}