blob: f06272a8406f593f026ebfcba2104b4e93e76939 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 2009-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19#ifndef BTIF_DM_H
20#define BTIF_DM_H
21
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -080022#include "bta_api.h"
Nitin Arora2aa2b802016-03-11 16:37:51 -080023#include "bte_appl.h"
Myles Watson6bd442f2016-10-19 09:50:22 -070024#include "btif_uid.h"
Adam Lesinski0620f972015-12-02 22:15:08 -080025
Myles Watsonee96a3c2016-11-23 14:49:54 -080026/*******************************************************************************
Myles Watson6bd442f2016-10-19 09:50:22 -070027 * Functions
Myles Watsonee96a3c2016-11-23 14:49:54 -080028 ******************************************************************************/
Adam Lesinski0620f972015-12-02 22:15:08 -080029void btif_dm_init(uid_set_t* set);
30void btif_dm_cleanup(void);
31
The Android Open Source Project5738f832012-12-12 16:00:35 -080032/**
33 * BTIF callback to switch context from bte to btif
34 */
Myles Watson6bd442f2016-10-19 09:50:22 -070035void bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -080036
37/**
38 * Notify BT disable being initiated. DM may chose to abort
39 * pending commands, like pairing
40 */
41void btif_dm_on_disable(void);
42
43/**
Ganesh Ganapathi Batta550b3192014-04-28 16:30:55 -070044 * Callout for handling io_capabilities request
45 */
Myles Watson6bd442f2016-10-19 09:50:22 -070046void btif_dm_proc_io_req(BD_ADDR bd_addr, tBTA_IO_CAP* p_io_cap,
47 tBTA_OOB_DATA* p_oob_data, tBTA_AUTH_REQ* p_auth_req,
48 bool is_orig);
Ganesh Ganapathi Batta550b3192014-04-28 16:30:55 -070049/**
50 * Callout for handling io_capabilities response
51 */
52void btif_dm_proc_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
Myles Watson6bd442f2016-10-19 09:50:22 -070053 tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
Ganesh Ganapathi Batta550b3192014-04-28 16:30:55 -070054
55/**
The Android Open Source Project5738f832012-12-12 16:00:35 -080056 * Out-of-band functions
57 */
Myles Watson6bd442f2016-10-19 09:50:22 -070058void btif_dm_set_oob_for_io_req(tBTA_OOB_DATA* p_oob_data);
59void btif_dm_set_oob_for_le_io_req(BD_ADDR bd_addr, tBTA_OOB_DATA* p_oob_data,
60 tBTA_LE_AUTH_REQ* p_auth_req);
The Android Open Source Project5738f832012-12-12 16:00:35 -080061#ifdef BTIF_DM_OOB_TEST
62void btif_dm_load_local_oob(void);
Marie Janssenb7f64bc2016-06-22 12:52:19 -070063void btif_dm_proc_loc_oob(bool valid, BT_OCTET16 c, BT_OCTET16 r);
Myles Watson6bd442f2016-10-19 09:50:22 -070064bool btif_dm_proc_rmt_oob(BD_ADDR bd_addr, BT_OCTET16 p_c, BT_OCTET16 p_r);
The Android Open Source Project5738f832012-12-12 16:00:35 -080065#endif /* BTIF_DM_OOB_TEST */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -080066
Nitin Arora2aa2b802016-03-11 16:37:51 -080067/*callout for reading SMP properties from Text file*/
Marie Janssenb7f64bc2016-06-22 12:52:19 -070068bool btif_dm_get_smp_config(tBTE_APPL_CFG* p_cfg);
Nitin Arora2aa2b802016-03-11 16:37:51 -080069
Myles Watson6bd442f2016-10-19 09:50:22 -070070typedef struct {
71 bool is_penc_key_rcvd;
72 tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */
73 bool is_pcsrk_key_rcvd;
74 tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */
75 bool is_pid_key_rcvd;
76 tBTM_LE_PID_KEYS pid_key; /* peer device ID key */
77 bool is_lenc_key_rcvd;
78 tBTM_LE_LENC_KEYS
79 lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
80 bool is_lcsrk_key_rcvd;
81 tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
82 bool is_lidk_key_rcvd; /* local identity key received */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -080083} btif_dm_ble_cb_t;
84
Myles Watson6bd442f2016-10-19 09:50:22 -070085#define BTIF_DM_LE_KEY_PENC BTA_LE_KEY_PENC
86#define BTIF_DM_LE_KEY_PID BTA_LE_KEY_PID
87#define BTIF_DM_LE_KEY_PCSRK BTA_LE_KEY_PCSRK
88#define BTIF_DM_LE_KEY_LENC BTA_LE_KEY_LENC
89#define BTIF_DM_LE_KEY_LID BTA_LE_KEY_LID
90#define BTIF_DM_LE_KEY_LCSRK BTA_LE_KEY_LCSRK
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -080091
Myles Watson6bd442f2016-10-19 09:50:22 -070092#define BTIF_DM_LE_LOCAL_KEY_IR (1 << 0)
93#define BTIF_DM_LE_LOCAL_KEY_IRK (1 << 1)
94#define BTIF_DM_LE_LOCAL_KEY_DHK (1 << 2)
95#define BTIF_DM_LE_LOCAL_KEY_ER (1 << 3)
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -080096
97void btif_dm_load_ble_local_keys(void);
Myles Watson6bd442f2016-10-19 09:50:22 -070098void btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK* p_key_mask,
99 BT_OCTET16 er,
100 tBTA_BLE_LOCAL_ID_KEYS* p_id_keys);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800101void btif_dm_save_ble_bonding_keys(void);
102void btif_dm_remove_ble_bonding_keys(void);
Myles Watson6bd442f2016-10-19 09:50:22 -0700103void btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ* p_ble_req);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800104
Myles Watson6bd442f2016-10-19 09:50:22 -0700105void btif_dm_update_ble_remote_properties(BD_ADDR bd_addr, BD_NAME bd_name,
106 tBT_DEVICE_TYPE dev_type);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800107
The Android Open Source Project5738f832012-12-12 16:00:35 -0800108#endif