Skip to main content

FragmentAssembler

Struct FragmentAssembler 

Source
pub struct FragmentAssembler { /* private fields */ }
Expand description

Joins fragmented GIOP 1.1 and 1.2 messages.

Feed every complete message received on one connection to push. Unfragmented messages are returned as they are; a fragmented one is returned as a single message, with the more-fragments flag cleared and the size updated, once its last fragment arrives.

GIOP 1.1 allows one fragmented message at a time per connection. GIOP 1.2 interleaves them by request id, which is the first field of every message that can be fragmented.

The data in each Fragment is aligned relative to the start of that Fragment message, as omniORB writes and reads it. In GIOP 1.2 the data of a fragment starts at offset 16 and every fragment but the last ends on an 8-byte boundary, so this is the same as aligning the joined message. In GIOP 1.1 it is not: omniORB ends each fragment on an 8-byte boundary and continues at offset 12 of the next, so an 8-byte value after a fragment boundary would be read 4 bytes off. The joined message therefore carries a Segment for each fragment, which AssembledMessage::decode passes on to the body decoder.

Implementations§

Source§

impl FragmentAssembler

Source

pub const DEFAULT_MAX_MESSAGE_SIZE: usize

Default limit on the size of a reassembled message: 64 MiB.

Source

pub fn new(max_message_size: usize) -> FragmentAssembler

Creates an assembler that rejects reassembled messages longer than max_message_size bytes, header included.

Source

pub fn has_pending(&self) -> bool

Whether any fragmented message is incomplete.

Source

pub fn cancel(&mut self, request_id: u32) -> bool

Drops an incomplete GIOP 1.2 message, as on a CancelRequest.

Source

pub fn push(&mut self, msg: &[u8]) -> Result<Option<AssembledMessage>>

Takes one complete message and returns a whole message when one is ready.

Source

pub fn push_owned(&mut self, msg: Vec<u8>) -> Result<Option<AssembledMessage>>

Like push, but takes the buffer the message was read into: an unfragmented message, and the first fragment of a fragmented one, keep it instead of copying it.

Trait Implementations§

Source§

impl Debug for FragmentAssembler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FragmentAssembler

Source§

fn default() -> FragmentAssembler

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.