diff options
Diffstat (limited to 'stack/l2cap/l2c_csm.c')
-rw-r--r-- | stack/l2cap/l2c_csm.c | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/stack/l2cap/l2c_csm.c b/stack/l2cap/l2c_csm.c index 216f45b..0d04d8a 100644 --- a/stack/l2cap/l2c_csm.c +++ b/stack/l2cap/l2c_csm.c @@ -1,14 +1,26 @@ -/***************************************************************************** -** -** Name: l2c_csm.c -** -** Description: This file contains the L2CAP channel state machine -** -** -** -** Copyright (c) 1999-2011, Broadcom Corp, All Rights Reserved. -** Broadcom Bluetooth Core. Proprietary and confidential. -******************************************************************************/ +/****************************************************************************** + * + * Copyright (C) 1999-2012 Broadcom Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/****************************************************************************** + * + * This file contains the L2CAP channel state machine + * + ******************************************************************************/ #include <stdlib.h> #include <string.h> @@ -154,13 +166,13 @@ static void l2c_csm_closed (tL2C_CCB *p_ccb, UINT16 event, void *p_data) case L2CEVT_LP_CONNECT_CFM: /* Link came up */ p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP; - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb); break; case L2CEVT_LP_CONNECT_CFM_NEG: /* Link failed */ /* Disconnect unless ACL collision and upper layer wants to handle it */ - if (p_ci->status != HCI_ERR_CONNECTION_EXISTS + if (p_ci->status != HCI_ERR_CONNECTION_EXISTS || !btm_acl_notif_conn_collision(p_ccb->p_lcb->remote_bd_addr)) { L2CAP_TRACE_API2 ("L2CAP - Calling ConnectCfm_Cb(), CID: 0x%04x Status: %d", p_ccb->local_cid, p_ci->status); @@ -182,9 +194,9 @@ static void l2c_csm_closed (tL2C_CCB *p_ccb, UINT16 event, void *p_data) Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode" -// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. -// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored -*/ +// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. +// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored +*/ BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings); } #else @@ -192,7 +204,7 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu #endif /* If sec access does not result in started SEC_COM or COMP_NEG are already processed */ - if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED) p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP; break; @@ -239,9 +251,9 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode" -// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. -// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored -*/ +// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. +// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored +*/ BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings); } #else @@ -249,7 +261,7 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu #endif p_ccb->chnl_state = CST_TERM_W4_SEC_COMP; - if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED) { /* started the security process, tell the peer to set a longer timer */ @@ -319,7 +331,7 @@ static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */ case L2CEVT_LP_CONNECT_CFM: /* Link came up */ - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb); break; @@ -426,11 +438,11 @@ static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat else { /* - ** L2CAP Connect Response will be sent out by 3 sec timer expiration - ** because Bluesoleil doesn't respond to L2CAP Information Request. - ** Bluesoleil seems to disconnect ACL link as failure case, because - ** it takes too long (4~7secs) to get response. - ** product version : Bluesoleil 2.1.1.0 EDR Release 060123 + ** L2CAP Connect Response will be sent out by 3 sec timer expiration + ** because Bluesoleil doesn't respond to L2CAP Information Request. + ** Bluesoleil seems to disconnect ACL link as failure case, because + ** it takes too long (4~7secs) to get response. + ** product version : Bluesoleil 2.1.1.0 EDR Release 060123 ** stack version : 05.04.11.20060119 */ @@ -480,7 +492,7 @@ static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat break; case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */ - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb); break; } @@ -736,7 +748,7 @@ static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data) if (p_cfg->result != L2CAP_CFG_PENDING) { /* TBD: When config options grow beyong minimum MTU (48 bytes) - * logic needs to be added to handle responses with + * logic needs to be added to handle responses with * continuation bit set in flags field. * 1. Send additional config request out until C-bit is cleared in response */ @@ -1007,7 +1019,7 @@ static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data) BTM_CancelSniffMode (p_ccb->p_lcb->remote_bd_addr); #endif // btla-specific -- - + p_ccb->chnl_state = CST_W4_L2CA_DISCONNECT_RSP; btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, L2CAP_CHNL_DISCONNECT_TOUT); L2CAP_TRACE_API1 ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x Conf Needed", p_ccb->local_cid); |