⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

L2capManager

Struct L2capManager 

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

L2CAP connection and channel manager

Implementations§

Source§

impl L2capManager

Source

pub fn new() -> Self

Create a new L2CAP manager

Source

pub fn channel_count(&self) -> usize

Get number of active channels

Source

pub fn get_channel(&self, local_cid: u16) -> Option<&L2capChannel>

Get a channel by local CID

Source

pub fn get_channel_mut(&mut self, local_cid: u16) -> Option<&mut L2capChannel>

Get a mutable reference to a channel by local CID

Source

pub fn open_channel( &mut self, psm: u16, hci_handle: u16, ) -> Result<(u16, SignalingCommand), KernelError>

Open a new L2CAP channel for the given PSM on the given HCI connection

Returns (local_cid, SignalingCommand to send to peer)

Source

pub fn close_channel( &mut self, local_cid: u16, ) -> Result<SignalingCommand, KernelError>

Close an existing L2CAP channel

Returns a SignalingCommand (Disconnection Request) to send to peer

Source

pub fn remove_channel(&mut self, local_cid: u16) -> Option<L2capChannel>

Remove a channel entirely (after disconnection completes)

Source

pub fn send_data( &self, local_cid: u16, data: &[u8], ) -> Result<Vec<SarFragment>, KernelError>

Send data on an open channel, segmenting into PDU fragments if needed

Returns a list of SAR fragments ready to be sent over HCI ACL

Source

pub fn receive_data( &mut self, local_cid: u16, fragment: &[u8], is_first: bool, ) -> Result<Option<Vec<u8>>, KernelError>

Receive and reassemble data for a channel

Feeds a raw fragment into the reassembly buffer. Returns completed payload when all fragments have been received.

Source

pub fn process_signaling( &mut self, cmd: &SignalingCommand, ) -> Result<Option<SignalingCommand>, KernelError>

Process an incoming L2CAP signaling command

Returns an optional response command to send back

Source

pub fn configure_channel( &mut self, local_cid: u16, mtu: u16, flush_timeout: u16, ) -> Result<(), KernelError>

Configure a channel’s MTU and flush timeout

Trait Implementations§

Source§

impl Default for L2capManager

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for L2capManager

§

impl RefUnwindSafe for L2capManager

§

impl Send for L2capManager

§

impl Sync for L2capManager

§

impl Unpin for L2capManager

§

impl UnwindSafe for L2capManager

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.