static BOOLEAN btm_sec_queue_mx_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_orig,
UINT32 mx_proto_id, UINT32 mx_chan_id,
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
-#endif ///SMP_INCLUDED == TRUE
static void btm_sec_bond_cancel_complete (void);
-#if (SMP_INCLUDED == TRUE)
static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec);
static UINT8 btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec);
void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
{
tBTM_SEC_DEV_REC *p_dev_rec;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_API ("BTM_PINCodeReply(): PairState: %s PairFlags: 0x%02x PinLen:%d Result:%d\n",
btm_pair_state_descr(btm_cb.pairing_state), btm_cb.pairing_flags, pin_len, res);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
/* If timeout already expired or has been canceled, ignore the reply */
if (btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_LOCAL_PIN) {
BTM_TRACE_WARNING ("BTM_PINCodeReply() - Wrong State: %d\n", btm_cb.pairing_state);
**
** Note: After 2.1 parameters are not used and preserved here not to change API
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_STATUS status;
UINT8 *p_features;
/* Other security process is in progress */
if (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) {
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_ERROR ("BTM_SecBond: already busy in state: %s\n", btm_pair_state_descr(btm_cb.pairing_state));
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
return (BTM_WRONG_MODE);
}
/* We are accepting connection request from peer */
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_PIN_REQ);
}
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("State:%s sm4: 0x%x sec_state:%d\n",
btm_pair_state_descr (btm_cb.pairing_state), p_dev_rec->sm4, p_dev_rec->sec_state);
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
return BTM_CMD_STARTED;
}
}
return status;
-#else
- return BTM_MODE_UNSUPPORTED;
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
{
-#if SMP_INCLUDED == TRUE
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
(transport == BT_TRANSPORT_BR_EDR && (dev_type & BT_DEVICE_TYPE_BREDR) == 0)) {
return BTM_ILLEGAL_ACTION;
}
-#endif
return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin, trusted_mask);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_API ("BTM_SecBondCancel() State: %s flags:0x%x\n",
btm_pair_state_descr (btm_cb.pairing_state), btm_cb.pairing_flags);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if (((p_dev_rec = btm_find_dev (bd_addr)) == NULL)
|| (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) ) {
return BTM_UNKNOWN_ADDR;
** bd_addr - Address of the peer device
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void BTM_ConfirmReqReply(tBTM_STATUS res, BD_ADDR bd_addr)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("BTM_ConfirmReqReply() State: %s Res: %u",
btm_pair_state_descr(btm_cb.pairing_state), res);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
/* If timeout already expired or has been canceled, ignore the reply */
if ( (btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_NUMERIC_CONFIRM)
|| (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) ) {
btm_cb.acl_disc_reason = HCI_ERR_HOST_REJECT_SECURITY;
btsnd_hcic_user_conf_reply (bd_addr, FALSE);
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE)
void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey)
{
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_API ("BTM_PasskeyReqReply: State: %s res:%d\n",
btm_pair_state_descr(btm_cb.pairing_state), res);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if ( (btm_cb.pairing_state == BTM_PAIR_STATE_IDLE)
|| (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) ) {
return;
*******************************************************************************/
void BTM_IoCapRsp(BD_ADDR bd_addr, tBTM_IO_CAP io_cap, tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req)
{
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("BTM_IoCapRsp: state: %s oob: %d io_cap: %d\n",
btm_pair_state_descr(btm_cb.pairing_state), oob, io_cap);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if ( (btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_LOCAL_IOCAPS)
|| (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) ) {
return;
*******************************************************************************/
void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr, BT_OCTET16 c, BT_OCTET16 r)
{
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() - State: %s res: %d\n", __func__,
btm_pair_state_descr(btm_cb.pairing_state), res);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
/* If timeout already expired or has been canceled, ignore the reply */
if (btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_LOCAL_OOB_RSP) {
return;
/* there are some devices (moto KRZR) which connects to several services at the same time */
/* we will process one after another */
if ( (p_dev_rec->p_callback) || (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) ) {
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() - busy - PSM:%d delayed state: %s mode:%d, sm4:0x%x\n", __func__,
psm, btm_pair_state_descr(btm_cb.pairing_state), btm_cb.security_mode, p_dev_rec->sm4);
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
BTM_TRACE_EVENT ("security_flags:x%x, sec_flags:x%x\n", security_required, p_dev_rec->sec_flags);
rc = BTM_CMD_STARTED;
if ((btm_cb.security_mode == BTM_SEC_MODE_UNDEFINED ||
/* there are some devices (moto phone) which connects to several services at the same time */
/* we will process one after another */
if ( (p_dev_rec->p_callback) || (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) ) {
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() service PSM:%d Proto:%d SCN:%d delayed state: %s\n", __func__,
psm, mx_proto_id, mx_chan_id, btm_pair_state_descr(btm_cb.pairing_state));
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
rc = BTM_CMD_STARTED;
if ((btm_cb.security_mode == BTM_SEC_MODE_UNDEFINED ||
(*p_callback) (bd_addr, transport, p_ref_data, (UINT8)rc);
}
}
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT("%s: return with rc = 0x%02x in delayed state %s\n", __FUNCTION__, rc,
btm_pair_state_descr(btm_cb.pairing_state));
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
return rc;
}
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_conn_req (UINT8 *bda, UINT8 *dc)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
BTM_TRACE_ERROR ("%s\n", __func__);
/* Some device may request a connection before we are done with the HCI_Reset sequence */
p_dev_rec->sm4 |= BTM_SM4_CONN_PEND;
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btm_sec_bond_cancel_complete (void)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
if ((btm_cb.pairing_flags & BTM_PAIR_FLAGS_DISC_WHEN_DONE) ||
btm_cb.api.p_bond_cancel_cmpl_callback(BTM_SUCCESS);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
*/
switch (status) {
case HCI_SUCCESS:
+#if (SMP_INCLUDED == TRUE)
btm_sec_bond_cancel_complete();
+#endif ///SMP_INCLUDED == TRUE
break;
case HCI_ERR_CONNECTION_EXISTS:
case HCI_ERR_NO_CONNECTION:
/* First, resubmit L2CAP requests */
if (btm_cb.sec_req_pending) {
btm_cb.sec_req_pending = FALSE;
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2cu_resubmit_pending_sec_req (NULL);
+#endif ///SMP_INCLUDED == TRUE
}
/* Now, re-submit anything in the mux queue */
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_init (UINT8 sec_mode)
{
-#if (SMP_INCLUDED == TRUE)
btm_cb.security_mode = sec_mode;
memset (btm_cb.pairing_bda, 0xff, BD_ADDR_LEN);
btm_cb.max_collision_delay = BTM_SEC_MAX_COLLISION_DELAY;
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_device_down (void)
{
-#if (SMP_INCLUDED == TRUE)
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() State: %s\n", __func__, btm_pair_state_descr(btm_cb.pairing_state));
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT8 status)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
int i;
DEV_CLASS dev_class;
/* Commenting out trace due to obf/compilation problems.
*/
-#if (BT_USE_TRACES == TRUE)
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
if (!p_bd_name) {
p_bd_name = (UINT8 *)"";
}
/* There is no next procedure or start of procedure failed, notify the waiting layer */
btm_sec_dev_rec_cback_event (p_dev_rec, status, FALSE);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
evt_data.io_cap = btm_cb.devcb.loc_io_caps;
evt_data.oob_data = BTM_OOB_NONE;
evt_data.auth_req = BTM_DEFAULT_AUTH_REQ;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT("%s: State: %s\n", __FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state));
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
p_dev_rec = btm_find_or_alloc_dev (evt_data.bd_addr);
BTM_TRACE_DEBUG("%s:Security mode: %d, Num Read Remote Feat pages: %d\n", __FUNCTION__,
}
p_dev_rec->sm4 |= BTM_SM4_TRUE;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT("%s: State: %s Flags: 0x%04x p_cur_service: %p\n",
__FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state),
btm_cb.pairing_flags, p_dev_rec->p_cur_service);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if (p_dev_rec->p_cur_service) {
BTM_TRACE_EVENT("%s: cur_service psm: 0x%04x, security_flags: 0x%04x\n",
__FUNCTION__, p_dev_rec->p_cur_service->psm,
/* send the response right now. Save the current IO capability in the control block */
btm_cb.devcb.loc_auth_req = evt_data.auth_req;
btm_cb.devcb.loc_io_caps = evt_data.io_cap;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT("%s: State: %s IO_CAP:%d oob_data:%d auth_req:%d",
__FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state), evt_data.io_cap,
evt_data.oob_data, evt_data.auth_req);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
btsnd_hcic_io_cap_req_reply(evt_data.bd_addr, evt_data.io_cap,
evt_data.oob_data, evt_data.auth_req);
}
/* All events start with bd_addr */
STREAM_TO_BDADDR (p_bda, p);
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("btm_proc_sp_req_evt() BDA: %08x%04x event: 0x%x, State: %s\n",
(p_bda[0] << 24) + (p_bda[1] << 16) + (p_bda[2] << 8) + p_bda[3], (p_bda[4] << 8) + p_bda[5],
event, btm_pair_state_descr(btm_cb.pairing_state));
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if ( ((p_dev_rec = btm_find_dev (p_bda)) != NULL)
&& (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE)
&& (memcmp (btm_cb.pairing_bda, p_bda, BD_ADDR_LEN) == 0) ) {
(evt_data.bd_addr[4] << 8) + evt_data.bd_addr[5]);
return;
}
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("btm_simple_pair_complete() Pair State: %s Status:%d sec_state: %u\n",
btm_pair_state_descr(btm_cb.pairing_state), status, p_dev_rec->sec_state);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
evt_data.status = BTM_ERR_PROCESSING;
if (status == HCI_SUCCESS) {
evt_data.status = BTM_SUCCESS;
/* Commenting out trace due to obf/compilation problems.
*/
-#if (BT_USE_TRACES == TRUE)
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
if (p_dev_rec) {
BTM_TRACE_EVENT ("Security Manager: auth_complete PairState: %s handle:%u status:%d dev->sec_state: %u Bda:%08x, RName:%s\n",
btm_pair_state_descr (btm_cb.pairing_state),
if (BTM_SEC_STATE_DELAY_FOR_ENC == p_dev_rec->sec_state) {
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
p_dev_rec->p_callback = NULL;
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2cu_resubmit_pending_sec_req (p_dev_rec->bd_addr);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
return;
}
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
UINT8 res;
BOOLEAN is_pairing_device = FALSE;
BTM_TRACE_ERROR ("%s\n", __func__);
/* Commenting out trace due to obf/compilation problems.
*/
-#if (BT_USE_TRACES == TRUE)
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
if (p_dev_rec) {
BTM_TRACE_EVENT ("Security Manager: btm_sec_connected in state: %s handle:%d status:%d enc_mode:%d bda:%x RName:%s\n",
btm_pair_state_descr(btm_cb.pairing_state), handle, status, enc_mode,
}
}
return;
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
tBTM_STATUS btm_sec_disconnect (UINT16 handle, UINT8 reason)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
/* In some weird race condition we may not have a record */
}
return (btm_sec_send_hci_disconnect(p_dev_rec, reason, handle));
-#else
- return BTM_MODE_UNSUPPORTED;
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_sec_disconnected (UINT16 handle, UINT8 reason)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
UINT8 old_pairing_flags = btm_cb.pairing_flags;
int result = HCI_ERR_AUTH_FAILURE;
/* clear unused flags */
p_dev_rec->sm4 &= BTM_SM4_TRUE;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
uint8_t *bd_addr = (uint8_t *)p_dev_rec->bd_addr;
BTM_TRACE_EVENT("%s sec_req:x%x state:%s reason:%d bd_addr:%02x:%02x:%02x:%02x:%02x:%02x"
" remote_name:%s\n", __func__, p_dev_rec->security_required, btm_pair_state_descr(btm_cb.pairing_state),
reason, bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5], p_dev_rec->sec_bd_name);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
BTM_TRACE_EVENT("%s before update sec_flags=0x%x\n", __func__, p_dev_rec->sec_flags);
/* If we are in the process of bonding we need to tell client that auth failed */
}
BTM_TRACE_EVENT("%s after update sec_flags=0x%x\n", __func__, p_dev_rec->sec_flags);
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_type)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_bda);
BOOLEAN we_are_bonding = FALSE;
BOOLEAN ltk_derived_lk = FALSE;
}
}
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_sec_link_key_request (UINT8 *p_bda)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_bda);
BTM_TRACE_EVENT ("btm_sec_link_key_request() BDA: %02x:%02x:%02x:%02x:%02x:%02x\n",
/* The link key is not in the database and it is not known to the manager */
btsnd_hcic_link_key_neg_reply (p_bda);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
/* coverity[UNUSED_VALUE] pointer p_dev_rec is actually used several times... This is a Coverity false-positive, i.e. a fake issue.
*/
p_dev_rec = btm_find_dev (p_cb->pairing_bda);
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("btm_sec_pairing_timeout() State: %s Flags: %u\n",
btm_pair_state_descr(p_cb->pairing_state), p_cb->pairing_flags);
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
switch (p_cb->pairing_state) {
case BTM_PAIR_STATE_WAIT_PIN_REQ:
btm_sec_bond_cancel_complete();
break;
default:
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_WARNING ("btm_sec_pairing_timeout() not processed state: %s\n", btm_pair_state_descr(btm_cb.pairing_state));
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
break;
}
}
-#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
*******************************************************************************/
void btm_sec_pin_code_request (UINT8 *p_bda)
{
-#if (SMP_INCLUDED == TRUE)
-
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_CB *p_cb = &btm_cb;
UINT8 default_pin_code_len = 4;
PIN_CODE default_pin_code = {0x30, 0x30, 0x30, 0x30};
#endif
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("btm_sec_pin_code_request() State: %s, BDA:%04x%08x\n",
btm_pair_state_descr(btm_cb.pairing_state),
(p_bda[0] << 8) + p_bda[1], (p_bda[2] << 24) + (p_bda[3] << 16) + (p_bda[4] << 8) + p_bda[5] );
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
if (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) {
if ( (memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) &&
(btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) ) {
}
} else if ((btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_PIN_REQ)
|| memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) != 0) {
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_WARNING ("btm_sec_pin_code_request() rejected - state: %s\n",
btm_pair_state_descr(btm_cb.pairing_state));
-
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
#ifdef PORCHE_PAIRING_CONFLICT
/* reply pin code again due to counter in_rand when local initiates pairing */
BTM_TRACE_EVENT ("btm_sec_pin_code_request from remote dev. for local initiated pairing\n");
}
}
}
-#endif ///SMP_INCLUDED == TRUE
return;
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
/*******************************************************************************
**
-** Function btm_sec_link_key_request
+** Function btm_send_link_key_notif
**
** Description This function is called when controller requests link key
**
static void btm_sec_change_pairing_state (tBTM_PAIRING_STATE new_state)
{
tBTM_PAIRING_STATE old_state = btm_cb.pairing_state;
-
+#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() Old: %s\n", __func__, btm_pair_state_descr(btm_cb.pairing_state));
BTM_TRACE_EVENT ("%s() New: %s pairing_flags:0x%x\n\n", __func__,
btm_pair_state_descr(new_state), btm_cb.pairing_flags);
+#endif ///BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE
btm_cb.pairing_state = new_state;
static void btu_hcif_role_change_evt (UINT8 *p);
static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p);
static void btu_hcif_mode_change_evt (UINT8 *p);
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p);
static void btu_hcif_link_key_request_evt (UINT8 *p);
static void btu_hcif_link_key_notification_evt (UINT8 *p);
+#endif ///SMP_INCLUDED == TRUE
static void btu_hcif_loopback_command_evt (void);
static void btu_hcif_data_buf_overflow_evt (void);
static void btu_hcif_max_slots_changed_evt (void);
case HCI_MODE_CHANGE_EVT:
btu_hcif_mode_change_evt (p);
break;
+#if (SMP_INCLUDED == TRUE)
case HCI_PIN_CODE_REQUEST_EVT:
btu_hcif_pin_code_request_evt (p);
break;
case HCI_LINK_KEY_NOTIFICATION_EVT:
btu_hcif_link_key_notification_evt (p);
break;
+#endif ///SMP_INCLUDED == TRUE
case HCI_LOOPBACK_COMMAND_EVT:
btu_hcif_loopback_command_evt ();
break;
UINT16 handle;
BD_ADDR bda;
UINT8 link_type;
+#if SMP_INCLUDED == TRUE
UINT8 enc_mode;
+#endif ///SMP_INCLUDED == TRUE
#if BTM_SCO_INCLUDED == TRUE
tBTM_ESCO_DATA esco_data;
#endif
STREAM_TO_UINT16 (handle, p);
STREAM_TO_BDADDR (bda, p);
STREAM_TO_UINT8 (link_type, p);
+#if (SMP_INCLUDED == TRUE)
STREAM_TO_UINT8 (enc_mode, p);
-
+#endif ///SMP_INCLUDED == TRUE
handle = HCID_GET_HANDLE (handle);
if (link_type == HCI_LINK_TYPE_ACL) {
+#if (SMP_INCLUDED == TRUE)
btm_sec_connected (bda, handle, status, enc_mode);
-
+#endif ///SMP_INCLUDED == TRUE
l2c_link_hci_conn_comp (status, handle, bda);
}
#if BTM_SCO_INCLUDED == TRUE
STREAM_TO_BDADDR (bda, p);
STREAM_TO_DEVCLASS (dc, p);
STREAM_TO_UINT8 (link_type, p);
-
/* Pass request to security manager to check connect filters before */
/* passing request to l2cap */
if (link_type == HCI_LINK_TYPE_ACL) {
+#if (SMP_INCLUDED == TRUE)
btm_sec_conn_req (bda, dc);
+#endif ///SMP_INCLUDED == TRUE
}
#if BTM_SCO_INCLUDED == TRUE
else {
#else
l2c_link_hci_disc_comp (handle, reason);
#endif /* BTM_SCO_INCLUDED */
-
+#if (SMP_INCLUDED == TRUE)
/* Notify security manager */
btm_sec_disconnected (handle, reason);
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
evt_len -= (1 + BD_ADDR_LEN);
btm_process_remote_name (bd_addr, p, evt_len, status);
-
+#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (bd_addr, p, status);
+#endif ///SMP_INCLUDED == TRUE
}
case HCI_RMT_NAME_REQUEST:
/* Tell inquiry processing that we are done */
btm_process_remote_name (NULL, NULL, 0, status);
-
+#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (NULL, NULL, status);
+#endif ///SMP_INCLUDED == TRUE
break;
case HCI_QOS_SETUP_COMP_EVT:
if (p_cmd != NULL) {
p_cmd++;
STREAM_TO_BDADDR (bd_addr, p_cmd);
+#if (SMP_INCLUDED == TRUE)
btm_sec_connected (bd_addr, HCI_INVALID_HANDLE, status, 0);
+#endif ///SMP_INCLUDED == TRUE
l2c_link_hci_conn_comp (status, HCI_INVALID_HANDLE, bd_addr);
}
break;
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p)
{
BD_ADDR bda;
btm_sec_link_key_request (bda);
}
-
/*******************************************************************************
**
** Function btu_hcif_link_key_notification_evt
btm_sec_link_key_notification (bda, key, key_type);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
UINT16 reason, tBT_TRANSPORT transport);
static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congest);
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 l2cap_cid,
UINT16 psm, UINT8 l2cap_id);
static void gatt_l2cif_connect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
static void gatt_l2cif_disconnect_ind_cback (UINT16 l2cap_cid, BOOLEAN ack_needed);
static void gatt_l2cif_disconnect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
static void gatt_l2cif_data_ind_cback (UINT16 l2cap_cid, BT_HDR *p_msg);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
static void gatt_send_conn_cback (tGATT_TCB *p_tcb);
+#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_congest_cback (UINT16 cid, BOOLEAN congested);
-
static const tL2CAP_APPL_INFO dyn_info = {
gatt_l2cif_connect_ind_cback,
gatt_l2cif_connect_cfm_cback,
gatt_l2cif_congest_cback,
NULL
} ;
+#endif ///SMP_INCLUDED == TRUE
#if GATT_DYNAMIC_MEMORY == FALSE
tGATT_CB gatt_cb;
gatt_send_conn_cback(p_tcb);
}
if (check_srv_chg) {
+#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg (p_srv_chg_clt);
+#endif ///GATTS_INCLUDED == TRUE
}
}
/* this is incoming connection or background connection callback */
gatt_send_conn_cback (p_tcb);
if (check_srv_chg) {
+#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg (p_srv_chg_clt);
+#endif ///GATTS_INCLUDED == TRUE
}
} else {
GATT_TRACE_ERROR("CCB max out, no rsources");
** Returns void
**
*******************************************************************************/
+#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
/* do we already have a control channel for this peer? */
UINT8 result = L2CAP_CONN_OK;
tL2CAP_CFG_INFO cfg;
L2CA_ConfigReq(lcid, &cfg);
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
}
*******************************************************************************/
static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tL2CAP_CFG_INFO cfg;
}
}
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
-
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tGATTS_SRV_CHG *p_srv_chg_clt = NULL;
gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
if ((p_srv_chg_clt = gatt_is_bda_in_the_srv_chg_clt_list(p_tcb->peer_bda)) != NULL) {
+#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg(p_srv_chg_clt);
+#endif ///GATTS_INCLUDED == TRUE
} else {
if (btm_sec_is_a_bonded_dev(p_tcb->peer_bda)) {
gatt_add_a_bonded_dev_for_srv_chg(p_tcb->peer_bda);
}
}
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
-
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tGATTS_SRV_CHG *p_srv_chg_clt = NULL;
/* look up clcb for this channel */
if (p_tcb->ch_flags & GATT_L2C_CFG_CFM_DONE) {
gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
if ((p_srv_chg_clt = gatt_is_bda_in_the_srv_chg_clt_list(p_tcb->peer_bda)) != NULL) {
+#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg(p_srv_chg_clt);
+#endif ///GATTS_INCLUDED == TRUE
} else {
if (btm_sec_is_a_bonded_dev(p_tcb->peer_bda)) {
gatt_add_a_bonded_dev_for_srv_chg(p_tcb->peer_bda);
}
}
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
-
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
UINT16 reason;
/* send disconnect callback */
gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR);
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
-
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
UINT16 reason;
UNUSED(result);
gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR);
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
-
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
/* look up clcb for this channel */
} else { /* prevent buffer leak */
GKI_freebuf(p_buf);
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
}
*******************************************************************************/
static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb = gatt_find_tcb_by_cid(lcid);
if (p_tcb != NULL) {
gatt_channel_congestion(p_tcb, congested);
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
{
-#if (GATTS_INCLUDED == TRUE)
UINT8 handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
UINT8 *p = handle_range;
UINT16 conn_id;
(peer_bda[4] << 8) + peer_bda[5] );
}
}
-#endif ///GATTS_INCLUDED == TRUE
}
+
/*******************************************************************************
**
** Function gatt_chk_srv_chg
gatt_send_srv_chg_ind(p_srv_chg_clt->bda);
}
}
+#endif ///GATTS_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
void gatt_proc_srv_chg (void)
{
UINT8 start_idx, found_idx;
}
}
}
+#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**