/* register PSM with L2CAP */
L2CA_Register2(AVCT_PSM, avct_l2c_appl, true /* enable_snoop */, nullptr,
- kAvrcMtu, BTA_SEC_AUTHENTICATE);
+ kAvrcMtu, 0, BTA_SEC_AUTHENTICATE);
/* Include the browsing channel which uses eFCR */
tL2CAP_ERTM_INFO ertm_info;
ertm_info.fcr_tx_buf_size = BT_DEFAULT_BUFFER_SIZE;
L2CA_Register2(AVCT_BR_PSM, avct_l2c_br_appl, true /*enable_snoop*/,
- &ertm_info, kAvrcBrMtu, BTA_SEC_AUTHENTICATE);
+ &ertm_info, kAvrcBrMtu, AVCT_MIN_BROWSE_MTU,
+ BTA_SEC_AUTHENTICATE);
#if defined(AVCT_INITIAL_TRACE_LEVEL)
avct_cb.trace_level = AVCT_INITIAL_TRACE_LEVEL;
void AVDT_Register(AvdtpRcb* p_reg, tAVDT_CTRL_CBACK* p_cback) {
/* register PSM with L2CAP */
L2CA_Register2(AVDT_PSM, avdt_l2c_appl, true /* enable_snoop */, nullptr,
- kAvdtpMtu, BTA_SEC_AUTHENTICATE);
+ kAvdtpMtu, 0, BTA_SEC_AUTHENTICATE);
/* initialize AVDTP data structures */
avdt_scb_init();
/* Now, register with L2CAP */
if (!L2CA_Register2(BT_PSM_BNEP, bnep_cb.reg_info, false /* enable_snoop */,
- nullptr, BNEP_MTU_SIZE,
+ nullptr, BNEP_MTU_SIZE, BNEP_MTU_SIZE,
BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
BNEP_TRACE_ERROR("BNEP - Registration failed");
return BNEP_SECURITY_FAIL;
if (transport == BT_TRANSPORT_BR_EDR) {
p_ccb->psm =
L2CA_Register2(psm, conn.reg_info, false /* enable_snoop */,
- &p_ccb->ertm_info, L2CAP_SDU_LENGTH_MAX, security);
+ &p_ccb->ertm_info, L2CAP_SDU_LENGTH_MAX, 0, security);
if (p_ccb->psm == 0) {
LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__,
psm);
/* Now, register with L2CAP for ATT PSM over BR/EDR */
if (!L2CA_Register2(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr,
- GATT_MAX_MTU_SIZE, BTM_SEC_NONE)) {
+ GATT_MAX_MTU_SIZE, 0, BTM_SEC_NONE)) {
LOG(ERROR) << "ATT Dynamic Registration failed";
}
hd_cb.l2cap_intr_cfg.mtu = HID_DEV_MTU_SIZE;
if (!L2CA_Register2(HID_PSM_CONTROL, dev_reg_info, false /* enable_snoop */,
- nullptr, HID_DEV_MTU_SIZE,
+ nullptr, HID_DEV_MTU_SIZE, 0,
BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
HIDD_TRACE_ERROR("HID Control (device) registration failed");
return (HID_ERR_L2CAP_FAILED);
}
if (!L2CA_Register2(HID_PSM_INTERRUPT, dev_reg_info, false /* enable_snoop */,
- nullptr, HID_DEV_MTU_SIZE,
+ nullptr, HID_DEV_MTU_SIZE, 0,
BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
L2CA_Deregister(HID_PSM_CONTROL);
HIDD_TRACE_ERROR("HID Interrupt (device) registration failed");
/* Now, register with L2CAP */
if (!L2CA_Register2(HID_PSM_INTERRUPT, hst_reg_info, false /* enable_snoop */,
- nullptr, HID_HOST_MTU,
+ nullptr, HID_HOST_MTU, 0,
BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
L2CA_Deregister(HID_PSM_CONTROL);
HIDH_TRACE_ERROR("HID-Host Interrupt Registration failed");
// Also does security for you
uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu, uint16_t sec_level);
+ uint16_t my_mtu, uint16_t required_remote_mtu,
+ uint16_t sec_level);
/*******************************************************************************
*
******************************************************************************/
extern uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu);
+ uint16_t my_mtu, uint16_t required_remote_mtu);
/*******************************************************************************
*
uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu, uint16_t sec_level) {
- auto ret =
- L2CA_Register(psm, p_cb_info, enable_snoop, p_ertm_info, required_mtu);
+ uint16_t my_mtu, uint16_t required_remote_mtu,
+ uint16_t sec_level) {
+ auto ret = L2CA_Register(psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu,
+ required_remote_mtu);
BTM_SetSecurityLevel(false, "", 0, sec_level, psm, 0, 0);
return ret;
}
******************************************************************************/
uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu) {
+ uint16_t my_mtu, uint16_t required_remote_mtu) {
if (bluetooth::shim::is_gd_shim_enabled()) {
return bluetooth::shim::L2CA_Register(psm, p_cb_info, enable_snoop,
- p_ertm_info, required_mtu);
+ p_ertm_info, my_mtu);
}
tL2C_RCB* p_rcb;
p_rcb->api = p_cb_info;
p_rcb->real_psm = psm;
p_rcb->ertm_info = p_ertm_info == nullptr ? tL2CAP_ERTM_INFO{} : *p_ertm_info;
- p_rcb->required_mtu = std::max<uint16_t>(required_mtu, L2CAP_DEFAULT_MTU);
+ p_rcb->my_mtu = my_mtu;
+ p_rcb->required_remote_mtu =
+ std::max<uint16_t>(required_remote_mtu, L2CAP_MIN_MTU);
return (vpsm);
}
/* this is the real PSM that we need to connect to */
tL2CAP_APPL_INFO api;
tL2CAP_ERTM_INFO ertm_info;
- uint16_t required_mtu;
+ uint16_t my_mtu;
+ uint16_t required_remote_mtu;
} tL2C_RCB;
#define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 100
p_l2c->pL2CA_TxComplete_Cb = NULL;
L2CA_Register(BT_PSM_RFCOMM, rfc_cb.rfc.reg_info, true /* enable_snoop */,
- nullptr, L2CAP_MTU_SIZE);
+ nullptr, L2CAP_MTU_SIZE, 0);
}
/*******************************************************************************
/* Now, register with L2CAP */
if (!L2CA_Register2(SDP_PSM, sdp_cb.reg_info, true /* enable_snoop */,
- nullptr, SDP_MTU_SIZE, BTM_SEC_NONE)) {
+ nullptr, SDP_MTU_SIZE, 0, BTM_SEC_NONE)) {
SDP_TRACE_ERROR("SDP Registration failed");
}
}
uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu) {
+ uint16_t my_mtu, uint16_t required_remote_mtu) {
VLOG(1) << __func__ << ": psm=" << psm << ", enable_snoop=" << enable_snoop;
return l2cap_interface->Register(psm, p_cb_info, enable_snoop, p_ertm_info);
}