Struct someip_parse::TpPool

source ·
pub struct TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized, Timestamp: Sized + Debug + Clone,
{ /* private fields */ }
Expand description

Pool of buffers to reconstruct multiple SOMEIP TP packet streams in parallel (re-uses buffers to minimize allocations).

This implementation is NOT safe against “Out of Memory” attacks

If you use the TpPool in an untrusted environment an attacker could cause an “out of memory error” by opening up multiple parallel TP streams, never ending them and filling them up with as much data as possible.

Mitigations will hopefully be offered in future versions but if you have take care right now you can still use TpBuf directly and implement the connection handling and mitigation yourself.

Implementations§

source§

impl<ChannelId, Timestamp> TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized, Timestamp: Debug + Clone + Sized,

source

pub fn new(buf_config: TpBufConfig) -> TpPool<ChannelId, Timestamp>

source

pub fn with_capacity( buf_config: TpBufConfig, initial_bufs_count: usize ) -> TpPool<ChannelId, Timestamp>

source

pub fn reserve(&mut self, additional: usize)

Reserves the given number as buffers.

source

pub fn active_bufs(&self) -> &HashMap<(ChannelId, u32), (TpBuf, Timestamp)>

source

pub fn finished_bufs(&self) -> &Vec<TpBuf>

source

pub fn buf_config(&self) -> &TpBufConfig

source

pub fn consume<'a: 'c, 'b: 'c, 'c: 'a + 'b>( &'a mut self, id: ChannelId, timestamp: Timestamp, someip_slice: SomeipMsgSlice<'b> ) -> Result<Option<SomeipMsgSlice<'c>>, TpReassembleError>

source

pub fn retain<F>(&mut self, f: F)
where F: Fn(&Timestamp) -> bool,

Retains only the elements specified by the predicate.

Trait Implementations§

source§

impl<ChannelId, Timestamp> Clone for TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized + Clone, Timestamp: Sized + Debug + Clone + Clone,

source§

fn clone(&self) -> TpPool<ChannelId, Timestamp>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<ChannelId, Timestamp> Debug for TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized + Debug, Timestamp: Sized + Debug + Clone + Debug,

source§

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

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

impl<ChannelId, Timestamp> PartialEq for TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized, Timestamp: Debug + Clone + Sized + PartialEq,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<ChannelId, Timestamp> Eq for TpPool<ChannelId, Timestamp>
where ChannelId: Hash + Eq + PartialEq + Clone + Sized, Timestamp: Debug + Clone + Sized + PartialEq + Eq,

Auto Trait Implementations§

§

impl<ChannelId, Timestamp> RefUnwindSafe for TpPool<ChannelId, Timestamp>
where ChannelId: RefUnwindSafe, Timestamp: RefUnwindSafe,

§

impl<ChannelId, Timestamp> Send for TpPool<ChannelId, Timestamp>
where ChannelId: Send, Timestamp: Send,

§

impl<ChannelId, Timestamp> Sync for TpPool<ChannelId, Timestamp>
where ChannelId: Sync, Timestamp: Sync,

§

impl<ChannelId, Timestamp> Unpin for TpPool<ChannelId, Timestamp>
where ChannelId: Unpin, Timestamp: Unpin,

§

impl<ChannelId, Timestamp> UnwindSafe for TpPool<ChannelId, Timestamp>
where ChannelId: UnwindSafe, Timestamp: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.