aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-12-09 19:50:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-12-09 19:50:08 +0000
commita6052da10f4d899ee7112915ebf82f3c00a32f1a (patch)
treea99fb4ba457aa7bd4f9965b82fd4ff6907f046e7
parent098ea043d863c3b009fe10e74bb2008ddb65b2cc (diff)
parentf436bc72cc1ae9bb472750b6d27f4b95b0edb820 (diff)
downloadbt-a6052da10f4d899ee7112915ebf82f3c00a32f1a.tar.gz
Merge changes I1abcf94d,I720b8a16
* changes: Simplify security level parameter for SDP L2CAP: Remove never used API Ping and Echo
-rw-r--r--internal_include/bt_target.h5
-rw-r--r--main/shim/l2c_api.cc17
-rw-r--r--main/shim/l2c_api.h24
-rw-r--r--stack/include/l2c_api.h24
-rw-r--r--stack/l2cap/l2c_api.cc120
-rw-r--r--stack/sdp/sdp_main.cc4
6 files changed, 2 insertions, 192 deletions
diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h
index 1356d2e5f..4aca86822 100644
--- a/internal_include/bt_target.h
+++ b/internal_include/bt_target.h
@@ -773,11 +773,6 @@
#define SDP_SERVICE_NAME "Service Discovery"
#endif
-/* The security level for BTM. */
-#ifndef SDP_SECURITY_LEVEL
-#define SDP_SECURITY_LEVEL BTM_SEC_NONE
-#endif
-
/******************************************************************************
*
* RFCOMM
diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc
index ccfb8795b..f9676db58 100644
--- a/main/shim/l2c_api.cc
+++ b/main/shim/l2c_api.cc
@@ -240,23 +240,6 @@ uint8_t bluetooth::shim::L2CA_SetDesireRole(uint8_t new_role) {
}
/**
- * Ping APIs
- */
-bool bluetooth::shim::L2CA_Ping(const RawAddress& p_bd_addr,
- tL2CA_ECHO_RSP_CB* p_callback) {
- LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s addr:%s p_callback:%p", __func__,
- p_bd_addr.ToString().c_str(), p_callback);
- return false;
-}
-
-bool bluetooth::shim::L2CA_Echo(const RawAddress& p_bd_addr, BT_HDR* p_data,
- tL2CA_ECHO_DATA_CB* p_callback) {
- LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s addr:%s p_callback:%p", __func__,
- p_bd_addr.ToString().c_str(), p_callback);
- return false;
-}
-
-/**
* Link APIs
*/
bool bluetooth::shim::L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr,
diff --git a/main/shim/l2c_api.h b/main/shim/l2c_api.h
index 83f3afa26..011a77bb6 100644
--- a/main/shim/l2c_api.h
+++ b/main/shim/l2c_api.h
@@ -287,30 +287,6 @@ bool L2CA_DisconnectRsp(uint16_t cid);
******************************************************************************/
uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data);
-/*******************************************************************************
- *
- * Function L2CA_Ping
- *
- * Description Higher layers call this function to send an echo request.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-bool L2CA_Ping(const RawAddress& p_bd_addr, tL2CA_ECHO_RSP_CB* p_cb);
-
-/*******************************************************************************
- *
- * Function L2CA_Echo
- *
- * Description Higher layers call this function to send an echo request
- * with application-specific data.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-bool L2CA_Echo(const RawAddress& p_bd_addr, BT_HDR* p_data,
- tL2CA_ECHO_DATA_CB* p_callback);
-
// Given a local channel identifier, |lcid|, this function returns the bound
// remote channel identifier, |rcid|, and the ACL link handle, |handle|. If
// |lcid| is not known or is invalid, this function returns false and does not
diff --git a/stack/include/l2c_api.h b/stack/include/l2c_api.h
index 8f364e7cf..1605c8864 100644
--- a/stack/include/l2c_api.h
+++ b/stack/include/l2c_api.h
@@ -611,30 +611,6 @@ extern bool L2CA_DisconnectRsp(uint16_t cid);
******************************************************************************/
extern uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data);
-/*******************************************************************************
- *
- * Function L2CA_Ping
- *
- * Description Higher layers call this function to send an echo request.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-extern bool L2CA_Ping(const RawAddress& p_bd_addr, tL2CA_ECHO_RSP_CB* p_cb);
-
-/*******************************************************************************
- *
- * Function L2CA_Echo
- *
- * Description Higher layers call this function to send an echo request
- * with application-specific data.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-extern bool L2CA_Echo(const RawAddress& p_bd_addr, BT_HDR* p_data,
- tL2CA_ECHO_DATA_CB* p_callback);
-
// Given a local channel identifier, |lcid|, this function returns the bound
// remote channel identifier, |rcid|, and the ACL link handle, |handle|. If
// |lcid| is not known or is invalid, this function returns false and does not
diff --git a/stack/l2cap/l2c_api.cc b/stack/l2cap/l2c_api.cc
index feab995e8..b8091488b 100644
--- a/stack/l2cap/l2c_api.cc
+++ b/stack/l2cap/l2c_api.cc
@@ -1033,126 +1033,6 @@ bool L2CA_DisconnectRsp(uint16_t cid) {
return (true);
}
-/*******************************************************************************
- *
- * Function L2CA_Ping
- *
- * Description Higher layers call this function to send an echo request.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-bool L2CA_Ping(const RawAddress& p_bd_addr, tL2CA_ECHO_RSP_CB* p_callback) {
- if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::L2CA_Ping(p_bd_addr, p_callback);
- }
-
- tL2C_LCB* p_lcb;
-
- VLOG(1) << __func__ << " BDA: " << p_bd_addr;
-
- /* Fail if we have not established communications with the controller */
- if (!BTM_IsDeviceUp()) return (false);
-
- /* First, see if we already have a link to the remote */
- 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 */
- p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_BR_EDR);
- if (p_lcb == NULL) {
- L2CAP_TRACE_WARNING("L2CAP - no LCB for L2CA_ping");
- return (false);
- }
- if (!l2cu_create_conn_br_edr(p_lcb)) {
- return (false);
- }
-
- p_lcb->p_echo_rsp_cb = p_callback;
-
- return (true);
- }
-
- /* We only allow 1 ping outstanding at a time */
- if (p_lcb->p_echo_rsp_cb != NULL) {
- L2CAP_TRACE_WARNING("L2CAP - rejected second L2CA_ping");
- return (false);
- }
-
- /* Have a link control block. If link is disconnecting, tell user to retry
- * later */
- if (p_lcb->link_state == LST_DISCONNECTING) {
- L2CAP_TRACE_WARNING("L2CAP - L2CA_ping rejected - link disconnecting");
- return (false);
- }
-
- /* Save address of callback */
- p_lcb->p_echo_rsp_cb = p_callback;
-
- if (p_lcb->link_state == LST_CONNECTED) {
- l2cu_adj_id(p_lcb, L2CAP_ADJ_BRCM_ID); /* Make sure not using Broadcom ID */
- l2cu_send_peer_echo_req(p_lcb, NULL, 0);
- alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_ECHO_RSP_TIMEOUT_MS,
- l2c_lcb_timer_timeout, p_lcb);
- }
-
- return (true);
-}
-
-/*******************************************************************************
- *
- * Function L2CA_Echo
- *
- * Description Higher layers call this function to send an echo request
- * with application-specific data.
- *
- * Returns true if echo request sent, else false.
- *
- ******************************************************************************/
-bool L2CA_Echo(const RawAddress& p_bd_addr, BT_HDR* p_data,
- tL2CA_ECHO_DATA_CB* p_callback) {
- if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::L2CA_Echo(p_bd_addr, p_data, p_callback);
- }
-
- tL2C_LCB* p_lcb;
- uint8_t* pp;
-
- VLOG(1) << __func__ << " BDA: " << p_bd_addr;
- ;
-
- /* Fail if we have not established communications with the controller */
- if (!BTM_IsDeviceUp()) return (false);
-
- if (RawAddress::kAny == p_bd_addr && (p_data == NULL)) {
- /* Only register callback without sending message. */
- l2cb.p_echo_data_cb = p_callback;
- return true;
- }
-
- /* We assume the upper layer will call this function only when the link is
- * established. */
- p_lcb = l2cu_find_lcb_by_bd_addr(p_bd_addr, BT_TRANSPORT_BR_EDR);
- if (p_lcb == NULL) {
- L2CAP_TRACE_ERROR("L2CA_Echo ERROR : link not established");
- return false;
- }
-
- if (p_lcb->link_state != LST_CONNECTED) {
- L2CAP_TRACE_ERROR("L2CA_Echo ERROR : link is not connected");
- return false;
- }
-
- /* Save address of callback */
- l2cb.p_echo_data_cb = p_callback;
-
- /* Set the pointer to the beginning of the data */
- pp = (uint8_t*)(p_data + 1) + p_data->offset;
- l2cu_adj_id(p_lcb, L2CAP_ADJ_BRCM_ID); /* Make sure not using Broadcom ID */
- l2cu_send_peer_echo_req(p_lcb, pp, p_data->len);
-
- return (true);
-}
-
bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t* rcid, uint16_t* handle) {
if (bluetooth::shim::is_gd_shim_enabled()) {
return bluetooth::shim::L2CA_GetIdentifiers(lcid, rcid, handle);
diff --git a/stack/sdp/sdp_main.cc b/stack/sdp/sdp_main.cc
index 2211c39e2..1198ecb53 100644
--- a/stack/sdp/sdp_main.cc
+++ b/stack/sdp/sdp_main.cc
@@ -89,7 +89,7 @@ void sdp_init(void) {
#if (SDP_SERVER_ENABLED == TRUE)
/* Register with Security Manager for the specific security level */
if (!BTM_SetSecurityLevel(false, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
- SDP_SECURITY_LEVEL, SDP_PSM, 0, 0)) {
+ BTM_SEC_NONE, SDP_PSM, 0, 0)) {
SDP_TRACE_ERROR("Security Registration Server failed");
return;
}
@@ -97,7 +97,7 @@ void sdp_init(void) {
/* Register with Security Manager for the specific security level */
if (!BTM_SetSecurityLevel(true, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
- SDP_SECURITY_LEVEL, SDP_PSM, 0, 0)) {
+ BTM_SEC_NONE, SDP_PSM, 0, 0)) {
SDP_TRACE_ERROR("Security Registration for Client failed");
return;
}