Struct someip_parse::TpPool
source · pub struct TpPool<ChannelId, Timestamp>{ /* 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>
impl<ChannelId, Timestamp> TpPool<ChannelId, Timestamp>
pub fn new(buf_config: TpBufConfig) -> TpPool<ChannelId, Timestamp>
pub fn with_capacity( buf_config: TpBufConfig, initial_bufs_count: usize ) -> TpPool<ChannelId, Timestamp>
pub fn active_bufs(&self) -> &HashMap<(ChannelId, u32), (TpBuf, Timestamp)>
pub fn finished_bufs(&self) -> &Vec<TpBuf>
pub fn buf_config(&self) -> &TpBufConfig
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>
Trait Implementations§
source§impl<ChannelId, Timestamp> PartialEq for TpPool<ChannelId, Timestamp>
impl<ChannelId, Timestamp> PartialEq for TpPool<ChannelId, Timestamp>
impl<ChannelId, Timestamp> Eq for TpPool<ChannelId, Timestamp>
Auto Trait Implementations§
impl<ChannelId, Timestamp> RefUnwindSafe for TpPool<ChannelId, Timestamp>where
ChannelId: RefUnwindSafe,
Timestamp: RefUnwindSafe,
impl<ChannelId, Timestamp> Send for TpPool<ChannelId, Timestamp>
impl<ChannelId, Timestamp> Sync for TpPool<ChannelId, Timestamp>
impl<ChannelId, Timestamp> Unpin for TpPool<ChannelId, Timestamp>
impl<ChannelId, Timestamp> UnwindSafe for TpPool<ChannelId, Timestamp>where
ChannelId: UnwindSafe,
Timestamp: UnwindSafe,
Blanket Implementations§
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