Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
l2cap.h File Reference

Bluetooth L2CAP handling. More...

#include <sys/atomic.h>
#include <bluetooth/buf.h>
#include <bluetooth/conn.h>
#include <bluetooth/hci.h>

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
 
#define BT_L2CAP_TX_MTU   (CONFIG_BT_L2CAP_TX_MTU)
 
#define BT_L2CAP_RX_MTU   (CONFIG_BT_BUF_ACL_RX_SIZE - BT_L2CAP_HDR_SIZE)
 
#define BT_L2CAP_BUF_SIZE(mtu)   BT_BUF_ACL_SIZE(BT_L2CAP_HDR_SIZE + (mtu))
 Helper to calculate needed buffer size for L2CAP PDUs. Useful for creating buffer pools. More...
 
#define BT_L2CAP_SDU_HDR_SIZE   2
 
#define BT_L2CAP_SDU_TX_MTU   (BT_L2CAP_TX_MTU - BT_L2CAP_SDU_HDR_SIZE)
 Maximum Transmission Unit for an unsegmented outgoing L2CAP SDU. More...
 
#define BT_L2CAP_SDU_RX_MTU   (BT_L2CAP_RX_MTU - BT_L2CAP_SDU_HDR_SIZE)
 Maximum Transmission Unit for an unsegmented incoming L2CAP SDU. More...
 
#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. Useful for creating buffer pools. More...
 
#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. More...
 
#define BT_L2CAP_CHAN_SEND_RESERVE   (BT_L2CAP_BUF_SIZE(0))
 Headroom needed for outgoing L2CAP PDUs. More...
 
#define BT_L2CAP_SDU_CHAN_SEND_RESERVE   (BT_L2CAP_SDU_BUF_SIZE(0))
 Headroom needed for outgoing L2CAP SDUs. More...
 

Typedefs

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

Enumerations

enum  bt_l2cap_chan_state {
  BT_L2CAP_DISCONNECTED , BT_L2CAP_CONNECT , BT_L2CAP_CONFIG , BT_L2CAP_CONNECTED ,
  BT_L2CAP_DISCONNECT
}
 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. More...
 
int bt_l2cap_br_server_register (struct bt_l2cap_server *server)
 Register L2CAP server on BR/EDR oriented connection. More...
 
int bt_l2cap_ecred_chan_connect (struct bt_conn *conn, struct bt_l2cap_chan **chans, uint16_t psm)
 Connect Enhanced Credit Based L2CAP channels. More...
 
int bt_l2cap_chan_connect (struct bt_conn *conn, struct bt_l2cap_chan *chan, uint16_t psm)
 Connect L2CAP channel. More...
 
int bt_l2cap_chan_disconnect (struct bt_l2cap_chan *chan)
 Disconnect L2CAP channel. More...
 
int bt_l2cap_chan_send (struct bt_l2cap_chan *chan, struct net_buf *buf)
 Send data to L2CAP channel. More...
 
int bt_l2cap_chan_recv_complete (struct bt_l2cap_chan *chan, struct net_buf *buf)
 Complete receiving L2CAP channel data. More...
 

Detailed Description

Bluetooth L2CAP handling.