Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
l2cap.h File Reference

Bluetooth L2CAP handling. More...

Go to the source code of this file.

Data Structures

struct  bt_l2cap_chan
 L2CAP Channel structure. More...
 
struct  bt_l2cap_le_endpoint
 LE L2CAP Endpoint structure. More...
 
struct  bt_l2cap_le_chan
 LE L2CAP Channel structure. More...
 
struct  bt_l2cap_br_endpoint
 BREDR L2CAP Endpoint structure. More...
 
struct  bt_l2cap_br_chan
 BREDR L2CAP Channel structure. More...
 
struct  bt_l2cap_chan_ops
 L2CAP Channel operations structure. More...
 
struct  bt_l2cap_server
 L2CAP Server structure. More...
 

Macros

#define BT_L2CAP_HDR_SIZE   4
 L2CAP PDU header size, used for buffer size calculations.
 
#define BT_L2CAP_TX_MTU   (CONFIG_BT_L2CAP_TX_MTU)
 Maximum Transmission Unit (MTU) for an outgoing L2CAP PDU.
 
#define BT_L2CAP_RX_MTU   (CONFIG_BT_BUF_ACL_RX_SIZE - BT_L2CAP_HDR_SIZE)
 Maximum Transmission Unit (MTU) for an incoming L2CAP PDU.
 
#define BT_L2CAP_BUF_SIZE(mtu)   BT_BUF_ACL_SIZE(BT_L2CAP_HDR_SIZE + (mtu))
 Helper to calculate needed buffer size for L2CAP PDUs.
 
#define BT_L2CAP_SDU_HDR_SIZE   2
 L2CAP SDU header size, used for buffer size calculations.
 
#define BT_L2CAP_SDU_TX_MTU   (BT_L2CAP_TX_MTU - BT_L2CAP_SDU_HDR_SIZE)
 Maximum Transmission Unit for an unsegmented outgoing L2CAP SDU.
 
#define BT_L2CAP_SDU_RX_MTU   (BT_L2CAP_RX_MTU - BT_L2CAP_SDU_HDR_SIZE)
 Maximum Transmission Unit for an unsegmented incoming L2CAP SDU.
 
#define BT_L2CAP_SDU_BUF_SIZE(mtu)   BT_L2CAP_BUF_SIZE(BT_L2CAP_SDU_HDR_SIZE + (mtu))
 Helper to calculate needed buffer size for L2CAP SDUs.
 
#define BT_L2CAP_LE_CHAN(_ch)   CONTAINER_OF(_ch, struct bt_l2cap_le_chan, chan)
 Helper macro getting container object of type bt_l2cap_le_chan address having the same container chan member address as object in question.
 
#define BT_L2CAP_CHAN_SEND_RESERVE   (BT_L2CAP_BUF_SIZE(0))
 Headroom needed for outgoing L2CAP PDUs.
 
#define BT_L2CAP_SDU_CHAN_SEND_RESERVE   (BT_L2CAP_SDU_BUF_SIZE(0))
 Headroom needed for outgoing L2CAP SDUs.
 

Typedefs

typedef void(* bt_l2cap_chan_destroy_t) (struct bt_l2cap_chan *chan)
 Channel destroy callback.
 
typedef enum bt_l2cap_chan_state bt_l2cap_chan_state_t
 Life-span states of L2CAP CoC channel.
 
typedef enum bt_l2cap_chan_status bt_l2cap_chan_status_t
 Status of L2CAP channel.
 

Enumerations

enum  bt_l2cap_chan_state {
  BT_L2CAP_DISCONNECTED , BT_L2CAP_CONNECTING , BT_L2CAP_CONFIG , BT_L2CAP_CONNECTED ,
  BT_L2CAP_DISCONNECTING
}
 Life-span states of L2CAP CoC channel. More...
 
enum  bt_l2cap_chan_status { BT_L2CAP_STATUS_OUT , BT_L2CAP_STATUS_SHUTDOWN , BT_L2CAP_STATUS_ENCRYPT_PENDING , BT_L2CAP_NUM_STATUS }
 Status of L2CAP channel. More...
 

Functions

int bt_l2cap_server_register (struct bt_l2cap_server *server)
 Register L2CAP server.
 
int bt_l2cap_br_server_register (struct bt_l2cap_server *server)
 Register L2CAP server on BR/EDR oriented connection.
 
int bt_l2cap_ecred_chan_connect (struct bt_conn *conn, struct bt_l2cap_chan **chans, uint16_t psm)
 Connect Enhanced Credit Based L2CAP channels.
 
int bt_l2cap_ecred_chan_reconfigure (struct bt_l2cap_chan **chans, uint16_t mtu)
 Reconfigure Enhanced Credit Based L2CAP channels.
 
int bt_l2cap_chan_connect (struct bt_conn *conn, struct bt_l2cap_chan *chan, uint16_t psm)
 Connect L2CAP channel.
 
int bt_l2cap_chan_disconnect (struct bt_l2cap_chan *chan)
 Disconnect L2CAP channel.
 
int bt_l2cap_chan_send (struct bt_l2cap_chan *chan, struct net_buf *buf)
 Send data to L2CAP channel.
 
int bt_l2cap_chan_give_credits (struct bt_l2cap_chan *chan, uint16_t additional_credits)
 Give credits to the remote.
 
int bt_l2cap_chan_recv_complete (struct bt_l2cap_chan *chan, struct net_buf *buf)
 Complete receiving L2CAP channel data.
 

Detailed Description

Bluetooth L2CAP handling.