Documentation
¶
Overview ¶
Package l2cap decodes Bluetooth L2CAP (Logical Link Control and Adaptation Protocol) — the channel-multiplexing layer that rides inside HCI ACL data and carries the higher Bluetooth protocols. It is the bridge between the project's bt_hci_decode (the HCI transport below) and its BLE / GATT tooling (above): an L2CAP frame's Channel ID (CID) selects the protocol — the **signaling** channel (connection / configuration / the LE connection- parameter-update and credit-based-connection requests), **ATT** (the Attribute Protocol behind GATT), **SMP** (the Security Manager — BLE pairing), or a dynamic channel. Decoding an L2CAP frame from a btsnoop / HCI-ACL capture reveals which Bluetooth sub-protocol is in flight and, for the signaling / ATT / SMP channels, the specific operation (a GATT read / write / notification, a pairing request, a connection-parameter update) — the recon headline for Bluetooth-stack analysis.
Wrap-vs-native judgement ¶
Native. An L2CAP frame is a 2-byte little-endian length + a 2-byte CID, then a per-channel payload (signaling C-frames are code + id + length + data; ATT and SMP PDUs begin with a 1-byte opcode). A byte read + a CID dispatch + opcode tables; stdlib only, no new go.mod dep.
Verifiable / no confidently-wrong output ¶
The basic-header layout, the fixed CIDs, the L2CAP signaling codes, the ATT opcodes and the SMP codes follow the Bluetooth Core specification. The channel is dispatched by CID; the signaling code / ATT opcode / SMP code is named from the spec tables; everything past the named opcode (the per-operation parameters) is surfaced as raw hex (the parameter layouts are operation-specific). An unknown signaling code / ATT opcode / SMP code is reported by value, and a frame shorter than the 4-byte basic header is reported, not guessed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Length int `json:"length"`
CID string `json:"cid"`
CIDName string `json:"cid_name"`
Channel string `json:"channel"` // "signaling" | "att" | "smp" | "dynamic" | "other"
// Signaling channel
SignalingCode string `json:"signaling_code,omitempty"`
SignalingID *int `json:"signaling_identifier,omitempty"`
// ATT / SMP
OpcodeHex string `json:"opcode_hex,omitempty"`
Operation string `json:"operation,omitempty"`
PayloadHex string `json:"payload_hex,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Result is the decoded view of an L2CAP frame.