Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f771f5b6 authored by Chris Manton's avatar Chris Manton
Browse files

Stat-ify stack::btm::btm_sec_find_dev_by_sec_state

Bug: 224999611
Test: net_test_stack_btm

Change-Id: Ic999ad7af59d4d5c65fa52b064c3c71fa6afc885
parent 0cbefc9f
Loading
Loading
Loading
Loading
+17 −18
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ static tBTM_STATUS btm_sec_send_hci_disconnect(tBTM_SEC_DEV_REC* p_dev_rec,
                                               tHCI_STATUS reason,
                                               uint16_t conn_handle,
                                               std::string comment);
tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state);

static bool btm_dev_authenticated(tBTM_SEC_DEV_REC* p_dev_rec);
static bool btm_dev_encrypted(tBTM_SEC_DEV_REC* p_dev_rec);
@@ -230,6 +229,23 @@ static bool btm_dev_16_digit_authenticated(tBTM_SEC_DEV_REC* p_dev_rec) {
  return (false);
}

/*******************************************************************************
 *
 * Function         btm_sec_find_dev_by_sec_state
 *
 * Description      Look for the record in the device database for the device
 *                  which is being authenticated or encrypted
 *
 * Returns          Pointer to the record or NULL
 *
 ******************************************************************************/
static tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) {
  list_node_t* n = list_foreach(btm_cb.sec_dev_rec, is_sec_state_equal, &state);
  if (n) return static_cast<tBTM_SEC_DEV_REC*>(list_node(n));

  return nullptr;
}

/*******************************************************************************
 *
 * Function         BTM_SecRegister
@@ -4681,23 +4697,6 @@ bool is_sec_state_equal(void* data, void* context) {
  return true;
}

/*******************************************************************************
 *
 * Function         btm_sec_find_dev_by_sec_state
 *
 * Description      Look for the record in the device database for the device
 *                  which is being authenticated or encrypted
 *
 * Returns          Pointer to the record or NULL
 *
 ******************************************************************************/
tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) {
  list_node_t* n = list_foreach(btm_cb.sec_dev_rec, is_sec_state_equal, &state);
  if (n) return static_cast<tBTM_SEC_DEV_REC*>(list_node(n));

  return NULL;
}

/*******************************************************************************
 *
 * Function         btm_sec_change_pairing_state
+0 −14
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@
 ******************************************************************************/
tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm);

tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state);

/*******************************************************************************
 *
 * Function         BTM_SecRegister
@@ -713,18 +711,6 @@ tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm);

bool is_sec_state_equal(void* data, void* context);

/*******************************************************************************
 *
 * Function         btm_sec_find_dev_by_sec_state
 *
 * Description      Look for the record in the device database for the device
 *                  which is being authenticated or encrypted
 *
 * Returns          Pointer to the record or NULL
 *
 ******************************************************************************/
tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state);

/*******************************************************************************
 *
 * Function         btm_sec_dev_rec_cback_event
+0 −4
Original line number Diff line number Diff line
@@ -132,10 +132,6 @@ tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr) {
  inc_func_call_count(__func__);
  return 0;
}
tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) {
  inc_func_call_count(__func__);
  return nullptr;
}
tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm) {
  inc_func_call_count(__func__);
  return nullptr;