Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      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 
     22 #include "bta_api.h"
     23 #include "btif_uid.h"
     24 #include "bte_appl.h"
     25 
     26 /************************************************************************************
     27 **  Functions
     28 ********************************************************************************/
     29 
     30 void btif_dm_init(uid_set_t* set);
     31 void btif_dm_cleanup(void);
     32 
     33 /**
     34  * BTIF callback to switch context from bte to btif
     35  */
     36 void bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
     37 
     38 /**
     39  * Notify BT disable being initiated. DM may chose to abort
     40  * pending commands, like pairing
     41  */
     42 void btif_dm_on_disable(void);
     43 
     44 /**
     45  * Callout for handling io_capabilities request
     46  */
     47 void btif_dm_proc_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap, tBTA_OOB_DATA *p_oob_data,
     48                       tBTA_AUTH_REQ *p_auth_req, BOOLEAN is_orig);
     49 /**
     50  * Callout for handling io_capabilities response
     51  */
     52 void btif_dm_proc_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
     53                       tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req);
     54 
     55 /**
     56  * Out-of-band functions
     57  */
     58 void btif_dm_set_oob_for_io_req(tBTA_OOB_DATA  *p_oob_data);
     59 void 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);
     61 #ifdef BTIF_DM_OOB_TEST
     62 void btif_dm_load_local_oob(void);
     63 void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r);
     64 BOOLEAN btif_dm_proc_rmt_oob(BD_ADDR bd_addr,  BT_OCTET16 p_c, BT_OCTET16 p_r);
     65 #endif /* BTIF_DM_OOB_TEST */
     66 #if (BLE_INCLUDED == TRUE)
     67 
     68 /*callout for reading SMP properties from Text file*/
     69 BOOLEAN btif_dm_get_smp_config(tBTE_APPL_CFG* p_cfg);
     70 
     71 typedef struct
     72 {
     73     BOOLEAN                   is_penc_key_rcvd;
     74     tBTM_LE_PENC_KEYS         penc_key;       /* received peer encryption key */
     75     BOOLEAN                   is_pcsrk_key_rcvd;
     76     tBTM_LE_PCSRK_KEYS        pcsrk_key;       /* received peer device SRK */
     77     BOOLEAN                   is_pid_key_rcvd;
     78     tBTM_LE_PID_KEYS          pid_key;        /* peer device ID key */
     79     BOOLEAN                   is_lenc_key_rcvd;
     80     tBTM_LE_LENC_KEYS         lenc_key;       /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
     81     BOOLEAN                   is_lcsrk_key_rcvd;
     82     tBTM_LE_LCSRK_KEYS        lcsrk_key;      /* local device CSRK = d1(ER,DIV,1)*/
     83     BOOLEAN                   is_lidk_key_rcvd;   /* local identity key received */
     84 } btif_dm_ble_cb_t;
     85 
     86 #define BTIF_DM_LE_KEY_PENC        BTA_LE_KEY_PENC
     87 #define BTIF_DM_LE_KEY_PID         BTA_LE_KEY_PID
     88 #define BTIF_DM_LE_KEY_PCSRK       BTA_LE_KEY_PCSRK
     89 #define BTIF_DM_LE_KEY_LENC        BTA_LE_KEY_LENC
     90 #define BTIF_DM_LE_KEY_LID         BTA_LE_KEY_LID
     91 #define BTIF_DM_LE_KEY_LCSRK       BTA_LE_KEY_LCSRK
     92 
     93 #define BTIF_DM_LE_LOCAL_KEY_IR       (1<<0)
     94 #define BTIF_DM_LE_LOCAL_KEY_IRK      (1<<1)
     95 #define BTIF_DM_LE_LOCAL_KEY_DHK      (1<<2)
     96 #define BTIF_DM_LE_LOCAL_KEY_ER       (1<<3)
     97 
     98 void btif_dm_load_ble_local_keys(void);
     99 void btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
    100                                    tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
    101 void btif_dm_save_ble_bonding_keys(void);
    102 void btif_dm_remove_ble_bonding_keys(void);
    103 void btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ *p_ble_req);
    104 
    105 void btif_dm_update_ble_remote_properties( BD_ADDR bd_addr, BD_NAME bd_name,
    106                                            tBT_DEVICE_TYPE dev_type);
    107 
    108 #endif /* BLE_INCLUDED */
    109 
    110 #endif
    111