15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************
25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
35738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Copyright (C) 2009-2012 Broadcom Corporation
45738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
55738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Licensed under the Apache License, Version 2.0 (the "License");
65738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  you may not use this file except in compliance with the License.
75738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  You may obtain a copy of the License at:
85738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
95738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  http://www.apache.org/licenses/LICENSE-2.0
105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Unless required by applicable law or agreed to in writing, software
125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  distributed under the License is distributed on an "AS IS" BASIS,
135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  See the License for the specific language governing permissions and
155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  limitations under the License.
165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/
185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#ifndef BTIF_DM_H
205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define BTIF_DM_H
215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
22ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#include "bta_api.h"
23ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta/************************************************************************************
245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project**  Functions
255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project********************************************************************************/
265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/**
285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * BTIF callback to switch context from bte to btif
295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project */
305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/**
335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Notify BT disable being initiated. DM may chose to abort
345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * pending commands, like pairing
355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project */
365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid btif_dm_on_disable(void);
375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/**
39550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta * Callout for handling io_capabilities request
40550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta */
41550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Battavoid btif_dm_proc_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap, tBTA_OOB_DATA *p_oob_data,
42550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta                      tBTA_AUTH_REQ *p_auth_req, BOOLEAN is_orig);
43550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta/**
44550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta * Callout for handling io_capabilities response
45550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta */
46550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Battavoid btif_dm_proc_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
47550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta                      tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
48550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta
49550b319b217739808fe95c57aa0f422dbf5db9d1Ganesh Ganapathi Batta/**
505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Out-of-band functions
515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project */
525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#if (BTM_OOB_INCLUDED == TRUE)
535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid btif_dm_set_oob_for_io_req(tBTA_OOB_DATA  *p_oob_data);
545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#ifdef BTIF_DM_OOB_TEST
555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid btif_dm_load_local_oob(void);
565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r);
575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source ProjectBOOLEAN btif_dm_proc_rmt_oob(BD_ADDR bd_addr,  BT_OCTET16 p_c, BT_OCTET16 p_r);
585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif /* BTIF_DM_OOB_TEST */
595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif /* BTM_OOB_INCLUDED */
60ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#if (BLE_INCLUDED == TRUE)
61ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
62ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battatypedef struct
63ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta{
64ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta    BOOLEAN                   is_penc_key_rcvd;
65e87ef6dba42ebaa94c7f0200d9e5223d1259b9d9Andre Eisenbach    tBTM_LE_PENC_KEYS         penc_key;       /* received peer encryption key */
66ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta    BOOLEAN                   is_pcsrk_key_rcvd;
67e87ef6dba42ebaa94c7f0200d9e5223d1259b9d9Andre Eisenbach    tBTM_LE_PCSRK_KEYS        pcsrk_key;       /* received peer device SRK */
68ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta    BOOLEAN                   is_pid_key_rcvd;
69e87ef6dba42ebaa94c7f0200d9e5223d1259b9d9Andre Eisenbach    tBTM_LE_PID_KEYS          pid_key;        /* peer device ID key */
70ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta    BOOLEAN                   is_lenc_key_rcvd;
71e87ef6dba42ebaa94c7f0200d9e5223d1259b9d9Andre Eisenbach    tBTM_LE_LENC_KEYS         lenc_key;       /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
72ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta    BOOLEAN                   is_lcsrk_key_rcvd;
73e87ef6dba42ebaa94c7f0200d9e5223d1259b9d9Andre Eisenbach    tBTM_LE_LCSRK_KEYS        lcsrk_key;      /* local device CSRK = d1(ER,DIV,1)*/
74444a8da807abaf5f9e813ce70c56a79160495fb3Satya Calloji    BOOLEAN                   is_lidk_key_rcvd;   /* local identity key received */
75ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta} btif_dm_ble_cb_t;
76ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
77ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_PENC        BTA_LE_KEY_PENC
78ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_PID         BTA_LE_KEY_PID
79ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_PCSRK       BTA_LE_KEY_PCSRK
80ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_LENC        BTA_LE_KEY_LENC
81ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_LID         BTA_LE_KEY_LID
82ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_KEY_LCSRK       BTA_LE_KEY_LCSRK
83ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
84ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_LOCAL_KEY_IR       (1<<0)
85ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_LOCAL_KEY_IRK      (1<<1)
86ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_LOCAL_KEY_DHK      (1<<2)
87ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#define BTIF_DM_LE_LOCAL_KEY_ER       (1<<3)
88ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
89ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_load_ble_local_keys(void);
90ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
91ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta                                   tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
92ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_save_ble_bonding_keys(void);
93ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_remove_ble_bonding_keys(void);
94ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ *p_ble_req);
95ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
96ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Battavoid btif_dm_update_ble_remote_properties( BD_ADDR bd_addr, BD_NAME bd_name,
97ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta                                           tBT_DEVICE_TYPE dev_type);
98ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta
99ead3cde4bac0c3e32cd31f149093f004eef8ceebGanesh Ganapathi Batta#endif /* BLE_INCLUDED */
1005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif
102