pub struct SendBuffer {
pub max_message_size: usize,
pub max_chunk_count: usize,
pub send_buffer_size: usize,
/* private fields */
}Expand description
General implementation of a buffer of outgoing messages.
Fields§
§max_message_size: usizeMaximum size of a message, total. Use 0 for no limit
max_chunk_count: usizeMaximum number of chunks in a message.
send_buffer_size: usizeMaximum size of each individual chunk.
Implementations§
Source§impl SendBuffer
impl SendBuffer
Sourcepub fn new(
buffer_size: usize,
max_message_size: usize,
max_chunk_count: usize,
sequence_numbers_legacy: bool,
) -> SendBuffer
pub fn new( buffer_size: usize, max_message_size: usize, max_chunk_count: usize, sequence_numbers_legacy: bool, ) -> SendBuffer
Create a new send buffer with the given initial limits.
Sourcepub fn encode_next_chunk(
&mut self,
secure_channel: &SecureChannel,
) -> Result<(), StatusCode>
pub fn encode_next_chunk( &mut self, secure_channel: &SecureChannel, ) -> Result<(), StatusCode>
Encode the next chunk in the queue to the out-buffer.
Sourcepub fn set_sequence_number_legacy(&mut self, is_legacy: bool)
pub fn set_sequence_number_legacy(&mut self, is_legacy: bool)
Set whether we are using legacy sequence numbers or not. This depends on the active security policy.
Sourcepub fn write_error(&mut self, error: ErrorMessage)
pub fn write_error(&mut self, error: ErrorMessage)
Clear the list of pending messages, then add an error.
Sourcepub fn write_ack(&mut self, ack: AcknowledgeMessage)
pub fn write_ack(&mut self, ack: AcknowledgeMessage)
Write an acknowledge message to the list of pending messages.
Sourcepub fn write(
&mut self,
request_id: u32,
message: impl Message,
secure_channel: &SecureChannel,
) -> Result<u32, Error>
pub fn write( &mut self, request_id: u32, message: impl Message, secure_channel: &SecureChannel, ) -> Result<u32, Error>
Encode a message to chunks, then write them to the pending message queue.
The messages are encrypted as they are sent.
Sourcepub fn next_request_id(&mut self) -> u32
pub fn next_request_id(&mut self) -> u32
Get the next request ID.
Sourcepub async fn read_into_async(
&mut self,
write: &mut (impl AsyncWrite + Unpin),
) -> Result<(), Error>
pub async fn read_into_async( &mut self, write: &mut (impl AsyncWrite + Unpin), ) -> Result<(), Error>
Read the pending buffer into the given stream.
Sourcepub fn should_encode_chunks(&self) -> bool
pub fn should_encode_chunks(&self) -> bool
Return true if we should encode a new chunk.
Auto Trait Implementations§
impl Freeze for SendBuffer
impl RefUnwindSafe for SendBuffer
impl Send for SendBuffer
impl Sync for SendBuffer
impl Unpin for SendBuffer
impl UnsafeUnpin for SendBuffer
impl UnwindSafe for SendBuffer
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