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 "stack/include/bt_hdr.h"
34 #include "types/bluetooth/uuid.h"
35 #include "types/raw_address.h"
36 
37 // Original usings
38 using bluetooth::Uuid;
39 
40 // Mocked compile conditionals, if any
41 
42 namespace test {
43 namespace mock {
44 namespace btif_sock_rfc {
45 
46 // Shared state between mocked functions and tests
47 // Name: bta_co_rfc_data_incoming
48 // Params: uint32_t id, BT_HDR* p_buf
49 // Return: int
50 struct bta_co_rfc_data_incoming {
51   static int return_value;
52   std::function<int(uint32_t id, BT_HDR* p_buf)> body{
53       [](uint32_t /* id */, BT_HDR* /* p_buf */) { return return_value; }};
operatorbta_co_rfc_data_incoming54   int operator()(uint32_t id, BT_HDR* p_buf) { return body(id, p_buf); };
55 };
56 extern struct bta_co_rfc_data_incoming bta_co_rfc_data_incoming;
57 
58 // Name: bta_co_rfc_data_outgoing
59 // Params: uint32_t id, uint8_t* buf, uint16_t size
60 // Return: int
61 struct bta_co_rfc_data_outgoing {
62   static int return_value;
63   std::function<int(uint32_t id, uint8_t* buf, uint16_t size)> body{
64       [](uint32_t /* id */, uint8_t* /* buf */, uint16_t /* size */) {
65         return return_value;
66       }};
operatorbta_co_rfc_data_outgoing67   int operator()(uint32_t id, uint8_t* buf, uint16_t size) {
68     return body(id, buf, size);
69   };
70 };
71 extern struct bta_co_rfc_data_outgoing bta_co_rfc_data_outgoing;
72 
73 // Name: bta_co_rfc_data_outgoing_size
74 // Params: uint32_t id, int* size
75 // Return: int
76 struct bta_co_rfc_data_outgoing_size {
77   static int return_value;
78   std::function<int(uint32_t id, int* size)> body{
79       [](uint32_t /* id */, int* /* size */) { return return_value; }};
operatorbta_co_rfc_data_outgoing_size80   int operator()(uint32_t id, int* size) { return body(id, size); };
81 };
82 extern struct bta_co_rfc_data_outgoing_size bta_co_rfc_data_outgoing_size;
83 
84 // Name: btsock_rfc_cleanup
85 // Params: void
86 // Return: void
87 struct btsock_rfc_cleanup {
88   std::function<void(void)> body{[](void) {}};
operatorbtsock_rfc_cleanup89   void operator()(void) { body(); };
90 };
91 extern struct btsock_rfc_cleanup btsock_rfc_cleanup;
92 
93 // Name: btsock_rfc_connect
94 // Params: const RawAddress* bd_addr, const Uuid* service_uuid, int channel,
95 // int* sock_fd, int flags, int app_uid Return: bt_status_t
96 struct btsock_rfc_connect {
97   static bt_status_t return_value;
98   std::function<bt_status_t(const RawAddress* bd_addr, const Uuid* service_uuid,
99                             int channel, int* sock_fd, int flags, int app_uid)>
100       body{[](const RawAddress* /* bd_addr */, const Uuid* /* service_uuid */,
101               int /* channel */, int* /* sock_fd */, int /* flags */,
102               int /* app_uid */) { return return_value; }};
operatorbtsock_rfc_connect103   bt_status_t operator()(const RawAddress* bd_addr, const Uuid* service_uuid,
104                          int channel, int* sock_fd, int flags, int app_uid) {
105     return body(bd_addr, service_uuid, channel, sock_fd, flags, app_uid);
106   };
107 };
108 extern struct btsock_rfc_connect btsock_rfc_connect;
109 
110 // Name: btsock_rfc_control_req
111 // Params: uint8_t dlci, const RawAddress& bd_addr, uint8_t modem_signal,
112 // uint8_t break_signal, uint8_t discard_buffers, uint8_t break_signal_seq, bool
113 // fc Return: bt_status_t
114 struct btsock_rfc_control_req {
115   static bt_status_t return_value;
116   std::function<bt_status_t(uint8_t dlci, const RawAddress& bd_addr,
117                             uint8_t modem_signal, uint8_t break_signal,
118                             uint8_t discard_buffers, uint8_t break_signal_seq,
119                             bool fc)>
120       body{[](uint8_t /* dlci */, const RawAddress& /* bd_addr */,
121               uint8_t /* modem_signal */, uint8_t /* break_signal */,
122               uint8_t /* discard_buffers */, uint8_t /* break_signal_seq */,
123               bool /* fc */) { return return_value; }};
operatorbtsock_rfc_control_req124   bt_status_t operator()(uint8_t dlci, const RawAddress& bd_addr,
125                          uint8_t modem_signal, uint8_t break_signal,
126                          uint8_t discard_buffers, uint8_t break_signal_seq,
127                          bool fc) {
128     return body(dlci, bd_addr, modem_signal, break_signal, discard_buffers,
129                 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 */) {
152         return return_value;
153       }};
operatorbtsock_rfc_init154   bt_status_t operator()(int poll_thread_handle, uid_set_t* set) {
155     return body(poll_thread_handle, set);
156   };
157 };
158 extern struct btsock_rfc_init btsock_rfc_init;
159 
160 // Name: btsock_rfc_listen
161 // Params: const char* service_name, const Uuid* service_uuid, int channel, int*
162 // sock_fd, int flags, int app_uid Return: bt_status_t
163 struct btsock_rfc_listen {
164   static bt_status_t return_value;
165   std::function<bt_status_t(const char* service_name, const Uuid* service_uuid,
166                             int channel, int* sock_fd, int flags, int app_uid)>
167       body{[](const char* /* service_name */, const Uuid* /* service_uuid */,
168               int /* channel */, int* /* sock_fd */, int /* flags */,
169               int /* app_uid */) { return return_value; }};
operatorbtsock_rfc_listen170   bt_status_t operator()(const char* service_name, const Uuid* service_uuid,
171                          int channel, int* sock_fd, int flags, int app_uid) {
172     return body(service_name, service_uuid, channel, sock_fd, flags, app_uid);
173   };
174 };
175 extern struct btsock_rfc_listen btsock_rfc_listen;
176 
177 // Name: btsock_rfc_signaled
178 // Params:  int fd, int flags, uint32_t id
179 // Return: void
180 struct btsock_rfc_signaled {
181   std::function<void(int fd, int flags, uint32_t id)> body{
182       [](int /* fd */, int /* flags */, uint32_t /* id */) {}};
operatorbtsock_rfc_signaled183   void operator()(int fd, int flags, uint32_t id) { body(fd, flags, id); };
184 };
185 extern struct btsock_rfc_signaled btsock_rfc_signaled;
186 
187 }  // namespace btif_sock_rfc
188 }  // namespace mock
189 }  // namespace test
190 
191 // END mockcify generation
192