pub struct MultiReceiver { /* private fields */ }
Expand description
Multi-sessions FLUTE receiver Demultiplex multiple FLUTE Transport Sessions
Implementations§
Source§impl MultiReceiver
impl MultiReceiver
Sourcepub fn new(
writer: Rc<dyn ObjectWriterBuilder>,
config: Option<Config>,
enable_tsi_filtering: bool,
) -> MultiReceiver
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 FLUTEReceiver
. ifNone
, defaultConfig
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)
Sourcepub fn add_listener<L>(&mut self, listener: L) -> u64where
L: MultiReceiverListener + 'static,
pub fn add_listener<L>(&mut self, listener: L) -> u64where
L: MultiReceiverListener + 'static,
Sourcepub fn remove_listener(&mut self, id: u64)
pub fn remove_listener(&mut self, id: u64)
Sourcepub fn nb_objects(&self) -> usize
pub fn nb_objects(&self) -> usize
Number of objects that are we are receiving
Sourcepub fn nb_objects_error(&self) -> usize
pub fn nb_objects_error(&self) -> usize
Number objects in error state
Sourcepub fn set_tsi_filtering(&mut self, enable: bool)
pub fn set_tsi_filtering(&mut self, enable: bool)
Enable/Disable TSI filtering
Sourcepub fn add_listen_tsi(&mut self, endpoint: UDPEndpoint, tsi: u64)
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.
Sourcepub fn remove_listen_tsi(&mut self, endpoint: &UDPEndpoint, tsi: u64)
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.
Sourcepub fn add_listen_all_tsi(&mut self, endpoint: UDPEndpoint)
pub fn add_listen_all_tsi(&mut self, endpoint: UDPEndpoint)
Accepts all TSI sessions for a given endpoint
Sourcepub fn remove_listen_all_tsi(&mut self, endpoint: &UDPEndpoint)
pub fn remove_listen_all_tsi(&mut self, endpoint: &UDPEndpoint)
Remove the acceptance of all TSI sessions for a given endpoint
Sourcepub fn push(
&mut self,
endpoint: &UDPEndpoint,
pkt: &[u8],
now: SystemTime,
) -> Result<()>
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
- TheUDPEndpoint
from where the packet is received.pkt
- The payload of the UDP/IP packet.now
- The currentSystemTime
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.
Sourcepub fn cleanup(&mut self, now: SystemTime)
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