zephyr/subsys/bluetooth/host/classic/l2cap_br_interface.h
Jonathan Rico b6cdf10310 Bluetooth: L2CAP: remove seg_pool
We can get rid of the view pool for SDU segments :)
We have to make the code slightly more complex :'(

The basic idea is always giving the original SDU buffer to `conn.c` for it
to pull ACL fragments from.

In order to do this, we need to add the PDU headers just-in-time.
`bt_l2cap_send_pdu()` does not add them before putting the PDU on the queue
anymore. They are added by `l2cap_data_pull()` right before the data leaves
`l2cap.c` for `conn.c`.

We also have to inform `conn.c` "out of band" of the real L2CAP PDU size so
it doesn't fragment across segment boundaries. This oob is the new `length`
parameter to the `.pull()` method.

This is the added complexity mentioned above.

Since SDU segmentation concerns only LE-L2CAP, ISO and Classic L2CAP don't
need this extra logic.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-06-12 18:51:34 +02:00

54 lines
1.7 KiB
C

/* l2cap_br.c - L2CAP BREDR internal interface
*
* This is the only interface between l2cap.c and l2cap_br.c.
*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Initialize BR/EDR L2CAP signal layer */
void bt_l2cap_br_init(void);
/* Notify BR/EDR L2CAP channels about established new ACL connection */
void bt_l2cap_br_connected(struct bt_conn *conn);
/* Notify BR/EDR L2CAP channels about ACL disconnection*/
void bt_l2cap_br_disconnected(struct bt_conn *conn);
/* Lookup BR/EDR L2CAP channel by Receiver CID */
struct bt_l2cap_chan *bt_l2cap_br_lookup_rx_cid(struct bt_conn *conn,
uint16_t cid);
/* Disconnects dynamic channel */
int bt_l2cap_br_chan_disconnect(struct bt_l2cap_chan *chan);
/* Make connection to peer psm server */
int bt_l2cap_br_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
uint16_t psm);
/* Send packet data to connected peer */
int bt_l2cap_br_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf);
int bt_l2cap_br_chan_send_cb(struct bt_l2cap_chan *chan, struct net_buf *buf, bt_conn_tx_cb_t cb,
void *user_data);
/* Send a single PDU over a BR channel.
* Used by e.g. SMP.
*/
int bt_l2cap_br_send_cb(struct bt_conn *conn, uint16_t cid, struct net_buf *buf,
bt_conn_tx_cb_t cb, void *user_data);
/*
* Handle security level changed on link passing HCI status of performed
* security procedure.
*/
void l2cap_br_encrypt_change(struct bt_conn *conn, uint8_t hci_status);
/* Handle received data */
void bt_l2cap_br_recv(struct bt_conn *conn, struct net_buf *buf);
/* Pull HCI fragments from buffers intended for `conn` */
struct net_buf *l2cap_br_data_pull(struct bt_conn *conn,
size_t amount,
size_t *length);