summaryrefslogtreecommitdiff
path: root/system/test/mock/mock_stack_btm_sec.cc
blob: 56a0db187b527264a2ed0739803a107e7148f868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/*
 * Copyright 2021 The Android Open Source Project
 *
 * 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.
 */

/*
 * Generated mock file from original source file
 *   Functions generated:66
 */

#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

#include <base/strings/stringprintf.h>
#include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h>
#include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h>
#include <string.h>

#include "btif/include/btif_storage.h"
#include "common/metrics.h"
#include "common/time_util.h"
#include "device/include/controller.h"
#include "l2c_api.h"
#include "main/shim/btm_api.h"
#include "main/shim/dumpsys.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/acl_api.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/btm_status.h"
#include "stack/include/l2cap_security_interface.h"
#include "stack/smp/smp_int.h"
#include "test/mock/mock_stack_btm_sec.h"
#include "types/raw_address.h"

#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
                                     uint8_t* p_sec_flags,
                                     tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_IsAuthenticated(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_IsEncrypted(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_IsLinkKeyAuthed(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return false;
}
tBT_DEVICE_TYPE BTM_GetPeerDeviceTypeFromFeatures(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return BT_DEVICE_TYPE_BREDR;
}
bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_SecDeleteRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_SecIsSecurityPending(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_SetSecurityLevel(bool is_originator, const char* p_name,
                          uint8_t service_id, uint16_t sec_level, uint16_t psm,
                          uint32_t mx_proto_id, uint32_t mx_chan_id) {
  mock_function_count_map[__func__]++;
  return false;
}
bool btm_sec_is_a_bonded_dev(const RawAddress& bda) {
  mock_function_count_map[__func__]++;
  return false;
}
bool is_sec_state_equal(void* data, void* context) {
  mock_function_count_map[__func__]++;
  return false;
}
bool is_state_getting_name(void* data, void* context) {
  mock_function_count_map[__func__]++;
  return false;
}
const uint8_t* btm_get_dev_class(const RawAddress& bda) {
  mock_function_count_map[__func__]++;
  return nullptr;
}
tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return 0;
}
tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) {
  mock_function_count_map[__func__]++;
  return nullptr;
}
tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm) {
  mock_function_count_map[__func__]++;
  return nullptr;
}
tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                        tBT_TRANSPORT transport, tBT_DEVICE_TYPE device_type,
                        uint8_t pin_len, uint8_t* p_pin) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
namespace test {
namespace mock {
namespace stack_btm_sec {

struct BTM_SetEncryption BTM_SetEncryption;

}
}  // namespace mock
}  // namespace test

tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
                              tBT_TRANSPORT transport,
                              tBTM_SEC_CALLBACK* p_callback, void* p_ref_data,
                              tBTM_BLE_SEC_ACT sec_act) {
  mock_function_count_map[__func__]++;
  if (test::mock::stack_btm_sec::BTM_SetEncryption.body) {
    return test::mock::stack_btm_sec::BTM_SetEncryption.body(
        bd_addr, transport, p_callback, p_ref_data, sec_act);
  }
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
                                      tBLE_ADDR_TYPE addr_type,
                                      tBT_TRANSPORT transport, uint8_t pin_len,
                                      uint8_t* p_pin) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason,
                               std::string comment) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_l2cap_access_req(const RawAddress& bd_addr, uint16_t psm,
                                     bool is_originator,
                                     tBTM_SEC_CALLBACK* p_callback,
                                     void* p_ref_data) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(
    const RawAddress& bd_addr, uint16_t security_required, bool is_originator,
    tBTM_SEC_CALLBACK* p_callback, void* p_ref_data) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr,
                                      bool is_originator,
                                      uint16_t security_required,
                                      tBTM_SEC_CALLBACK* p_callback,
                                      void* p_ref_data) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
uint16_t BTM_GetClockOffset(const RawAddress& remote_bda) {
  mock_function_count_map[__func__]++;
  return 0;
}
uint8_t BTM_SecClrService(uint8_t service_id) {
  mock_function_count_map[__func__]++;
  return 0;
}
uint8_t BTM_SecClrServiceByPsm(uint16_t psm) {
  mock_function_count_map[__func__]++;
  return 0;
}
void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
}
void BTM_PINCodeReply(const RawAddress& bd_addr, tBTM_STATUS res,
                      uint8_t pin_len, uint8_t* p_pin) {
  mock_function_count_map[__func__]++;
}
void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr,
                         uint32_t passkey) {
  mock_function_count_map[__func__]++;
}
void BTM_ReadLocalOobData(void) { mock_function_count_map[__func__]++; }
void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr,
                            const Octet16& c, const Octet16& r) {
  mock_function_count_map[__func__]++;
}
void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len) {
  mock_function_count_map[__func__]++;
}
void NotifyBondingCanceled(tBTM_STATUS btm_status) {
  mock_function_count_map[__func__]++;
}
void btm_create_conn_cancel_complete(const uint8_t* p) {
  mock_function_count_map[__func__]++;
}
void btm_io_capabilities_req(const RawAddress& p) {
  mock_function_count_map[__func__]++;
}
void btm_io_capabilities_rsp(const uint8_t* p) {
  mock_function_count_map[__func__]++;
}
void btm_proc_sp_req_evt(tBTM_SP_EVT event, const uint8_t* p) {
  mock_function_count_map[__func__]++;
}
void btm_read_local_oob_complete(uint8_t* p) {
  mock_function_count_map[__func__]++;
}
void btm_rem_oob_req(const uint8_t* p) { mock_function_count_map[__func__]++; }
void btm_sec_abort_access_req(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
}
void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
  mock_function_count_map[__func__]++;
}
void btm_sec_check_pending_reqs(void) { mock_function_count_map[__func__]++; }
void btm_sec_clear_ble_keys(tBTM_SEC_DEV_REC* p_dev_rec) {
  mock_function_count_map[__func__]++;
}
void btm_sec_conn_req(const RawAddress& bda, uint8_t* dc) {
  mock_function_count_map[__func__]++;
}
void btm_sec_connected(const RawAddress& bda, uint16_t handle,
                       tHCI_STATUS status, uint8_t enc_mode,
                       tHCI_ROLE assigned_role) {
  mock_function_count_map[__func__]++;
}
void btm_sec_dev_rec_cback_event(tBTM_SEC_DEV_REC* p_dev_rec,
                                 tBTM_STATUS btm_status, bool is_le_transport) {
  mock_function_count_map[__func__]++;
}
void btm_sec_dev_reset(void) { mock_function_count_map[__func__]++; }
void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason,
                          std::string comment) {
  mock_function_count_map[__func__]++;
}
void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
                            uint8_t encr_enable) {
  mock_function_count_map[__func__]++;
}
void btm_sec_link_key_notification(const RawAddress& p_bda,
                                   const Octet16& link_key, uint8_t key_type) {
  mock_function_count_map[__func__]++;
}
void btm_sec_link_key_request(const uint8_t* p_event) {
  mock_function_count_map[__func__]++;
}
void btm_sec_pin_code_request(const uint8_t* p_event) {
  mock_function_count_map[__func__]++;
}
void btm_sec_rmt_host_support_feat_evt(const uint8_t* p) {
  mock_function_count_map[__func__]++;
}
void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
                                       const uint8_t* p_bd_name,
                                       tHCI_STATUS status) {
  mock_function_count_map[__func__]++;
}
void btm_sec_set_peer_sec_caps(uint16_t hci_handle, bool ssp_supported,
                               bool sc_supported,
                               bool hci_role_switch_supported,
                               bool br_edr_supported, bool le_supported) {
  mock_function_count_map[__func__]++;
}
void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) {
  mock_function_count_map[__func__]++;
}
void btm_simple_pair_complete(const uint8_t* p) {
  mock_function_count_map[__func__]++;
}