summaryrefslogtreecommitdiff
path: root/system/test/mock/mock_stack_l2cap_api.cc
blob: 96d4eefd2c9eb7b718f1209d306ce1635df38f0a (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
/*
 * 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:33
 *
 *  mockcify.pl ver 0.2
 */

#include <map>
#include <string>

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

// Original included files, if any
// NOTE: Since this is a mock file with mock definitions some number of
//       include files may not be required.  The include-what-you-use
//       still applies, but crafting proper inclusion is out of scope
//       for this effort.  This compilation unit may compile as-is, or
//       may need attention to prune the inclusion set.
#include <base/logging.h>
#include <base/strings/stringprintf.h>

#include <cstdint>
#include <string>

#include "device/include/controller.h"
#include "main/shim/l2c_api.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/l2c_api.h"
#include "stack/l2cap/l2c_int.h"
#include "types/raw_address.h"

// Mock include file to share data between tests and mock
#include "test/mock/mock_stack_l2cap_api.h"

// Mocked compile conditionals, if any
#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

// Mocked internal structures, if any

namespace test {
namespace mock {
namespace stack_l2cap_api {

// Function state capture and return values, if needed
struct l2c_get_transport_from_fixed_cid l2c_get_transport_from_fixed_cid;
struct L2CA_Register2 L2CA_Register2;
struct L2CA_Register L2CA_Register;
struct L2CA_Deregister L2CA_Deregister;
struct L2CA_AllocateLePSM L2CA_AllocateLePSM;
struct L2CA_FreeLePSM L2CA_FreeLePSM;
struct L2CA_ConnectReq2 L2CA_ConnectReq2;
struct L2CA_ConnectReq L2CA_ConnectReq;
struct L2CA_RegisterLECoc L2CA_RegisterLECoc;
struct L2CA_DeregisterLECoc L2CA_DeregisterLECoc;
struct L2CA_ConnectLECocReq L2CA_ConnectLECocReq;
struct L2CA_GetPeerLECocConfig L2CA_GetPeerLECocConfig;
struct L2CA_ConnectCreditBasedRsp L2CA_ConnectCreditBasedRsp;
struct L2CA_ConnectCreditBasedReq L2CA_ConnectCreditBasedReq;
struct L2CA_ReconfigCreditBasedConnsReq L2CA_ReconfigCreditBasedConnsReq;
struct L2CA_DisconnectReq L2CA_DisconnectReq;
struct L2CA_DisconnectLECocReq L2CA_DisconnectLECocReq;
struct L2CA_GetRemoteCid L2CA_GetRemoteCid;
struct L2CA_SetIdleTimeoutByBdAddr L2CA_SetIdleTimeoutByBdAddr;
struct L2CA_SetTraceLevel L2CA_SetTraceLevel;
struct L2CA_SetAclPriority L2CA_SetAclPriority;
struct L2CA_SetTxPriority L2CA_SetTxPriority;
struct L2CA_GetPeerFeatures L2CA_GetPeerFeatures;
struct L2CA_RegisterFixedChannel L2CA_RegisterFixedChannel;
struct L2CA_ConnectFixedChnl L2CA_ConnectFixedChnl;
struct L2CA_SendFixedChnlData L2CA_SendFixedChnlData;
struct L2CA_RemoveFixedChnl L2CA_RemoveFixedChnl;
struct L2CA_SetLeGattTimeout L2CA_SetLeGattTimeout;
struct L2CA_DataWrite L2CA_DataWrite;
struct L2CA_LECocDataWrite L2CA_LECocDataWrite;
struct L2CA_SetChnlFlushability L2CA_SetChnlFlushability;
struct L2CA_FlushChannel L2CA_FlushChannel;
struct L2CA_IsLinkEstablished L2CA_IsLinkEstablished;

}  // namespace stack_l2cap_api
}  // namespace mock
}  // namespace test

// Mocked functions, if any
tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::l2c_get_transport_from_fixed_cid(
      fixed_cid);
}
uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
                        bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
                        uint16_t my_mtu, uint16_t required_remote_mtu,
                        uint16_t sec_level) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_Register2(
      psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu,
      sec_level);
}
uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
                       bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
                       uint16_t my_mtu, uint16_t required_remote_mtu,
                       uint16_t sec_level) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_Register(
      psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu,
      sec_level);
}
void L2CA_Deregister(uint16_t psm) {
  mock_function_count_map[__func__]++;
  test::mock::stack_l2cap_api::L2CA_Deregister(psm);
}
uint16_t L2CA_AllocateLePSM(void) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_AllocateLePSM();
}
void L2CA_FreeLePSM(uint16_t psm) {
  mock_function_count_map[__func__]++;
  test::mock::stack_l2cap_api::L2CA_FreeLePSM(psm);
}
uint16_t L2CA_ConnectReq2(uint16_t psm, const RawAddress& p_bd_addr,
                          uint16_t sec_level) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectReq2(psm, p_bd_addr,
                                                       sec_level);
}
uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectReq(psm, p_bd_addr);
}
uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
                            uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_RegisterLECoc(psm, p_cb_info,
                                                         sec_level, cfg);
}
void L2CA_DeregisterLECoc(uint16_t psm) {
  mock_function_count_map[__func__]++;
  test::mock::stack_l2cap_api::L2CA_DeregisterLECoc(psm);
}
uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
                              tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectLECocReq(psm, p_bd_addr,
                                                           p_cfg, sec_level);
}
bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_GetPeerLECocConfig(lcid, peer_cfg);
}
bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
                                std::vector<uint16_t>& accepted_lcids,
                                uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedRsp(
      p_bd_addr, id, accepted_lcids, result, p_cfg);
}
std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
                                                 const RawAddress& p_bd_addr,
                                                 tL2CAP_LE_CFG_INFO* p_cfg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedReq(psm, p_bd_addr,
                                                                 p_cfg);
}
bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda,
                                      std::vector<uint16_t>& lcids,
                                      tL2CAP_LE_CFG_INFO* p_cfg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ReconfigCreditBasedConnsReq(
      bda, lcids, p_cfg);
}
bool L2CA_DisconnectReq(uint16_t cid) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_DisconnectReq(cid);
}
bool L2CA_DisconnectLECocReq(uint16_t cid) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_DisconnectLECocReq(cid);
}
bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_GetRemoteCid(lcid, rcid);
}
bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
                                 tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetIdleTimeoutByBdAddr(
      bd_addr, timeout, transport);
}
uint8_t L2CA_SetTraceLevel(uint8_t new_level) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetTraceLevel(new_level);
}
bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetAclPriority(bd_addr, priority);
}
bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetTxPriority(cid, priority);
}
bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
                          uint8_t* p_chnl_mask) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_GetPeerFeatures(bd_addr, p_ext_feat,
                                                           p_chnl_mask);
}
bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,
                               tL2CAP_FIXED_CHNL_REG* p_freg) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel(fixed_cid,
                                                                p_freg);
}
bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_ConnectFixedChnl(fixed_cid, rem_bda);
}
uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
                                BT_HDR* p_buf) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SendFixedChnlData(fixed_cid, rem_bda,
                                                             p_buf);
}
bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_RemoveFixedChnl(fixed_cid, rem_bda);
}
bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetLeGattTimeout(rem_bda, idle_tout);
}
uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_DataWrite(cid, p_data);
}
uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_LECocDataWrite(cid, p_data);
}
bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_SetChnlFlushability(cid,
                                                               is_flushable);
}
uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_FlushChannel(lcid, num_to_flush);
}
bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
                            tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return test::mock::stack_l2cap_api::L2CA_IsLinkEstablished(bd_addr,
                                                             transport);
}

// END mockcify generation