From 22b007a356c5f05afb15df6933ce446657cbac01 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Mon, 24 Jun 2024 09:51:09 +0000 Subject: [PATCH] External access to the RX and TX transport buffers --- rs-matter/src/transport/core.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rs-matter/src/transport/core.rs b/rs-matter/src/transport/core.rs index 62ada337..add2e16f 100644 --- a/rs-matter/src/transport/core.rs +++ b/rs-matter/src/transport/core.rs @@ -289,6 +289,22 @@ impl<'m> TransportMgr<'m> { } } + /// Return a reference to the transport RX buffer. + /// + /// Useful when external code (like i.e. a user-provided mDNS implementation) + /// needs an RX buffer. + pub fn rx_buffer(&self) -> impl BufferAccess<[u8]> + '_ { + PacketBufferExternalAccess(&self.rx) + } + + /// Return a reference to the transport TX buffer. + /// + /// Useful when external code (like i.e. a user-provided mDNS implementation) + /// needs a TX buffer. + pub fn tx_buffer(&self) -> impl BufferAccess<[u8]> + '_ { + PacketBufferExternalAccess(&self.tx) + } + pub(crate) async fn get_if<'a, F, const N: usize>( &'a self, packet_mutex: &'a IfMutex>,