summaryrefslogtreecommitdiffstats
path: root/stack/smp/smp_l2c.c
diff options
context:
space:
mode:
authorAndre Eisenbach <andre@broadcom.com>2012-09-18 01:35:44 -0700
committerMatthew Xie <mattx@google.com>2012-09-18 16:26:28 -0700
commit6ef101187774e30ddba6b46bbedef549a42196ad (patch)
treef36eb347f03083671640fbc750171e3b951e0082 /stack/smp/smp_l2c.c
parentf80d3d045eab5f002be4b5e8a3d2d376fdf7581a (diff)
downloadexternal_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.zip
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.gz
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.bz2
Initual Bluetooth open source release
First release under Apache source license with updated header files and whitespace cleanups. Also fixed file permission to remove executable bit from source files. Change-Id: I7155903edfc2f491c1cbbd0db108f207852caaa0
Diffstat (limited to 'stack/smp/smp_l2c.c')
-rw-r--r--stack/smp/smp_l2c.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/stack/smp/smp_l2c.c b/stack/smp/smp_l2c.c
index 0356612..648cd59 100644
--- a/stack/smp/smp_l2c.c
+++ b/stack/smp/smp_l2c.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-** *
-** Name: smp_l2c.c *
-** *
-** Description: This file contains functions for the SMP L2Cap interface *
-** *
-** *
-** Copyright (c) 1999-2009, 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 functions for the SMP L2Cap interface
+ *
+ ******************************************************************************/
#include "bt_target.h"
@@ -46,7 +59,7 @@ void smp_l2cap_if_init (void)
fixed_reg.pL2CA_FixedConn_Cb = smp_connect_cback;
fixed_reg.pL2CA_FixedData_Cb = smp_data_ind;
fixed_reg.default_idle_tout = 60; /* set 60 seconds timeout, 0xffff default idle timeout */
-
+
/* Now, register with L2CAP */
L2CA_RegisterFixedChannel (L2CAP_SMP_CID, &fixed_reg);
}
@@ -55,8 +68,8 @@ void smp_l2cap_if_init (void)
**
** Function smp_connect_cback
**
-** Description This callback function is called by L2CAP to indicate that
-** SMP channel is
+** Description This callback function is called by L2CAP to indicate that
+** SMP channel is
** connected (conn = TRUE)/disconnected (conn = FALSE).
**
*******************************************************************************/
@@ -70,7 +83,7 @@ static void smp_connect_cback (BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason
if (memcmp(bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) == 0)
{
SMP_TRACE_EVENT3 ("smp_connect_cback() for pairing BDA: %08x%04x Event: %s",
- (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8) + bd_addr[3],
+ (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8) + bd_addr[3],
(bd_addr[4]<<8)+bd_addr[5], (connected) ? "connected" : "disconnected");
if (connected)
@@ -80,13 +93,13 @@ static void smp_connect_cback (BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason
p_cb->connect_initialized = TRUE;
/* initiating connection established */
p_cb->role = L2CA_GetBleConnRole(bd_addr);
-
+
/* initialize local i/r key to be default keys */
p_cb->loc_r_key = p_cb->loc_i_key = SMP_SEC_DEFAULT_KEY;
p_cb->loc_auth_req = p_cb->peer_auth_req = SMP_DEFAULT_AUTH_REQ;
p_cb->cb_evt = SMP_IO_CAP_REQ_EVT;
smp_sm_event(p_cb, SMP_L2CAP_CONN_EVT, NULL);
-
+
BTM_ReadConnectionAddr(p_cb->local_bda);
}
}
@@ -105,7 +118,7 @@ static void smp_connect_cback (BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason
**
** Description This function is called when data is received from L2CAP on
** SMP channel.
-**
+**
**
** Returns void
**
@@ -120,7 +133,7 @@ static void smp_data_ind (BD_ADDR bd_addr, BT_HDR *p_buf)
SMP_TRACE_EVENT0 ("Got smp_data_ind");
STREAM_TO_UINT8(cmd, p);
-
+
/* reject the pairing request if there is an on-going SMP pairing */
if (SMP_OPCODE_PAIRING_REQ == cmd || SMP_OPCODE_SEC_REQ == cmd)
@@ -138,10 +151,10 @@ static void smp_data_ind (BD_ADDR bd_addr, BT_HDR *p_buf)
}
if (memcmp(&bd_addr[0], p_cb->pairing_bda, BD_ADDR_LEN) == 0)
- {
+ {
btu_stop_timer (&p_cb->rsp_timer_ent);
smp_sm_event(p_cb, cmd, p);
- }
+ }
GKI_freebuf (p_buf);
}