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

Module rfcomm

Module rfcomm 

Source
Expand description

Bluetooth RFCOMM (Serial Port Emulation Protocol)

Implements the RFCOMM multiplexer protocol over L2CAP (PSM 0x0003), providing RS-232 serial port emulation. Supports credit-based flow control, FCS computation, modem status commands, and DLCI-based multiplexing for multiple simultaneous serial connections.

Reference: Bluetooth Core Specification v5.4, RFCOMM with TS 07.10

Structs§

CreditFlowControl
Credit-based flow control state for an RFCOMM channel
ModemSignals
Modem signal bits for MSC (Modem Status Command)
RfcommChannel
An RFCOMM data channel (one per DLCI)
RfcommFrame
An RFCOMM frame
RfcommMultiplexer
RFCOMM multiplexer: manages all channels over a single L2CAP connection

Enums§

ChannelState
RFCOMM channel state
MuxCommandType
RFCOMM multiplexer control command types

Constants§

DEFAULT_INITIAL_CREDITS
Default initial credits for credit-based flow control
DLCI_CONTROL
DLCI 0 is the multiplexer control channel
FRAME_DISC
DISC (Disconnect) - disconnect request
FRAME_DM
DM (Disconnected Mode) - rejection / channel not available
FRAME_SABM
SABM (Set Asynchronous Balanced Mode) - connection establishment
FRAME_UA
UA (Unnumbered Acknowledgement) - acknowledgement
FRAME_UIH
UIH (Unnumbered Information with Header check) - data transfer
MAX_DLCI
Maximum DLCI value (5 bits, 0-30 usable; 31 reserved)
RFCOMM_DEFAULT_MTU
Default RFCOMM MTU (maximum frame size, N1)
RFCOMM_MAX_FRAME_DATA
Maximum RFCOMM frame data size for fixed-size buffers
RFCOMM_MAX_MTU
Maximum RFCOMM MTU
RFCOMM_PSM
L2CAP PSM for RFCOMM

Functions§

calculate_fcs
Calculate FCS over a byte slice
decode_cr
Decode the C/R bit from an RFCOMM address byte
decode_dlci
Decode the DLCI from an RFCOMM address byte
encode_address
Encode the RFCOMM address byte from DLCI, C/R bit, and EA bit
verify_fcs
Verify FCS: compute over data + fcs byte, result should be 0xCF