Struct MultiReceiver

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

Multi-sessions FLUTE receiver Demultiplex multiple FLUTE Transport Sessions

Implementations§

Source§

impl MultiReceiver

Source

pub fn new( writer: Rc<dyn ObjectWriterBuilder>, config: Option<Config>, enable_tsi_filtering: bool, ) -> MultiReceiver

Creates a new MultiReceiver instance, which allows receiving multiple interlaced FLUTE sessions.

§Arguments
  • writer - Responsible to write object to its final destination.

  • config - Configuration of the FLUTE Receiver. if None, default Config will be used

  • enable_tsi_filtering - Enable TSI filter mechanism

§Example
// Receive objects from Transport Session 1
use flute::receiver::writer::ObjectWriterBufferBuilder;
use flute::receiver::{MultiReceiver};
use flute::core::UDPEndpoint;
use std::rc::Rc;

let tsi: u64 = 1;
// Write object to a buffer
let enable_md5_check = true;
let writer = Rc::new(ObjectWriterBufferBuilder::new(enable_md5_check));
let mut receiver = MultiReceiver::new(writer.clone(), None, true);
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_owned(), 3000);
receiver.add_listen_tsi(endpoint, tsi)
Source

pub fn add_listener<L>(&mut self, listener: L) -> u64
where L: MultiReceiverListener + 'static,

Add a listener to the MultiReceiver

§Arguments
  • listener - The listener to add
§Returns

The id of the listener

Source

pub fn remove_listener(&mut self, id: u64)

Remove a listener from the MultiReceiver

§Arguments
  • id - The id of the listener to remove
Source

pub fn nb_objects(&self) -> usize

Number of objects that are we are receiving

Source

pub fn nb_objects_error(&self) -> usize

Number objects in error state

Source

pub fn set_tsi_filtering(&mut self, enable: bool)

Enable/Disable TSI filtering

Source

pub fn add_listen_tsi(&mut self, endpoint: UDPEndpoint, tsi: u64)

Accept a TSI session for a given endpoint and TSI

§Arguments
  • endpoint - Add the TSI filter for this endpoint.

  • tsi - tsi The TSI value to filter.

Source

pub fn remove_listen_tsi(&mut self, endpoint: &UDPEndpoint, tsi: u64)

Removes a TSI filter for a given endpoint and TSI

§Arguments
  • endpoint - remove the TSI filter for this endpoint.

  • tsi - The TSI value to remove the filter for.

Source

pub fn add_listen_all_tsi(&mut self, endpoint: UDPEndpoint)

Accepts all TSI sessions for a given endpoint

Source

pub fn remove_listen_all_tsi(&mut self, endpoint: &UDPEndpoint)

Remove the acceptance of all TSI sessions for a given endpoint

Source

pub fn push( &mut self, endpoint: &UDPEndpoint, pkt: &[u8], now: SystemTime, ) -> Result<()>

Push an ALC/LCT packet to the Receiver.

This method is used to push an ALC/LCT packet (the payload of a UDP/IP packet) to the Receiver.

§Arguments
  • endpoint - The UDPEndpoint from where the packet is received.
  • pkt - The payload of the UDP/IP packet.
  • now - The current SystemTime to use for time-related operations.
§Returns

A Result indicating success (Ok) or an error (Err).

§Errors

Returns an error if the packet is not valid or the receiver is in an error state.

Source

pub fn cleanup(&mut self, now: SystemTime)

Remove FLUTE session that are closed or expired Remove Objects that are expired

Cleanup shall be call from time to time to avoid consuming to much memory

Trait Implementations§

Source§

impl Debug for MultiReceiver

Source§

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

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

impl Drop for MultiReceiver

Source§

fn drop(&mut self)

Executes the destructor for this 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T