Update bt fork to be based on v5.3
This commit is contained in:
@@ -2931,4 +2931,31 @@ uint8_t btm_ble_scan_active_count(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
uint8_t btm_ble_sec_dev_active_count(void)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
|
||||
list_node_t *p_node = NULL;
|
||||
uint8_t count = 0;
|
||||
|
||||
/* First look for the non-paired devices for the oldest entry */
|
||||
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
|
||||
p_dev_rec = list_node(p_node);
|
||||
if (p_dev_rec && (p_dev_rec->sec_flags & BTM_SEC_IN_USE) && (p_dev_rec->ble.key_type != BTM_LE_KEY_NONE)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (BLE_PRIVACY_SPT == TRUE)
|
||||
uint8_t btm_ble_privacy_is_enabled(void)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
return (p_cb->privacy_mode != BTM_PRIVACY_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
@@ -27,6 +27,7 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
|
||||
typedef struct {
|
||||
uint16_t ter_con_handle;
|
||||
bool invalid;
|
||||
bool enabled;
|
||||
UINT8 instance;
|
||||
int duration;
|
||||
int max_events;
|
||||
@@ -331,7 +332,7 @@ tBTM_STATUS BTM_BleSetExtendedAdvRandaddr(UINT8 instance, BD_ADDR rand_addr)
|
||||
__func__, btm_ble_hci_status_to_str(err), err);
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
} else {
|
||||
// set random address success, update address infor
|
||||
// set random address success, update address info
|
||||
if(extend_adv_cb.inst[instance].configured && extend_adv_cb.inst[instance].connetable) {
|
||||
BTM_BleSetStaticAddr(rand_addr);
|
||||
BTM_UpdateAddrInfor(BLE_ADDR_RANDOM, rand_addr);
|
||||
@@ -415,7 +416,7 @@ end:
|
||||
BTM_TRACE_ERROR("LE EA SetParams: cmd err=0x%x", err);
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
} else {
|
||||
// set addr success, update address infor
|
||||
// set addr success, update address info
|
||||
BTM_UpdateAddrInfor(BLE_ADDR_RANDOM, rand_addr);
|
||||
}
|
||||
}
|
||||
@@ -540,6 +541,7 @@ end:
|
||||
for (uint8_t i = 0; i < MAX_BLE_ADV_INSTANCE; i++)
|
||||
{
|
||||
adv_record[i].invalid = false;
|
||||
adv_record[i].enabled = false;
|
||||
adv_record[i].instance = INVALID_VALUE;
|
||||
adv_record[i].duration = INVALID_VALUE;
|
||||
adv_record[i].max_events = INVALID_VALUE;
|
||||
@@ -550,6 +552,7 @@ end:
|
||||
{
|
||||
uint8_t index = ext_adv[i].instance;
|
||||
adv_record[index].invalid = false;
|
||||
adv_record[index].enabled = false;
|
||||
adv_record[index].instance = INVALID_VALUE;
|
||||
adv_record[index].duration = INVALID_VALUE;
|
||||
adv_record[index].max_events = INVALID_VALUE;
|
||||
@@ -563,6 +566,7 @@ end:
|
||||
{
|
||||
uint8_t index = ext_adv[i].instance;
|
||||
adv_record[index].invalid = true;
|
||||
adv_record[index].enabled = true;
|
||||
adv_record[index].instance = ext_adv[i].instance;
|
||||
adv_record[index].duration = ext_adv[i].duration;
|
||||
adv_record[index].max_events = ext_adv[i].max_events;
|
||||
@@ -588,12 +592,12 @@ tBTM_STATUS BTM_BleStartExtAdvRestart(uint8_t con_handle)
|
||||
}
|
||||
}
|
||||
|
||||
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid) || (adv_record[index].retry_count > GATTC_CONNECT_RETRY_COUNT)) {
|
||||
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid)) {
|
||||
return BTM_WRONG_MODE;
|
||||
}
|
||||
|
||||
adv_record[index].retry_count ++;
|
||||
BTM_TRACE_DEBUG("remote device did not reveive aux connect response, retatrt the extend adv to reconnect, adv handle %d con_handle %d\n", index, con_handle);
|
||||
BTM_TRACE_DEBUG("remote device did not receive aux connect response, retatrt the extend adv to reconnect, adv handle %d con_handle %d\n", index, con_handle);
|
||||
ext_adv.instance = adv_record[index].instance;
|
||||
ext_adv.duration = adv_record[index].duration;
|
||||
ext_adv.max_events = adv_record[index].max_events;
|
||||
@@ -794,8 +798,13 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params)
|
||||
|| (params->reports_disabled > 0x01)
|
||||
|| (params->filter_duplicates > 0x01)
|
||||
#endif
|
||||
|| (params->addr_type > 0x01) ||
|
||||
(params->sid > 0xf) || (params->skip > 0x01F3)) {
|
||||
/*If the Periodic Advertiser List is not used,
|
||||
the Advertising_SID, Advertiser Address_Type, and Advertiser Address
|
||||
parameters specify the periodic advertising device to listen to; otherwise they
|
||||
shall be ignored.*/
|
||||
|| (params->filter_policy == 0 && params->addr_type > 0x01)
|
||||
|| (params->filter_policy == 0 && params->sid > 0xf)
|
||||
|| (params->skip > 0x01F3)) {
|
||||
status = BTM_ILLEGAL_VALUE;
|
||||
BTM_TRACE_ERROR("%s, The sync parameters is invalid.", __func__);
|
||||
goto end;
|
||||
@@ -1196,6 +1205,7 @@ void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
|
||||
adv_record[params->adv_handle].ter_con_handle = INVALID_VALUE;
|
||||
adv_record[params->adv_handle].invalid = false;
|
||||
}
|
||||
adv_record[params->adv_handle].enabled = false;
|
||||
|
||||
memcpy(&cb_params.adv_term, params, sizeof(tBTM_BLE_ADV_TERMINAT));
|
||||
|
||||
@@ -1311,6 +1321,19 @@ void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *par
|
||||
|
||||
}
|
||||
|
||||
uint8_t btm_ble_ext_adv_active_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
|
||||
for (uint8_t i = 0; i < MAX_BLE_ADV_INSTANCE; i++) {
|
||||
if (adv_record[i].enabled == true) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
@@ -70,7 +70,7 @@ static tBTM_BLE_VSC_CB *cmn_ble_gap_vsc_cb_ptr;
|
||||
static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
|
||||
#endif
|
||||
|
||||
tBTM_CallbackFunc conn_param_update_cb;
|
||||
tBTM_CallbackFunc conn_callback_func;
|
||||
/*******************************************************************************
|
||||
** Local functions
|
||||
*******************************************************************************/
|
||||
@@ -309,7 +309,21 @@ void btm_ble_sem_free(void)
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb)
|
||||
{
|
||||
conn_param_update_cb.update_conn_param_cb = update_conn_param_cb;
|
||||
conn_callback_func.update_conn_param_cb = update_conn_param_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleRegiseterPktLengthChangeCallback
|
||||
**
|
||||
** Description Registers a callback function for packet length changes.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb)
|
||||
{
|
||||
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -1333,7 +1347,7 @@ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode)
|
||||
**
|
||||
** Function btm_set_conn_mode_adv_init_addr
|
||||
**
|
||||
** Description set initator address type and local address type based on adv
|
||||
** Description set initiator address type and local address type based on adv
|
||||
** mode.
|
||||
**
|
||||
**
|
||||
@@ -2001,7 +2015,7 @@ tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
|
||||
}
|
||||
|
||||
if (btm_cb.ble_ctr_cb.inq_var.state != BTM_BLE_IDLE) {
|
||||
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||
BTM_TRACE_ERROR("Advertising or scanning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||
return BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||
}
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, rand_addr, BD_ADDR_LEN);
|
||||
@@ -2030,7 +2044,7 @@ void BTM_BleClearRandAddress(void)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
if (btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_RANDOM && (p_cb->inq_var.state != BTM_BLE_IDLE)) {
|
||||
BTM_TRACE_ERROR("Advertising or scaning now, can't restore public address ");
|
||||
BTM_TRACE_ERROR("Advertising or scanning now, can't restore public address ");
|
||||
return;
|
||||
}
|
||||
memset(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, 0, BD_ADDR_LEN);
|
||||
@@ -2236,16 +2250,16 @@ UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
|
||||
/* device name */
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
if (len > MIN_ADV_LENGTH && data_mask & BTM_BLE_AD_BIT_DEV_NAME) {
|
||||
if (strlen(btm_cb.cfg.bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
|
||||
if (strlen(btm_cb.cfg.ble_bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
|
||||
cp_len = (UINT16)(len - MIN_ADV_LENGTH);
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_NAME_SHORT;
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
|
||||
} else {
|
||||
cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
|
||||
cp_len = (UINT16)strlen(btm_cb.cfg.ble_bd_name);
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_NAME_CMPL;
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
|
||||
}
|
||||
len -= (cp_len + MIN_ADV_LENGTH);
|
||||
data_mask &= ~BTM_BLE_AD_BIT_DEV_NAME;
|
||||
@@ -3291,6 +3305,7 @@ static void btm_ble_appearance_to_cod(UINT16 appearance, UINT8 *dev_class)
|
||||
case BTM_BLE_APPEARANCE_CYCLING_CADENCE:
|
||||
case BTM_BLE_APPEARANCE_CYCLING_POWER:
|
||||
case BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE:
|
||||
case BTM_BLE_APPEARANCE_STANDALONE_SPEAKER:
|
||||
case BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS:
|
||||
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION:
|
||||
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:
|
||||
@@ -3728,7 +3743,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
|
||||
/* never been report as an LE device */
|
||||
if (p_i &&
|
||||
(!(p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BLE) ||
|
||||
/* scan repsonse to be updated */
|
||||
/* scan response to be updated */
|
||||
(!p_i->scan_rsp))) {
|
||||
update = TRUE;
|
||||
} else if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
|
||||
@@ -4002,7 +4017,7 @@ static void btm_ble_stop_discover(void)
|
||||
**
|
||||
** Description Set or clear adv states in topology mask
|
||||
**
|
||||
** Returns operation status. TRUE if sucessful, FALSE otherwise.
|
||||
** Returns operation status. TRUE if successful, FALSE otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
typedef BOOLEAN (BTM_TOPOLOGY_FUNC_PTR)(tBTM_BLE_STATE_MASK);
|
||||
@@ -4263,7 +4278,7 @@ void btm_ble_timeout(TIMER_LIST_ENT *p_tle)
|
||||
break;
|
||||
|
||||
case BTU_TTYPE_BLE_GAP_LIM_DISC:
|
||||
/* lim_timeout expiried, limited discovery should exit now */
|
||||
/* lim_timeout expired, limited discovery should exit now */
|
||||
btm_cb.btm_inq_vars.discoverable_mode &= ~BTM_BLE_LIMITED_DISCOVERABLE;
|
||||
btm_ble_set_adv_flag(btm_cb.btm_inq_vars.connectable_mode, btm_cb.btm_inq_vars.discoverable_mode);
|
||||
break;
|
||||
@@ -4364,7 +4379,7 @@ void btm_ble_read_remote_features_complete(UINT8 *p)
|
||||
*******************************************************************************/
|
||||
void btm_ble_write_adv_enable_complete(UINT8 *p)
|
||||
{
|
||||
/* if write adv enable/disbale not succeed */
|
||||
/* if write adv enable/disable not succeed */
|
||||
if (*p != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("%s failed", __func__);
|
||||
}
|
||||
@@ -4702,6 +4717,40 @@ BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
p_cb->inq_var.p_clear_adv_cb = p_clear_adv_cback;
|
||||
return TRUE;
|
||||
}
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout,tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback)
|
||||
{
|
||||
if ((btsnd_hcic_ble_set_rand_priv_addr_timeout(rpa_timeout)) != TRUE) {
|
||||
BTM_TRACE_ERROR("Set RPA Timeout error, rpa_timeout:0x%04x",rpa_timeout);
|
||||
return FALSE;
|
||||
}
|
||||
btm_cb.devcb.p_ble_set_rpa_timeout_cmpl_cb = p_set_rpa_timeout_cback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
uint8_t irk[],
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback)
|
||||
{
|
||||
UINT8 *local_irk = btm_cb.devcb.id_keys.irk;
|
||||
if ((btsnd_hcic_ble_add_device_resolving_list(addr_type, addr, irk, local_irk)) != TRUE) {
|
||||
BTM_TRACE_ERROR("Add device to resolving list error");
|
||||
return FALSE;
|
||||
}
|
||||
btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb = p_add_dev_to_resolving_list_callback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type, BD_ADDR bd_addr, UINT8 privacy_mode, tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_callback)
|
||||
{
|
||||
if (btsnd_hcic_ble_set_privacy_mode(addr_type, bd_addr, privacy_mode) != TRUE) {
|
||||
BTM_TRACE_ERROR("LE SetPrivacyMode Mode=%d: error", privacy_mode);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
btm_cb.devcb.p_set_privacy_mode_cmpl_cb = p_callback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool btm_ble_adv_pkt_ready(void)
|
||||
{
|
||||
|
||||
@@ -824,6 +824,13 @@ void btm_ble_multi_adv_init(void)
|
||||
*******************************************************************************/
|
||||
void btm_ble_multi_adv_cleanup(void)
|
||||
{
|
||||
#if BTM_DYNAMIC_MEMORY == TRUE
|
||||
if (btm_multi_adv_cb_ptr == NULL)
|
||||
{
|
||||
BTM_TRACE_WARNING("%s memory has been freed", __func__);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (btm_multi_adv_cb.p_adv_inst) {
|
||||
osi_free(btm_multi_adv_cb.p_adv_inst);
|
||||
btm_multi_adv_cb.p_adv_inst = NULL;
|
||||
|
||||
@@ -275,6 +275,14 @@ void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
STREAM_TO_UINT8(status, p);
|
||||
if (btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb) {
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_cb = btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb;
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_DEBUG("no resolving list callback");
|
||||
}
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
||||
|
||||
@@ -416,6 +424,64 @@ void btm_ble_set_addr_resolution_enable_complete(UINT8 *p, UINT16 evt_len)
|
||||
random_cb->set_local_privacy_cback(BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_rpa_timeout_complete
|
||||
**
|
||||
** Description This function is called when the LE Set Resolvable Private
|
||||
** Address Timeout command completes.
|
||||
**
|
||||
** Parameters p: Pointer to the command complete event data.
|
||||
** evt_len: Length of the event data.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_set_rpa_timeout_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
|
||||
// Extract the status of the command completion from the event data
|
||||
STREAM_TO_UINT8(status, p);
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
||||
|
||||
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_cb = btm_cb.devcb.p_ble_set_rpa_timeout_cmpl_cb;
|
||||
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_privacy_mode_complete
|
||||
**
|
||||
** Description This function is called when the LE Set Privacy Mode command completes.
|
||||
**
|
||||
** Parameters p: Pointer to the command complete event data.
|
||||
** evt_len: Length of the event data.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_set_privacy_mode_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
|
||||
// Extract the status of the command completion from the event data
|
||||
STREAM_TO_UINT8(status, p);
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = 0x%x", __func__, status);
|
||||
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_cb = btm_cb.devcb.p_set_privacy_mode_cmpl_cb;
|
||||
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
VSC that implement controller based privacy
|
||||
********************************************************************************/
|
||||
@@ -459,7 +525,7 @@ void btm_ble_resolving_list_vsc_op_cmpl (tBTM_VSC_CMPL *p_params)
|
||||
** Description This function to remove an IRK entry from the list
|
||||
**
|
||||
** Parameters ble_addr_type: address type
|
||||
** ble_addr: LE adddress
|
||||
** ble_addr: LE address
|
||||
**
|
||||
** Returns status
|
||||
**
|
||||
@@ -949,7 +1015,7 @@ void btm_ble_enable_resolving_list(UINT8 rl_mask)
|
||||
**
|
||||
** Function btm_ble_resolving_list_empty
|
||||
**
|
||||
** Description check to see if resoving list is empty or not
|
||||
** Description check to see if resolving list is empty or not
|
||||
**
|
||||
** Returns TRUE: empty; FALSE non-empty
|
||||
**
|
||||
@@ -1074,7 +1140,7 @@ void btm_ble_add_default_entry_to_resolving_list(void)
|
||||
/*
|
||||
* Add local IRK entry with 00:00:00:00:00:00 address. This entry will
|
||||
* be used to generate RPA for non-directed advertising if own_addr_type
|
||||
* is set to rpa_pub since we use all-zero address as peer addres in
|
||||
* is set to rpa_pub since we use all-zero address as peer address in
|
||||
* such case. Peer IRK should be left all-zero since this is not for an
|
||||
* actual peer.
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,8 @@ void btm_dev_init (void)
|
||||
|
||||
/* Initialize nonzero defaults */
|
||||
#if (BTM_MAX_LOC_BD_NAME_LEN > 0)
|
||||
memset(btm_cb.cfg.bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
#endif
|
||||
|
||||
btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET;
|
||||
@@ -449,11 +450,11 @@ static void btm_decode_ext_features_page (UINT8 page_number, const BD_FEATURES p
|
||||
** Returns status of the operation
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
{
|
||||
UINT8 *p;
|
||||
|
||||
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN)) {
|
||||
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN) || (name_type > BT_DEVICE_TYPE_DUMO)) {
|
||||
return (BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
@@ -463,16 +464,26 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
|
||||
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
/* Save the device name if local storage is enabled */
|
||||
p = (UINT8 *)btm_cb.cfg.bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
if (name_type & BT_DEVICE_TYPE_BLE) {
|
||||
p = (UINT8 *)btm_cb.cfg.ble_bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.ble_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
p = (UINT8 *)btm_cb.cfg.bredr_bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bredr_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
}
|
||||
#else
|
||||
p = (UINT8 *)p_name;
|
||||
#endif
|
||||
#if CLASSIC_BT_INCLUDED
|
||||
if (btsnd_hcic_change_name(p)) {
|
||||
if ((name_type & BT_DEVICE_TYPE_BREDR) && btsnd_hcic_change_name(p)) {
|
||||
return (BTM_CMD_STARTED);
|
||||
} else
|
||||
#endif
|
||||
@@ -496,10 +507,33 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
|
||||
** is returned and p_name is set to NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name)
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type)
|
||||
{
|
||||
/*
|
||||
// name_type should be BT_DEVICE_TYPE_BLE or BT_DEVICE_TYPE_BREDR
|
||||
if (name_type > BT_DEVICE_TYPE_BREDR) {
|
||||
*p_name = NULL;
|
||||
BTM_TRACE_ERROR("name_type unknown %d", name_type);
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
*/
|
||||
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
*p_name = btm_cb.cfg.bd_name;
|
||||
if ((name_type == BT_DEVICE_TYPE_DUMO) &&
|
||||
(BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) {
|
||||
*p_name = NULL;
|
||||
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BLE) {
|
||||
*p_name = btm_cb.cfg.ble_bd_name;
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
*p_name = btm_cb.cfg.bredr_bd_name;
|
||||
}
|
||||
|
||||
return (BTM_SUCCESS);
|
||||
#else
|
||||
*p_name = NULL;
|
||||
@@ -740,19 +774,20 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
#endif // (BLE_INCLUDED == TRUE)
|
||||
tBTM_VSC_CMPL vcs_cplt_params;
|
||||
|
||||
/* If there was a callback address for vcs complete, call it */
|
||||
if (p_vsc_cplt_cback) {
|
||||
/* Pass paramters to the callback function */
|
||||
/* Pass parameters to the callback function */
|
||||
vcs_cplt_params.opcode = opcode; /* Number of bytes in return info */
|
||||
vcs_cplt_params.param_len = evt_len; /* Number of bytes in return info */
|
||||
vcs_cplt_params.p_param_buf = p;
|
||||
(*p_vsc_cplt_cback)(&vcs_cplt_params); /* Call the VSC complete callback function */
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -876,6 +911,42 @@ tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout, tBTM_CMPL_CB *p_cb)
|
||||
return (BTM_CMD_STARTED);
|
||||
}
|
||||
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
void btm_set_min_enc_key_size_complete(const UINT8 *p)
|
||||
{
|
||||
tBTM_SET_MIN_ENC_KEY_SIZE_RESULTS results;
|
||||
tBTM_CMPL_CB *p_cb = btm_cb.devcb.p_set_min_enc_key_size_cmpl_cb;
|
||||
|
||||
STREAM_TO_UINT8(results.hci_status, p);
|
||||
|
||||
if (p_cb) {
|
||||
btm_cb.devcb.p_set_min_enc_key_size_cmpl_cb = NULL;
|
||||
(*p_cb)(&results);
|
||||
}
|
||||
}
|
||||
|
||||
tBTM_STATUS BTM_SetMinEncKeySize(UINT8 key_size, tBTM_CMPL_CB *p_cb)
|
||||
{
|
||||
BTM_TRACE_EVENT ("BTM: BTM_SetMinEncKeySize: key_size: %d.", key_size);
|
||||
|
||||
btm_cb.devcb.p_set_min_enc_key_size_cmpl_cb = p_cb;
|
||||
tBTM_STATUS status = BTM_NO_RESOURCES;
|
||||
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE == ENC_KEY_SIZE_CTRL_MODE_VSC)
|
||||
/* Send the HCI command */
|
||||
UINT8 param[1];
|
||||
UINT8 *p = (UINT8 *)param;
|
||||
UINT8_TO_STREAM(p, key_size);
|
||||
status = BTM_VendorSpecificCommand(HCI_VENDOR_BT_SET_MIN_ENC_KEY_SIZE, 1, param, NULL);
|
||||
#else
|
||||
if (btsnd_hcic_set_min_enc_key_size(key_size)) {
|
||||
status = BTM_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_set_page_timeout_complete
|
||||
|
||||
@@ -133,20 +133,3 @@ uint8_t btm_acl_active_count(void)
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
uint8_t btdm_sec_dev_active_count(void)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
|
||||
list_node_t *p_node = NULL;
|
||||
uint8_t count = 0;
|
||||
|
||||
/* First look for the non-paired devices for the oldest entry */
|
||||
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
|
||||
p_dev_rec = list_node(p_node);
|
||||
if (p_dev_rec && (p_dev_rec->sec_flags & BTM_SEC_IN_USE)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ void btm_sec_clr_temp_auth_service (BD_ADDR bda)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed autorization will take place */
|
||||
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed authorization will take place */
|
||||
if (p_dev_rec->last_author_service_id != BTM_SEC_NO_LAST_SERVICE_ID && p_dev_rec->p_cur_service) {
|
||||
BTM_TRACE_DEBUG ("btm_sec_clr_auth_service_by_psm [clearing device: %02x:%02x:%02x:%02x:%02x:%02x]\n",
|
||||
bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
|
||||
@@ -1364,7 +1364,7 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
|
||||
|| (transport == BT_TRANSPORT_LE && p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE)
|
||||
#endif
|
||||
) {
|
||||
/* Connection should be up and runnning */
|
||||
/* Connection should be up and running */
|
||||
BTM_TRACE_WARNING ("Security Manager: BTM_SetEncryption not connected\n");
|
||||
|
||||
if (p_callback) {
|
||||
@@ -1790,15 +1790,15 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
|
||||
}
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
name_size = name_len;
|
||||
if (name_size > strlen(btm_cb.cfg.bd_name)) {
|
||||
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
|
||||
name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
|
||||
name_size = (UINT16)strlen(btm_cb.cfg.bd_name);
|
||||
name_size = (UINT16)strlen(btm_cb.cfg.bredr_bd_name);
|
||||
}
|
||||
delta = name_size + 2;
|
||||
if (max_len >= delta) {
|
||||
*p++ = name_size + 1;
|
||||
*p++ = name_type;
|
||||
ARRAY_TO_STREAM (p, btm_cb.cfg.bd_name, name_size);
|
||||
ARRAY_TO_STREAM (p, btm_cb.cfg.bredr_bd_name, name_size);
|
||||
len += delta;
|
||||
max_len -= delta;
|
||||
}
|
||||
@@ -2118,7 +2118,7 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
|
||||
|
||||
/* If there is no application registered with this PSM do not allow connection */
|
||||
if (!p_serv_rec) {
|
||||
BTM_TRACE_WARNING ("%s() PSM: %d no application registerd\n", __func__, psm);
|
||||
BTM_TRACE_WARNING ("%s() PSM: %d no application registered\n", __func__, psm);
|
||||
(*p_callback) (bd_addr, transport, p_ref_data, BTM_MODE_UNSUPPORTED);
|
||||
return (BTM_MODE_UNSUPPORTED);
|
||||
}
|
||||
@@ -2514,7 +2514,7 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o
|
||||
|
||||
if (rc == BTM_SUCCESS) {
|
||||
BTM_TRACE_EVENT("%s: allow to bypass, checking authorization\n", __FUNCTION__);
|
||||
/* the security in BTM_SEC_IN_FLAGS is fullfilled so far, check the requirements in */
|
||||
/* the security in BTM_SEC_IN_FLAGS is fulfilled so far, check the requirements in */
|
||||
/* btm_sec_execute_procedure */
|
||||
if ((is_originator && (p_serv_rec->security_flags & BTM_SEC_OUT_AUTHORIZE)) ||
|
||||
(!is_originator && (p_serv_rec->security_flags & BTM_SEC_IN_AUTHORIZE))) {
|
||||
@@ -3979,7 +3979,7 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
|
||||
/* or BR key is higher security than existing LE keys */
|
||||
(!(p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED) &&
|
||||
(p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_AUTHED)))) {
|
||||
BTM_TRACE_DEBUG ("link encrypted afer dedic bonding can use SMP_BR_CHNL\n");
|
||||
BTM_TRACE_DEBUG ("link encrypted after dedic bonding can use SMP_BR_CHNL\n");
|
||||
|
||||
if (btm_sec_is_master(p_dev_rec)) {
|
||||
// Encryption is required to start SM over BR/EDR
|
||||
@@ -4255,7 +4255,7 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
|
||||
** Function btm_sec_connected
|
||||
**
|
||||
** Description This function is when a connection to the peer device is
|
||||
** establsihed
|
||||
** established
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -5926,7 +5926,7 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
**
|
||||
** Function btm_sec_auth_payload_tout
|
||||
**
|
||||
** Description Processes the HCI Autheniticated Payload Timeout Event
|
||||
** Description Processes the HCI Authenticated Payload Timeout Event
|
||||
** indicating that a packet containing a valid MIC on the
|
||||
** connection handle was not received within the programmed
|
||||
** timeout value. (Spec Default is 30 secs, but can be
|
||||
@@ -6294,7 +6294,7 @@ static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
** Description This function is called when legacy authentication is used
|
||||
** and only remote device has completed the authentication
|
||||
**
|
||||
** Returns TRUE if aunthentication command sent successfully
|
||||
** Returns TRUE if authentication command sent successfully
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN btm_sec_legacy_authentication_mutual (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
|
||||
@@ -313,7 +313,7 @@ typedef struct {
|
||||
#define BTM_PRIVACY_NONE 0 /* BLE no privacy */
|
||||
#define BTM_PRIVACY_1_1 1 /* BLE privacy 1.1, do not support privacy 1.0 */
|
||||
#define BTM_PRIVACY_1_2 2 /* BLE privacy 1.2 */
|
||||
#define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom propietary mode */
|
||||
#define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom proprietary mode */
|
||||
typedef UINT8 tBTM_PRIVACY_MODE;
|
||||
|
||||
/* data length change event callback */
|
||||
@@ -486,6 +486,7 @@ void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rr
|
||||
void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa);
|
||||
void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_set_addr_resolution_enable_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_set_rpa_timeout_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len);
|
||||
@@ -496,6 +497,7 @@ void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask);
|
||||
void btm_ble_resolving_list_init(UINT8 max_irk_list_sz);
|
||||
void btm_ble_resolving_list_cleanup(void);
|
||||
void btm_ble_add_default_entry_to_resolving_list(void);
|
||||
void btm_ble_set_privacy_mode_complete(UINT8 *p, UINT16 evt_len);
|
||||
#endif
|
||||
|
||||
void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
|
||||
|
||||
@@ -221,6 +221,8 @@ tBTM_CMPL_CB *p_page_to_set_cmpl_cb; /* Callback function to be called w
|
||||
TIMER_LIST_ENT set_acl_pkt_types_timer;
|
||||
tBTM_CMPL_CB *p_set_acl_pkt_types_cmpl_cb; /* Callback function to be called when */
|
||||
/* set ACL packet types is completed */
|
||||
tBTM_CMPL_CB *p_set_min_enc_key_size_cmpl_cb; /* Callback function to be called when */
|
||||
/* set min encryption key size is completed */
|
||||
#endif
|
||||
|
||||
DEV_CLASS dev_class; /* Local device class */
|
||||
@@ -231,6 +233,13 @@ TIMER_LIST_ENT ble_channels_timer;
|
||||
tBTM_CMPL_CB *p_ble_channels_cmpl_cb; /* Callback function to be called When
|
||||
ble set host channels is completed */
|
||||
|
||||
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_ble_set_rpa_timeout_cmpl_cb; /* Callback function to be called When
|
||||
ble set rpa timeout is completed */
|
||||
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_cmpl_cb;
|
||||
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_set_privacy_mode_cmpl_cb;
|
||||
|
||||
tBTM_CMPL_CB *p_le_test_cmd_cmpl_cb; /* Callback function to be called when
|
||||
LE test mode command has been sent successfully */
|
||||
|
||||
@@ -355,7 +364,7 @@ typedef struct {
|
||||
UINT8 inqfilt_type; /* Contains the inquiry filter type (BD ADDR, COD, or Clear) */
|
||||
|
||||
#define BTM_INQ_INACTIVE_STATE 0
|
||||
#define BTM_INQ_CLR_FILT_STATE 1 /* Currently clearing the inquiry filter preceeding the inquiry request */
|
||||
#define BTM_INQ_CLR_FILT_STATE 1 /* Currently clearing the inquiry filter preceding the inquiry request */
|
||||
/* (bypassed if filtering is not used) */
|
||||
#define BTM_INQ_SET_FILT_STATE 2 /* Sets the new filter (or turns off filtering) in this state */
|
||||
#define BTM_INQ_ACTIVE_STATE 3 /* Actual inquiry or periodic inquiry is in progress */
|
||||
@@ -715,7 +724,8 @@ struct tBTM_SEC_DEV_REC{
|
||||
*/
|
||||
typedef struct {
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
tBTM_LOC_BD_NAME bd_name; /* local Bluetooth device name */
|
||||
tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */
|
||||
tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */
|
||||
#endif
|
||||
BOOLEAN pin_type; /* TRUE if PIN type is fixed */
|
||||
UINT8 pin_code_len; /* Bonding information */
|
||||
@@ -949,8 +959,8 @@ typedef struct {
|
||||
UINT8 acl_disc_reason;
|
||||
UINT8 trace_level;
|
||||
UINT8 busy_level; /* the current busy level */
|
||||
BOOLEAN is_paging; /* TRUE, if paging is in progess */
|
||||
BOOLEAN is_inquiry; /* TRUE, if inquiry is in progess */
|
||||
BOOLEAN is_paging; /* TRUE, if paging is in progress */
|
||||
BOOLEAN is_inquiry; /* TRUE, if inquiry is in progress */
|
||||
fixed_queue_t *page_queue;
|
||||
BOOLEAN paging;
|
||||
BOOLEAN discing;
|
||||
@@ -963,9 +973,11 @@ typedef struct {
|
||||
typedef struct{
|
||||
//connection parameters update callback
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
// setting packet data length callback
|
||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *set_pkt_data_length_cb;
|
||||
}tBTM_CallbackFunc;
|
||||
|
||||
extern tBTM_CallbackFunc conn_param_update_cb;
|
||||
extern tBTM_CallbackFunc conn_callback_func;
|
||||
/* security action for L2CAP COC channels */
|
||||
#define BTM_SEC_OK 1
|
||||
#define BTM_SEC_ENCRYPT 2 /* encrypt the link with current key */
|
||||
@@ -1148,6 +1160,9 @@ void btm_delete_stored_link_key_complete (UINT8 *p);
|
||||
void btm_report_device_status (tBTM_DEV_STATUS status);
|
||||
void btm_set_afh_channels_complete (UINT8 *p);
|
||||
void btm_ble_set_channels_complete (UINT8 *p);
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
void btm_set_min_enc_key_size_complete(const UINT8 *p);
|
||||
#endif
|
||||
void btm_set_page_timeout_complete (const UINT8 *p);
|
||||
void btm_page_to_setup_timeout (void *p_tle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user