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:33
20  *
21  *  mockcify.pl ver 0.2
22  */
23 #include "test/mock/mock_stack_l2cap_api.h"
24 
25 // Original included files, if any
26 
27 #include "test/common/mock_functions.h"
28 
29 // Mocked compile conditionals, if any
30 // Mocked internal structures, if any
31 
32 // TODO(b/369381361) Enfore -Wmissing-prototypes
33 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
34 
35 namespace test {
36 namespace mock {
37 namespace stack_l2cap_api {
38 
39 // Function state capture and return values, if needed
40 struct L2CA_RegisterWithSecurity L2CA_RegisterWithSecurity;
41 struct L2CA_Register L2CA_Register;
42 struct L2CA_Deregister L2CA_Deregister;
43 struct L2CA_AllocateLePSM L2CA_AllocateLePSM;
44 struct L2CA_FreeLePSM L2CA_FreeLePSM;
45 struct L2CA_ConnectReqWithSecurity L2CA_ConnectReqWithSecurity;
46 struct L2CA_ConnectReq L2CA_ConnectReq;
47 struct L2CA_RegisterLECoc L2CA_RegisterLECoc;
48 struct L2CA_DeregisterLECoc L2CA_DeregisterLECoc;
49 struct L2CA_ConnectLECocReq L2CA_ConnectLECocReq;
50 struct L2CA_GetPeerLECocConfig L2CA_GetPeerLECocConfig;
51 struct L2CA_ConnectCreditBasedRsp L2CA_ConnectCreditBasedRsp;
52 struct L2CA_ConnectCreditBasedReq L2CA_ConnectCreditBasedReq;
53 struct L2CA_ReconfigCreditBasedConnsReq L2CA_ReconfigCreditBasedConnsReq;
54 struct L2CA_DisconnectReq L2CA_DisconnectReq;
55 struct L2CA_DisconnectLECocReq L2CA_DisconnectLECocReq;
56 struct L2CA_GetRemoteChannelId L2CA_GetRemoteChannelId;
57 struct L2CA_SetIdleTimeoutByBdAddr L2CA_SetIdleTimeoutByBdAddr;
58 struct L2CA_UseLatencyMode L2CA_UseLatencyMode;
59 struct L2CA_SetAclPriority L2CA_SetAclPriority;
60 struct L2CA_SetAclLatency L2CA_SetAclLatency;
61 struct L2CA_SetTxPriority L2CA_SetTxPriority;
62 struct L2CA_GetPeerFeatures L2CA_GetPeerFeatures;
63 struct L2CA_RegisterFixedChannel L2CA_RegisterFixedChannel;
64 struct L2CA_ConnectFixedChnl L2CA_ConnectFixedChnl;
65 struct L2CA_SendFixedChnlData L2CA_SendFixedChnlData;
66 struct L2CA_RemoveFixedChnl L2CA_RemoveFixedChnl;
67 struct L2CA_SetLeGattTimeout L2CA_SetLeGattTimeout;
68 struct L2CA_MarkLeLinkAsActive L2CA_MarkLeLinkAsActive;
69 struct L2CA_DataWrite L2CA_DataWrite;
70 struct L2CA_LECocDataWrite L2CA_LECocDataWrite;
71 struct L2CA_SetChnlFlushability L2CA_SetChnlFlushability;
72 struct L2CA_FlushChannel L2CA_FlushChannel;
73 struct L2CA_IsLinkEstablished L2CA_IsLinkEstablished;
74 struct L2CA_SetMediaStreamChannel L2CA_SetMediaStreamChannel;
75 struct L2CA_isMediaChannel L2CA_isMediaChannel;
76 struct L2CA_LeCreditDefault L2CA_LeCreditDefault;
77 struct L2CA_LeCreditThreshold L2CA_LeCreditThreshold;
78 struct L2CA_GetAclHandle L2CA_GetAclHandle;
79 
80 }  // namespace stack_l2cap_api
81 }  // namespace mock
82 }  // namespace test
83 
84 // Mocked functions, if any
L2CA_RegisterWithSecurity(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)85 uint16_t L2CA_RegisterWithSecurity(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
86                                    bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
87                                    uint16_t my_mtu, uint16_t required_remote_mtu,
88                                    uint16_t sec_level) {
89   inc_func_call_count(__func__);
90   return test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity(
91           psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu, sec_level);
92 }
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)93 uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop,
94                        tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu,
95                        uint16_t sec_level) {
96   inc_func_call_count(__func__);
97   return test::mock::stack_l2cap_api::L2CA_Register(psm, p_cb_info, enable_snoop, p_ertm_info,
98                                                     my_mtu, required_remote_mtu, sec_level);
99 }
L2CA_Deregister(uint16_t psm)100 void L2CA_Deregister(uint16_t psm) {
101   inc_func_call_count(__func__);
102   test::mock::stack_l2cap_api::L2CA_Deregister(psm);
103 }
L2CA_AllocateLePSM(void)104 uint16_t L2CA_AllocateLePSM(void) {
105   inc_func_call_count(__func__);
106   return test::mock::stack_l2cap_api::L2CA_AllocateLePSM();
107 }
L2CA_FreeLePSM(uint16_t psm)108 void L2CA_FreeLePSM(uint16_t psm) {
109   inc_func_call_count(__func__);
110   test::mock::stack_l2cap_api::L2CA_FreeLePSM(psm);
111 }
L2CA_ConnectReqWithSecurity(uint16_t psm,const RawAddress & p_bd_addr,uint16_t sec_level)112 uint16_t L2CA_ConnectReqWithSecurity(uint16_t psm, const RawAddress& p_bd_addr,
113                                      uint16_t sec_level) {
114   inc_func_call_count(__func__);
115   return test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity(psm, p_bd_addr, sec_level);
116 }
L2CA_ConnectReq(uint16_t psm,const RawAddress & p_bd_addr)117 uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) {
118   inc_func_call_count(__func__);
119   return test::mock::stack_l2cap_api::L2CA_ConnectReq(psm, p_bd_addr);
120 }
L2CA_RegisterLECoc(uint16_t psm,const tL2CAP_APPL_INFO & p_cb_info,uint16_t sec_level,tL2CAP_LE_CFG_INFO cfg)121 uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, uint16_t sec_level,
122                             tL2CAP_LE_CFG_INFO cfg) {
123   inc_func_call_count(__func__);
124   return test::mock::stack_l2cap_api::L2CA_RegisterLECoc(psm, p_cb_info, sec_level, cfg);
125 }
L2CA_DeregisterLECoc(uint16_t psm)126 void L2CA_DeregisterLECoc(uint16_t psm) {
127   inc_func_call_count(__func__);
128   test::mock::stack_l2cap_api::L2CA_DeregisterLECoc(psm);
129 }
L2CA_ConnectLECocReq(uint16_t psm,const RawAddress & p_bd_addr,tL2CAP_LE_CFG_INFO * p_cfg,uint16_t sec_level)130 uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg,
131                               uint16_t sec_level) {
132   inc_func_call_count(__func__);
133   return test::mock::stack_l2cap_api::L2CA_ConnectLECocReq(psm, p_bd_addr, p_cfg, sec_level);
134 }
L2CA_GetPeerLECocConfig(uint16_t lcid,tL2CAP_LE_CFG_INFO * peer_cfg)135 bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
136   inc_func_call_count(__func__);
137   return test::mock::stack_l2cap_api::L2CA_GetPeerLECocConfig(lcid, peer_cfg);
138 }
L2CA_ConnectCreditBasedRsp(const RawAddress & p_bd_addr,uint8_t id,std::vector<uint16_t> & accepted_lcids,tL2CAP_LE_RESULT_CODE result,tL2CAP_LE_CFG_INFO * p_cfg)139 bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
140                                 std::vector<uint16_t>& accepted_lcids, tL2CAP_LE_RESULT_CODE result,
141                                 tL2CAP_LE_CFG_INFO* p_cfg) {
142   inc_func_call_count(__func__);
143   return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedRsp(p_bd_addr, id, accepted_lcids,
144                                                                  result, p_cfg);
145 }
L2CA_ConnectCreditBasedReq(uint16_t psm,const RawAddress & p_bd_addr,tL2CAP_LE_CFG_INFO * p_cfg)146 std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm, const RawAddress& p_bd_addr,
147                                                  tL2CAP_LE_CFG_INFO* p_cfg) {
148   inc_func_call_count(__func__);
149   return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedReq(psm, p_bd_addr, p_cfg);
150 }
L2CA_ReconfigCreditBasedConnsReq(const RawAddress & bda,std::vector<uint16_t> & lcids,tL2CAP_LE_CFG_INFO * p_cfg)151 bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda, std::vector<uint16_t>& lcids,
152                                       tL2CAP_LE_CFG_INFO* p_cfg) {
153   inc_func_call_count(__func__);
154   return test::mock::stack_l2cap_api::L2CA_ReconfigCreditBasedConnsReq(bda, lcids, p_cfg);
155 }
L2CA_DisconnectReq(uint16_t cid)156 bool L2CA_DisconnectReq(uint16_t cid) {
157   inc_func_call_count(__func__);
158   return test::mock::stack_l2cap_api::L2CA_DisconnectReq(cid);
159 }
L2CA_DisconnectLECocReq(uint16_t cid)160 bool L2CA_DisconnectLECocReq(uint16_t cid) {
161   inc_func_call_count(__func__);
162   return test::mock::stack_l2cap_api::L2CA_DisconnectLECocReq(cid);
163 }
L2CA_GetRemoteChannelId(uint16_t lcid,uint16_t * rcid)164 bool L2CA_GetRemoteChannelId(uint16_t lcid, uint16_t* rcid) {
165   inc_func_call_count(__func__);
166   return test::mock::stack_l2cap_api::L2CA_GetRemoteChannelId(lcid, rcid);
167 }
L2CA_SetIdleTimeoutByBdAddr(const RawAddress & bd_addr,uint16_t timeout,tBT_TRANSPORT transport)168 bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
169                                  tBT_TRANSPORT transport) {
170   inc_func_call_count(__func__);
171   return test::mock::stack_l2cap_api::L2CA_SetIdleTimeoutByBdAddr(bd_addr, timeout, transport);
172 }
L2CA_UseLatencyMode(const RawAddress & bd_addr,bool use_latency_mode)173 bool L2CA_UseLatencyMode(const RawAddress& bd_addr, bool use_latency_mode) {
174   inc_func_call_count(__func__);
175   return test::mock::stack_l2cap_api::L2CA_UseLatencyMode(bd_addr, use_latency_mode);
176 }
L2CA_SetAclPriority(const RawAddress & bd_addr,tL2CAP_PRIORITY priority)177 bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
178   inc_func_call_count(__func__);
179   return test::mock::stack_l2cap_api::L2CA_SetAclPriority(bd_addr, priority);
180 }
L2CA_SetAclLatency(const RawAddress & bd_addr,tL2CAP_LATENCY latency)181 bool L2CA_SetAclLatency(const RawAddress& bd_addr, tL2CAP_LATENCY latency) {
182   inc_func_call_count(__func__);
183   return test::mock::stack_l2cap_api::L2CA_SetAclLatency(bd_addr, latency);
184 }
L2CA_SetTxPriority(uint16_t cid,tL2CAP_CHNL_PRIORITY priority)185 bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
186   inc_func_call_count(__func__);
187   return test::mock::stack_l2cap_api::L2CA_SetTxPriority(cid, priority);
188 }
L2CA_GetPeerFeatures(const RawAddress & bd_addr,uint32_t * p_ext_feat,uint8_t * p_chnl_mask)189 bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat, uint8_t* p_chnl_mask) {
190   inc_func_call_count(__func__);
191   return test::mock::stack_l2cap_api::L2CA_GetPeerFeatures(bd_addr, p_ext_feat, p_chnl_mask);
192 }
L2CA_RegisterFixedChannel(uint16_t fixed_cid,tL2CAP_FIXED_CHNL_REG * p_freg)193 bool L2CA_RegisterFixedChannel(uint16_t fixed_cid, tL2CAP_FIXED_CHNL_REG* p_freg) {
194   inc_func_call_count(__func__);
195   return test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel(fixed_cid, p_freg);
196 }
L2CA_ConnectFixedChnl(uint16_t fixed_cid,const RawAddress & rem_bda)197 bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
198   inc_func_call_count(__func__);
199   return test::mock::stack_l2cap_api::L2CA_ConnectFixedChnl(fixed_cid, rem_bda);
200 }
L2CA_SendFixedChnlData(uint16_t fixed_cid,const RawAddress & rem_bda,BT_HDR * p_buf)201 tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
202                                         BT_HDR* p_buf) {
203   inc_func_call_count(__func__);
204   return test::mock::stack_l2cap_api::L2CA_SendFixedChnlData(fixed_cid, rem_bda, p_buf);
205 }
L2CA_RemoveFixedChnl(uint16_t fixed_cid,const RawAddress & rem_bda)206 bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
207   inc_func_call_count(__func__);
208   return test::mock::stack_l2cap_api::L2CA_RemoveFixedChnl(fixed_cid, rem_bda);
209 }
L2CA_SetLeGattTimeout(const RawAddress & rem_bda,uint16_t idle_tout)210 bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
211   inc_func_call_count(__func__);
212   return test::mock::stack_l2cap_api::L2CA_SetLeGattTimeout(rem_bda, idle_tout);
213 }
L2CA_MarkLeLinkAsActive(const RawAddress & rem_bda)214 bool L2CA_MarkLeLinkAsActive(const RawAddress& rem_bda) {
215   inc_func_call_count(__func__);
216   return test::mock::stack_l2cap_api::L2CA_MarkLeLinkAsActive(rem_bda);
217 }
L2CA_DataWrite(uint16_t cid,BT_HDR * p_data)218 tL2CAP_DW_RESULT L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
219   inc_func_call_count(__func__);
220   return test::mock::stack_l2cap_api::L2CA_DataWrite(cid, p_data);
221 }
L2CA_LECocDataWrite(uint16_t cid,BT_HDR * p_data)222 tL2CAP_DW_RESULT L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
223   inc_func_call_count(__func__);
224   return test::mock::stack_l2cap_api::L2CA_LECocDataWrite(cid, p_data);
225 }
L2CA_SetChnlFlushability(uint16_t cid,bool is_flushable)226 bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
227   inc_func_call_count(__func__);
228   return test::mock::stack_l2cap_api::L2CA_SetChnlFlushability(cid, is_flushable);
229 }
L2CA_FlushChannel(uint16_t lcid,uint16_t num_to_flush)230 uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
231   inc_func_call_count(__func__);
232   return test::mock::stack_l2cap_api::L2CA_FlushChannel(lcid, num_to_flush);
233 }
L2CA_IsLinkEstablished(const RawAddress & bd_addr,tBT_TRANSPORT transport)234 bool L2CA_IsLinkEstablished(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
235   inc_func_call_count(__func__);
236   return test::mock::stack_l2cap_api::L2CA_IsLinkEstablished(bd_addr, transport);
237 }
L2CA_SetMediaStreamChannel(uint16_t local_media_cid,bool status)238 void L2CA_SetMediaStreamChannel(uint16_t local_media_cid, bool status) {
239   inc_func_call_count(__func__);
240   return test::mock::stack_l2cap_api::L2CA_SetMediaStreamChannel(local_media_cid, status);
241 }
L2CA_isMediaChannel(uint16_t handle,uint16_t channel_id,bool is_local_cid)242 bool L2CA_isMediaChannel(uint16_t handle, uint16_t channel_id, bool is_local_cid) {
243   inc_func_call_count(__func__);
244   return test::mock::stack_l2cap_api::L2CA_isMediaChannel(handle, channel_id, is_local_cid);
245 }
L2CA_LeCreditDefault()246 uint16_t L2CA_LeCreditDefault() {
247   inc_func_call_count(__func__);
248   return test::mock::stack_l2cap_api::L2CA_LeCreditDefault();
249 }
L2CA_LeCreditThreshold()250 uint16_t L2CA_LeCreditThreshold() {
251   inc_func_call_count(__func__);
252   return test::mock::stack_l2cap_api::L2CA_LeCreditThreshold();
253 }
L2CA_GetAclHandle(uint16_t lcid,uint16_t * acl_handle)254 bool L2CA_GetAclHandle(uint16_t lcid, uint16_t* acl_handle) {
255   inc_func_call_count(__func__);
256   return test::mock::stack_l2cap_api::L2CA_GetAclHandle(lcid, acl_handle);
257 }
258 
259 // END mockcify generation
260 
L2CA_Dumpsys(int)261 void L2CA_Dumpsys(int /* fd */) { inc_func_call_count(__func__); }
262