From 3dbda905a56f88ea79350deac96e123ce500cd22 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 28 Sep 2020 13:00:18 -0700 Subject: [PATCH] L2CAP: Remove unused ConnectRsp Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: Ifa6fc5470aeda670eb51482ed91a2b7ab665a813 --- main/shim/l2c_api.cc | 6 ----- main/shim/l2c_api.h | 14 ----------- main/shim/l2cap.cc | 11 --------- main/shim/l2cap.h | 4 ---- stack/include/l2c_api.h | 14 ----------- stack/l2cap/l2c_api.cc | 64 ------------------------------------------------- 6 files changed, 113 deletions(-) diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc index 7cbc75198..171996029 100644 --- a/main/shim/l2c_api.cc +++ b/main/shim/l2c_api.cc @@ -103,12 +103,6 @@ uint16_t bluetooth::shim::L2CA_ConnectReq(uint16_t psm, return shim_l2cap.CreateConnection(psm, raw_address); } -bool bluetooth::shim::L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, - uint16_t lcid, uint16_t result, - uint16_t status) { - return shim_l2cap.ConnectResponse(p_bd_addr, id, lcid, result, status); -} - bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) { return shim_l2cap.DisconnectRequest(cid); } diff --git a/main/shim/l2c_api.h b/main/shim/l2c_api.h index 2432166be..d26119130 100644 --- a/main/shim/l2c_api.h +++ b/main/shim/l2c_api.h @@ -106,20 +106,6 @@ uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr); /******************************************************************************* * - * Function L2CA_ConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, - uint16_t result, uint16_t status); - -/******************************************************************************* - * * Function L2CA_RegisterLECoc * * Description Other layers call this function to register for L2CAP diff --git a/main/shim/l2cap.cc b/main/shim/l2cap.cc index e7a1775c0..8b4eb4228 100644 --- a/main/shim/l2cap.cc +++ b/main/shim/l2cap.cc @@ -357,17 +357,6 @@ void bluetooth::shim::legacy::L2cap::SetDownstreamCallbacks(uint16_t cid) { }); } -bool bluetooth::shim::legacy::L2cap::ConnectResponse( - const RawAddress& raw_address, uint8_t signal_id, uint16_t cid, - uint16_t result, uint16_t status) { - CHECK(ConnectionExists(cid)); - LOG_DEBUG( - "%s Silently dropping client connect response as channel is " - "already connected", - __func__); - return true; -} - bool bluetooth::shim::legacy::L2cap::DisconnectRequest(uint16_t cid) { CHECK(ConnectionExists(cid)); if (cid_closing_set_.find(cid) != cid_closing_set_.end()) { diff --git a/main/shim/l2cap.h b/main/shim/l2cap.h index 4821f999c..581c35f96 100644 --- a/main/shim/l2cap.h +++ b/main/shim/l2cap.h @@ -82,10 +82,6 @@ class L2cap { uint16_t ConvertClientToRealPsm(uint16_t psm); void RemoveClientPsm(uint16_t client_psm); - // Legacy API entry points - bool ConnectResponse(const RawAddress& raw_address, uint8_t signal_id, - uint16_t cid, uint16_t result, uint16_t status); - bool DisconnectRequest(uint16_t cid); bool GetRemoteCid(uint16_t cid, uint16_t* remote_cid); diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h index be0d41713..98c0524c8 100644 --- a/stack/include/l2c_api.h +++ b/stack/include/l2c_api.h @@ -366,20 +366,6 @@ extern uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr); /******************************************************************************* * - * Function L2CA_ConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -extern bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, - uint16_t lcid, uint16_t result, uint16_t status); - -/******************************************************************************* - * * Function L2CA_RegisterLECoc * * Description Other layers call this function to register for L2CAP diff --git a/stack/l2cap/l2c_api.cc b/stack/l2cap/l2c_api.cc index 762d49bf6..0087a8c34 100644 --- a/stack/l2cap/l2c_api.cc +++ b/stack/l2cap/l2c_api.cc @@ -703,70 +703,6 @@ bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) { /******************************************************************************* * - * Function L2CA_ConnectRsp - * - * Description Higher layers call this function to accept an incoming - * L2CAP connection, for which they had gotten an connect - * indication callback. - * - * Returns true for success, false for failure - * - ******************************************************************************/ -bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid, - uint16_t result, uint16_t status) { - if (bluetooth::shim::is_gd_shim_enabled()) { - return bluetooth::shim::L2CA_ConnectRsp(p_bd_addr, id, lcid, result, - status); - } - - tL2C_LCB* p_lcb; - tL2C_CCB* p_ccb; - - VLOG(1) << __func__ << " BDA: " << p_bd_addr - << StringPrintf(" CID:0x%04x Result:%d Status:%d", lcid, result, - status); - - /* First, find the link control block */ - p_lcb = l2cu_find_lcb_by_bd_addr(p_bd_addr, BT_TRANSPORT_BR_EDR); - if (p_lcb == NULL) { - /* No link. Get an LCB and start link establishment */ - L2CAP_TRACE_WARNING("L2CAP - no LCB for L2CA_conn_rsp"); - return (false); - } - - /* Now, find the channel control block */ - p_ccb = l2cu_find_ccb_by_cid(p_lcb, lcid); - if (p_ccb == NULL) { - L2CAP_TRACE_WARNING("L2CAP - no CCB for L2CA_conn_rsp"); - return (false); - } - - /* The IDs must match */ - if (p_ccb->remote_id != id) { - L2CAP_TRACE_WARNING("L2CAP - bad id in L2CA_conn_rsp. Exp: %d Got: %d", - p_ccb->remote_id, id); - return (false); - } - - if (result == L2CAP_CONN_OK) { - l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP, NULL); - } else { - tL2C_CONN_INFO conn_info; - - conn_info.l2cap_result = result; - conn_info.l2cap_status = status; - - if (result == L2CAP_CONN_PENDING) - l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP, &conn_info); - else - l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP_NEG, &conn_info); - } - - return (true); -} - -/******************************************************************************* - * * Function L2CA_DisconnectReq * * Description Higher layers call this function to disconnect a channel. -- 2.11.0