pub struct MessageChunk {
pub data: Vec<u8>,
}Expand description
A chunk holds a message or a portion of a message, if the message has been split into multiple chunks. The chunk’s data may be signed and encrypted. To extract the message requires all the chunks to be available in sequence so they can be formed back into the message.
Fields§
§data: Vec<u8>All of the chunk’s data including headers, payload, padding, signature
Implementations§
Source§impl MessageChunk
impl MessageChunk
Sourcepub fn new(
sequence_number: u32,
request_id: u32,
message_type: MessageChunkType,
is_final: MessageIsFinalType,
secure_channel: &SecureChannel,
data: &[u8],
) -> Result<MessageChunk, Error>
pub fn new( sequence_number: u32, request_id: u32, message_type: MessageChunkType, is_final: MessageIsFinalType, secure_channel: &SecureChannel, data: &[u8], ) -> Result<MessageChunk, Error>
Create a new message chunk.
Sourcepub fn body_size_from_message_size(
message_type: MessageChunkType,
secure_channel: &SecureChannel,
max_chunk_size: usize,
) -> Result<usize, Error>
pub fn body_size_from_message_size( message_type: MessageChunkType, secure_channel: &SecureChannel, max_chunk_size: usize, ) -> Result<usize, Error>
Calculates the body size that fit inside of a message chunk of a particular size. This requires calculating the size of the header, the signature, padding etc. and deducting it to reveal the message size
Sourcepub fn message_header(
&self,
decoding_options: &DecodingOptions,
) -> Result<MessageChunkHeader, Error>
pub fn message_header( &self, decoding_options: &DecodingOptions, ) -> Result<MessageChunkHeader, Error>
Decode the message header from the inner data.
Sourcepub fn is_open_secure_channel(&self, decoding_options: &DecodingOptions) -> bool
pub fn is_open_secure_channel(&self, decoding_options: &DecodingOptions) -> bool
Check if this message is an OpenSecureChannel request.
Sourcepub fn chunk_info(
&self,
secure_channel: &SecureChannel,
) -> Result<ChunkInfo, Error>
pub fn chunk_info( &self, secure_channel: &SecureChannel, ) -> Result<ChunkInfo, Error>
Decode info about this chunk.
Trait Implementations§
Source§impl Debug for MessageChunk
impl Debug for MessageChunk
Source§impl SimpleBinaryDecodable for MessageChunk
impl SimpleBinaryDecodable for MessageChunk
Source§fn decode<S>(
in_stream: &mut S,
decoding_options: &DecodingOptions,
) -> Result<MessageChunk, Error>
fn decode<S>( in_stream: &mut S, decoding_options: &DecodingOptions, ) -> Result<MessageChunk, Error>
Decode Self from the byte stream.
Auto Trait Implementations§
impl Freeze for MessageChunk
impl RefUnwindSafe for MessageChunk
impl Send for MessageChunk
impl Sync for MessageChunk
impl Unpin for MessageChunk
impl UnsafeUnpin for MessageChunk
impl UnwindSafe for MessageChunk
Blanket Implementations§
Source§impl<T> BinaryDecodable for Twhere
T: SimpleBinaryDecodable,
impl<T> BinaryDecodable for Twhere
T: SimpleBinaryDecodable,
Source§fn decode<S>(stream: &mut S, ctx: &Context<'_>) -> Result<T, Error>
fn decode<S>(stream: &mut S, ctx: &Context<'_>) -> Result<T, Error>
Decodes an instance from the read stream. The decoding options contains restrictions set by
the server / client on the length of strings, arrays etc. If these limits are exceeded the
implementation should return with a
BadDecodingError as soon as possible.Source§impl<T> BinaryEncodable for Twhere
T: SimpleBinaryEncodable,
impl<T> BinaryEncodable for Twhere
T: SimpleBinaryEncodable,
Source§fn byte_len(&self, _ctx: &Context<'_>) -> usize
fn byte_len(&self, _ctx: &Context<'_>) -> usize
Returns the exact byte length of the structure as it would be if
encode were called.
This may be called prior to writing to ensure the correct amount of space is available.Source§fn encode<S>(&self, stream: &mut S, _ctx: &Context<'_>) -> Result<(), Error>
fn encode<S>(&self, stream: &mut S, _ctx: &Context<'_>) -> Result<(), Error>
Encodes the instance to the write stream.
Source§fn override_encoding(&self) -> Option<BuiltInDataEncoding>
fn override_encoding(&self) -> Option<BuiltInDataEncoding>
Override the extension object encoding used for this type.
This only makes sense if the type can only ever be encoded using a single
built-in encoding.
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