• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 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 #pragma once
17 
18 /*
19  * Generated mock file from original source file
20  *   Functions generated:10
21  *
22  *  mockcify.pl ver 0.6.2
23  */
24 
25 #include <sys/ioctl.h>
26 #include <sys/socket.h>
27 #include <sys/types.h>
28 
29 #include <cstdint>
30 #include <functional>
31 
32 #include "btif/include/btif_uid.h"
33 #include "hardware/bt_sock.h"
34 #include "stack/include/bt_hdr.h"
35 #include "types/bluetooth/uuid.h"
36 #include "types/raw_address.h"
37 
38 // Original usings
39 using bluetooth::Uuid;
40 
41 // Mocked compile conditionals, if any
42 
43 namespace test {
44 namespace mock {
45 namespace btif_sock_rfc {
46 
47 // Shared state between mocked functions and tests
48 // Name: bta_co_rfc_data_incoming
49 // Params: uint32_t id, BT_HDR* p_buf
50 // Return: int
51 struct bta_co_rfc_data_incoming {
52   static int return_value;
53   std::function<int(uint32_t id, BT_HDR* p_buf)> body{
54           [](uint32_t /* id */, BT_HDR* /* p_buf */) { return return_value; }};
operatorbta_co_rfc_data_incoming55   int operator()(uint32_t id, BT_HDR* p_buf) { return body(id, p_buf); }
56 };
57 extern struct bta_co_rfc_data_incoming bta_co_rfc_data_incoming;
58 
59 // Name: bta_co_rfc_data_outgoing
60 // Params: uint32_t id, uint8_t* buf, uint16_t size
61 // Return: int
62 struct bta_co_rfc_data_outgoing {
63   static int return_value;
64   std::function<int(uint32_t id, uint8_t* buf, uint16_t size)> body{
65           [](uint32_t /* id */, uint8_t* /* buf */, uint16_t /* size */) { return return_value; }};
operatorbta_co_rfc_data_outgoing66   int operator()(uint32_t id, uint8_t* buf, uint16_t size) { return body(id, buf, size); }
67 };
68 extern struct bta_co_rfc_data_outgoing bta_co_rfc_data_outgoing;
69 
70 // Name: bta_co_rfc_data_outgoing_size
71 // Params: uint32_t id, int* size
72 // Return: int
73 struct bta_co_rfc_data_outgoing_size {
74   static int return_value;
75   std::function<int(uint32_t id, int* size)> body{
76           [](uint32_t /* id */, int* /* size */) { return return_value; }};
operatorbta_co_rfc_data_outgoing_size77   int operator()(uint32_t id, int* size) { return body(id, size); }
78 };
79 extern struct bta_co_rfc_data_outgoing_size bta_co_rfc_data_outgoing_size;
80 
81 // Name: btsock_rfc_cleanup
82 // Params: void
83 // Return: void
84 struct btsock_rfc_cleanup {
85   std::function<void(void)> body{[](void) {}};
operatorbtsock_rfc_cleanup86   void operator()(void) { body(); }
87 };
88 extern struct btsock_rfc_cleanup btsock_rfc_cleanup;
89 
90 // Name: btsock_rfc_connect
91 // Params: const RawAddress* bd_addr, const Uuid* service_uuid, int channel,
92 // int* sock_fd, int flags, int app_uid Return: bt_status_t
93 struct btsock_rfc_connect {
94   static bt_status_t return_value;
95   std::function<bt_status_t(const RawAddress* bd_addr, const bluetooth::Uuid* uuid, int channel,
96                             int* sock_fd, int flags, int app_uid, btsock_data_path_t data_path,
97                             const char* socket_name, uint64_t hub_id, uint64_t endpoint_id,
98                             int max_rx_packet_size)>
99           body{[](const RawAddress* /*bd_addr*/, const bluetooth::Uuid* /*uuid*/, int /*channel*/,
100                   int* /*sock_fd*/, int /*flags*/, int /*app_uid*/,
101                   btsock_data_path_t /*data_path*/, const char* /*socket_name*/,
102                   uint64_t /*hub_id*/, uint64_t /*endpoint_id*/,
103                   int /*max_rx_packet_size*/) { return return_value; }};
operatorbtsock_rfc_connect104   bt_status_t operator()(const RawAddress* bd_addr, const bluetooth::Uuid* uuid, int channel,
105                          int* sock_fd, int flags, int app_uid, btsock_data_path_t data_path,
106                          const char* socket_name, uint64_t hub_id, uint64_t endpoint_id,
107                          int max_rx_packet_size) {
108     return body(bd_addr, uuid, channel, sock_fd, flags, app_uid, data_path, socket_name, hub_id,
109                 endpoint_id, max_rx_packet_size);
110   }
111 };
112 extern struct btsock_rfc_connect btsock_rfc_connect;
113 
114 // Name: btsock_rfc_control_req
115 // Params: uint8_t dlci, const RawAddress& bd_addr, uint8_t modem_signal,
116 // uint8_t break_signal, uint8_t discard_buffers, uint8_t break_signal_seq, bool
117 // fc Return: bt_status_t
118 struct btsock_rfc_control_req {
119   static bt_status_t return_value;
120   std::function<bt_status_t(uint8_t dlci, const RawAddress& bd_addr, uint8_t modem_signal,
121                             uint8_t break_signal, uint8_t discard_buffers, uint8_t break_signal_seq,
122                             bool fc)>
123           body{[](uint8_t /* dlci */, const RawAddress& /* bd_addr */, uint8_t /* modem_signal */,
124                   uint8_t /* break_signal */, uint8_t /* discard_buffers */,
125                   uint8_t /* break_signal_seq */, bool /* fc */) { return return_value; }};
operatorbtsock_rfc_control_req126   bt_status_t operator()(uint8_t dlci, const RawAddress& bd_addr, uint8_t modem_signal,
127                          uint8_t break_signal, uint8_t discard_buffers, uint8_t break_signal_seq,
128                          bool fc) {
129     return body(dlci, bd_addr, modem_signal, break_signal, discard_buffers, break_signal_seq, fc);
130   }
131 };
132 extern struct btsock_rfc_control_req btsock_rfc_control_req;
133 
134 // Name: btsock_rfc_disconnect
135 // Params: const RawAddress* bd_addr
136 // Return: bt_status_t
137 struct btsock_rfc_disconnect {
138   static bt_status_t return_value;
139   std::function<bt_status_t(const RawAddress* bd_addr)> body{
140           [](const RawAddress* /* bd_addr */) { return return_value; }};
operatorbtsock_rfc_disconnect141   bt_status_t operator()(const RawAddress* bd_addr) { return body(bd_addr); }
142 };
143 extern struct btsock_rfc_disconnect btsock_rfc_disconnect;
144 
145 // Name: btsock_rfc_init
146 // Params: int poll_thread_handle, uid_set_t* set
147 // Return: bt_status_t
148 struct btsock_rfc_init {
149   static bt_status_t return_value;
150   std::function<bt_status_t(int poll_thread_handle, uid_set_t* set)> body{
151           [](int /* poll_thread_handle */, uid_set_t* /* set */) { return return_value; }};
operatorbtsock_rfc_init152   bt_status_t operator()(int poll_thread_handle, uid_set_t* set) {
153     return body(poll_thread_handle, set);
154   }
155 };
156 extern struct btsock_rfc_init btsock_rfc_init;
157 
158 // Name: btsock_rfc_listen
159 // Params: const char* service_name, const Uuid* service_uuid, int channel, int*
160 // sock_fd, int flags, int app_uid Return: bt_status_t
161 struct btsock_rfc_listen {
162   static bt_status_t return_value;
163   std::function<bt_status_t(const char* service_name, const Uuid* service_uuid, int channel,
164                             int* sock_fd, int flags, int app_uid, btsock_data_path_t data_path,
165                             const char* socket_name, uint64_t hub_id, uint64_t endpoint_id,
166                             int max_rx_packet_size)>
167           body{[](const char* /* service_name */, const Uuid* /* service_uuid */, int /* channel */,
168                   int* /* sock_fd */, int /* flags */, int /* app_uid */,
169                   btsock_data_path_t /*data_path*/, const char* /*socket_name*/,
170                   uint64_t /*hub_id*/, uint64_t /*endpoint_id*/,
171                   int /*max_rx_packet_size*/) { return return_value; }};
operatorbtsock_rfc_listen172   bt_status_t operator()(const char* service_name, const Uuid* service_uuid, int channel,
173                          int* sock_fd, int flags, int app_uid, btsock_data_path_t data_path,
174                          const char* socket_name, uint64_t hub_id, uint64_t endpoint_id,
175                          int max_rx_packet_size) {
176     return body(service_name, service_uuid, channel, sock_fd, flags, app_uid, data_path,
177                 socket_name, hub_id, endpoint_id, max_rx_packet_size);
178   }
179 };
180 extern struct btsock_rfc_listen btsock_rfc_listen;
181 
182 // Name: btsock_rfc_signaled
183 // Params:  int fd, int flags, uint32_t id
184 // Return: void
185 struct btsock_rfc_signaled {
186   std::function<void(int fd, int flags, uint32_t id)> body{
187           [](int /* fd */, int /* flags */, uint32_t /* id */) {}};
operatorbtsock_rfc_signaled188   void operator()(int fd, int flags, uint32_t id) { body(fd, flags, id); }
189 };
190 extern struct btsock_rfc_signaled btsock_rfc_signaled;
191 
192 // Name: on_btsocket_rfc_close
193 // Params: uint64_t socket_id
194 // Return: void
195 struct on_btsocket_rfc_close {
196   std::function<void(uint64_t socket_id)> body{[](uint64_t /* socket_id */) {}};
operatoron_btsocket_rfc_close197   void operator()(uint64_t socket_id) { body(socket_id); }
198 };
199 extern struct on_btsocket_rfc_close on_btsocket_rfc_close;
200 
201 // Name: on_btsocket_rfc_opened_complete
202 // Params: uint64_t socket_id, bool success
203 // Return: void
204 struct on_btsocket_rfc_opened_complete {
205   std::function<void(uint64_t socket_id, bool success)> body{
206           [](uint64_t /* socket_id */, bool /* success */) {}};
operatoron_btsocket_rfc_opened_complete207   void operator()(uint64_t socket_id, bool success) { body(socket_id, success); }
208 };
209 extern struct on_btsocket_rfc_opened_complete on_btsocket_rfc_opened_complete;
210 
211 }  // namespace btif_sock_rfc
212 }  // namespace mock
213 }  // namespace test
214 
215 // END mockcify generation
216