1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Generated mock file from original source file
19  *   Functions generated:50
20  */
21 
22 #include <map>
23 #include <string>
24 
25 extern std::map<std::string, int> mock_function_count_map;
26 
27 #include <cstdint>
28 #include "device/include/controller.h"
29 #include "main/shim/btm_api.h"
30 #include "main/shim/l2c_api.h"
31 #include "main/shim/shim.h"
32 #include "stack/btm/btm_dev.h"
33 #include "stack/btm/btm_int_types.h"
34 #include "stack/btm/security_device_record.h"
35 #include "stack/crypto_toolbox/crypto_toolbox.h"
36 #include "stack/include/acl_api.h"
37 #include "stack/include/bt_types.h"
38 #include "stack/include/btm_api.h"
39 #include "stack/include/btu.h"
40 #include "stack/include/gatt_api.h"
41 #include "stack/include/l2cap_security_interface.h"
42 #include "stack/include/l2cdefs.h"
43 #include "stack/include/smp_api.h"
44 #include "types/raw_address.h"
45 
46 #ifndef UNUSED_ATTR
47 #define UNUSED_ATTR
48 #endif
49 
BTM_BleDataSignature(const RawAddress & bd_addr,uint8_t * p_text,uint16_t len,BLE_SIGNATURE signature)50 bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
51                           uint16_t len, BLE_SIGNATURE signature) {
52   mock_function_count_map[__func__]++;
53   return false;
54 }
BTM_BleVerifySignature(const RawAddress & bd_addr,uint8_t * p_orig,uint16_t len,uint32_t counter,uint8_t * p_comp)55 bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
56                             uint16_t len, uint32_t counter, uint8_t* p_comp) {
57   mock_function_count_map[__func__]++;
58   return false;
59 }
BTM_ReadConnectedTransportAddress(RawAddress * remote_bda,tBT_TRANSPORT transport)60 bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
61                                        tBT_TRANSPORT transport) {
62   mock_function_count_map[__func__]++;
63   return false;
64 }
BTM_UseLeLink(const RawAddress & bd_addr)65 bool BTM_UseLeLink(const RawAddress& bd_addr) {
66   mock_function_count_map[__func__]++;
67   return false;
68 }
btm_ble_get_acl_remote_addr(uint16_t hci_handle,RawAddress & conn_addr,tBLE_ADDR_TYPE * p_addr_type)69 bool btm_ble_get_acl_remote_addr(uint16_t hci_handle, RawAddress& conn_addr,
70                                  tBLE_ADDR_TYPE* p_addr_type) {
71   mock_function_count_map[__func__]++;
72   return false;
73 }
btm_ble_get_enc_key_type(const RawAddress & bd_addr,uint8_t * p_key_types)74 bool btm_ble_get_enc_key_type(const RawAddress& bd_addr, uint8_t* p_key_types) {
75   mock_function_count_map[__func__]++;
76   return false;
77 }
btm_get_local_div(const RawAddress & bd_addr,uint16_t * p_div)78 bool btm_get_local_div(const RawAddress& bd_addr, uint16_t* p_div) {
79   mock_function_count_map[__func__]++;
80   return false;
81 }
82 static Octet16 octet16;
83 
BTM_GetDeviceDHK()84 const Octet16& BTM_GetDeviceDHK() {
85   mock_function_count_map[__func__]++;
86   return octet16;
87 }
BTM_GetDeviceEncRoot()88 const Octet16& BTM_GetDeviceEncRoot() {
89   mock_function_count_map[__func__]++;
90   return octet16;
91 }
BTM_GetDeviceIDRoot()92 const Octet16& BTM_GetDeviceIDRoot() {
93   mock_function_count_map[__func__]++;
94   return octet16;
95 }
btm_ble_determine_security_act(bool is_originator,const RawAddress & bdaddr,uint16_t security_required)96 tBTM_SEC_ACTION btm_ble_determine_security_act(bool is_originator,
97                                                const RawAddress& bdaddr,
98                                                uint16_t security_required) {
99   mock_function_count_map[__func__]++;
100   return 0;
101 }
BTM_SetBleDataLength(const RawAddress & bd_addr,uint16_t tx_pdu_length)102 tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
103                                  uint16_t tx_pdu_length) {
104   mock_function_count_map[__func__]++;
105   return 0;
106 }
btm_ble_set_encryption(const RawAddress & bd_addr,tBTM_BLE_SEC_ACT sec_act,uint8_t link_role)107 tBTM_STATUS btm_ble_set_encryption(const RawAddress& bd_addr,
108                                    tBTM_BLE_SEC_ACT sec_act,
109                                    uint8_t link_role) {
110   mock_function_count_map[__func__]++;
111   return 0;
112 }
btm_ble_start_encrypt(const RawAddress & bda,bool use_stk,Octet16 * p_stk)113 tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk,
114                                   Octet16* p_stk) {
115   mock_function_count_map[__func__]++;
116   return 0;
117 }
btm_proc_smp_cback(tSMP_EVT event,const RawAddress & bd_addr,tSMP_EVT_DATA * p_data)118 tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
119                                tSMP_EVT_DATA* p_data) {
120   mock_function_count_map[__func__]++;
121   return 0;
122 }
btm_ble_start_sec_check(const RawAddress & bd_addr,uint16_t psm,bool is_originator,tBTM_SEC_CALLBACK * p_callback,void * p_ref_data)123 tL2CAP_LE_RESULT_CODE btm_ble_start_sec_check(const RawAddress& bd_addr,
124                                               uint16_t psm, bool is_originator,
125                                               tBTM_SEC_CALLBACK* p_callback,
126                                               void* p_ref_data) {
127   mock_function_count_map[__func__]++;
128   return L2CAP_LE_RESULT_CONN_OK;
129 }
btm_ble_br_keys_req(tBTM_SEC_DEV_REC * p_dev_rec,tBTM_LE_IO_REQ * p_data)130 uint8_t btm_ble_br_keys_req(tBTM_SEC_DEV_REC* p_dev_rec,
131                             tBTM_LE_IO_REQ* p_data) {
132   mock_function_count_map[__func__]++;
133   return 0;
134 }
btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC * p_dev_rec,tBTM_LE_IO_REQ * p_data)135 uint8_t btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC* p_dev_rec,
136                                     tBTM_LE_IO_REQ* p_data) {
137   mock_function_count_map[__func__]++;
138   return 0;
139 }
btm_ble_read_sec_key_size(const RawAddress & bd_addr)140 uint8_t btm_ble_read_sec_key_size(const RawAddress& bd_addr) {
141   mock_function_count_map[__func__]++;
142   return 0;
143 }
BTM_BleConfirmReply(const RawAddress & bd_addr,uint8_t res)144 void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res) {
145   mock_function_count_map[__func__]++;
146 }
BTM_BleLoadLocalKeys(uint8_t key_type,tBTM_BLE_LOCAL_KEYS * p_key)147 void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key) {
148   mock_function_count_map[__func__]++;
149 }
BTM_BleOobDataReply(const RawAddress & bd_addr,uint8_t res,uint8_t len,uint8_t * p_data)150 void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
151                          uint8_t* p_data) {
152   mock_function_count_map[__func__]++;
153 }
BTM_BlePasskeyReply(const RawAddress & bd_addr,uint8_t res,uint32_t passkey)154 void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
155                          uint32_t passkey) {
156   mock_function_count_map[__func__]++;
157 }
BTM_BleReadPhy(const RawAddress & bd_addr,base::Callback<void (uint8_t tx_phy,uint8_t rx_phy,uint8_t status)> cb)158 void BTM_BleReadPhy(
159     const RawAddress& bd_addr,
160     base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
161   mock_function_count_map[__func__]++;
162 }
BTM_BleReceiverTest(uint8_t rx_freq,tBTM_CMPL_CB * p_cmd_cmpl_cback)163 void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback) {
164   mock_function_count_map[__func__]++;
165 }
BTM_BleSecureConnectionOobDataReply(const RawAddress & bd_addr,uint8_t * p_c,uint8_t * p_r)166 void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
167                                          uint8_t* p_c, uint8_t* p_r) {
168   mock_function_count_map[__func__]++;
169 }
BTM_BleSetPhy(const RawAddress & bd_addr,uint8_t tx_phys,uint8_t rx_phys,uint16_t phy_options)170 void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
171                    uint16_t phy_options) {
172   mock_function_count_map[__func__]++;
173 }
BTM_BleSetPrefConnParams(const RawAddress & bd_addr,uint16_t min_conn_int,uint16_t max_conn_int,uint16_t peripheral_latency,uint16_t supervision_tout)174 void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, uint16_t min_conn_int,
175                               uint16_t max_conn_int,
176                               uint16_t peripheral_latency,
177                               uint16_t supervision_tout) {
178   mock_function_count_map[__func__]++;
179 }
BTM_BleTestEnd(tBTM_CMPL_CB * p_cmd_cmpl_cback)180 void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback) {
181   mock_function_count_map[__func__]++;
182 }
BTM_BleTransmitterTest(uint8_t tx_freq,uint8_t test_data_len,uint8_t packet_payload,tBTM_CMPL_CB * p_cmd_cmpl_cback)183 void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
184                             uint8_t packet_payload,
185                             tBTM_CMPL_CB* p_cmd_cmpl_cback) {
186   mock_function_count_map[__func__]++;
187 }
BTM_ReadDevInfo(const RawAddress & remote_bda,tBT_DEVICE_TYPE * p_dev_type,tBLE_ADDR_TYPE * p_addr_type)188 void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
189                      tBLE_ADDR_TYPE* p_addr_type) {
190   mock_function_count_map[__func__]++;
191 }
BTM_SecAddBleDevice(const RawAddress & bd_addr,tBT_DEVICE_TYPE dev_type,tBLE_ADDR_TYPE addr_type)192 void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
193                          tBLE_ADDR_TYPE addr_type) {
194   mock_function_count_map[__func__]++;
195 }
BTM_SecAddBleKey(const RawAddress & bd_addr,tBTM_LE_KEY_VALUE * p_le_key,tBTM_LE_KEY_TYPE key_type)196 void BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
197                       tBTM_LE_KEY_TYPE key_type) {
198   mock_function_count_map[__func__]++;
199 }
BTM_SecurityGrant(const RawAddress & bd_addr,uint8_t res)200 void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res) {
201   mock_function_count_map[__func__]++;
202 }
btm_ble_connected(const RawAddress & bda,uint16_t handle,uint8_t enc_mode,uint8_t role,tBLE_ADDR_TYPE addr_type,bool addr_matched)203 void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
204                        uint8_t role, tBLE_ADDR_TYPE addr_type,
205                        bool addr_matched) {
206   mock_function_count_map[__func__]++;
207 }
btm_ble_connected_from_address_with_type(const tBLE_BD_ADDR & address_with_type,uint16_t handle,uint8_t enc_mode,uint8_t role,bool addr_matched)208 void btm_ble_connected_from_address_with_type(
209     const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t enc_mode,
210     uint8_t role, bool addr_matched) {
211   mock_function_count_map[__func__]++;
212 }
btm_ble_increment_sign_ctr(const RawAddress & bd_addr,bool is_local)213 void btm_ble_increment_sign_ctr(const RawAddress& bd_addr, bool is_local) {
214   mock_function_count_map[__func__]++;
215 }
btm_ble_link_encrypted(const RawAddress & bd_addr,uint8_t encr_enable)216 void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {
217   mock_function_count_map[__func__]++;
218 }
btm_ble_link_sec_check(const RawAddress & bd_addr,tBTM_LE_AUTH_REQ auth_req,tBTM_BLE_SEC_REQ_ACT * p_sec_req_act)219 void btm_ble_link_sec_check(const RawAddress& bd_addr,
220                             tBTM_LE_AUTH_REQ auth_req,
221                             tBTM_BLE_SEC_REQ_ACT* p_sec_req_act) {
222   mock_function_count_map[__func__]++;
223 }
btm_ble_ltk_request(uint16_t handle,uint8_t rand[8],uint16_t ediv)224 void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv) {
225   mock_function_count_map[__func__]++;
226 }
btm_ble_ltk_request_reply(const RawAddress & bda,bool use_stk,const Octet16 & stk)227 void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk,
228                                const Octet16& stk) {
229   mock_function_count_map[__func__]++;
230 }
btm_ble_rand_enc_complete(uint8_t * p,uint16_t op_code,tBTM_RAND_ENC_CB * p_enc_cplt_cback)231 void btm_ble_rand_enc_complete(uint8_t* p, uint16_t op_code,
232                                tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
233   mock_function_count_map[__func__]++;
234 }
btm_ble_set_random_address(const RawAddress & random_bda)235 void btm_ble_set_random_address(const RawAddress& random_bda) {
236   mock_function_count_map[__func__]++;
237 }
btm_ble_test_command_complete(uint8_t * p)238 void btm_ble_test_command_complete(uint8_t* p) {
239   mock_function_count_map[__func__]++;
240 }
btm_ble_update_sec_key_size(const RawAddress & bd_addr,uint8_t enc_key_size)241 void btm_ble_update_sec_key_size(const RawAddress& bd_addr,
242                                  uint8_t enc_key_size) {
243   mock_function_count_map[__func__]++;
244 }
btm_sec_save_le_key(const RawAddress & bd_addr,tBTM_LE_KEY_TYPE key_type,tBTM_LE_KEY_VALUE * p_keys,bool pass_to_application)245 void btm_sec_save_le_key(const RawAddress& bd_addr, tBTM_LE_KEY_TYPE key_type,
246                          tBTM_LE_KEY_VALUE* p_keys, bool pass_to_application) {
247   mock_function_count_map[__func__]++;
248 }
doNothing(uint8_t * data,uint16_t len)249 void doNothing(uint8_t* data, uint16_t len) {
250   mock_function_count_map[__func__]++;
251 }
read_phy_cb(base::Callback<void (uint8_t tx_phy,uint8_t rx_phy,uint8_t status)> cb,uint8_t * data,uint16_t len)252 void read_phy_cb(
253     base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb,
254     uint8_t* data, uint16_t len) {
255   mock_function_count_map[__func__]++;
256 }
btm_ble_reset_id(void)257 void btm_ble_reset_id(void) {
258   mock_function_count_map[__func__]++;
259 }
260