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:11
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 // Mock include file to share data between tests and mock
24 #include "test/mock/mock_osi_socket.h"
25 
26 #include "test/common/mock_functions.h"
27 
28 // Mocked internal structures, if any
29 
30 namespace test {
31 namespace mock {
32 namespace osi_socket {
33 
34 // Function state capture and return values, if needed
35 struct socket_accept socket_accept;
36 struct socket_bytes_available socket_bytes_available;
37 struct socket_free socket_free;
38 struct socket_listen socket_listen;
39 struct socket_new socket_new;
40 struct socket_new_from_fd socket_new_from_fd;
41 struct socket_read socket_read;
42 struct socket_register socket_register;
43 struct socket_unregister socket_unregister;
44 struct socket_write socket_write;
45 struct socket_write_and_transfer_fd socket_write_and_transfer_fd;
46 
47 }  // namespace osi_socket
48 }  // namespace mock
49 }  // namespace test
50 
51 // Mocked functions, if any
socket_accept(const socket_t * socket)52 socket_t* socket_accept(const socket_t* socket) {
53   inc_func_call_count(__func__);
54   return test::mock::osi_socket::socket_accept(socket);
55 }
socket_bytes_available(const socket_t * socket)56 ssize_t socket_bytes_available(const socket_t* socket) {
57   inc_func_call_count(__func__);
58   return test::mock::osi_socket::socket_bytes_available(socket);
59 }
socket_free(socket_t * socket)60 void socket_free(socket_t* socket) {
61   inc_func_call_count(__func__);
62   test::mock::osi_socket::socket_free(socket);
63 }
socket_listen(const socket_t * socket,port_t port)64 bool socket_listen(const socket_t* socket, port_t port) {
65   inc_func_call_count(__func__);
66   return test::mock::osi_socket::socket_listen(socket, port);
67 }
socket_new(void)68 socket_t* socket_new(void) {
69   inc_func_call_count(__func__);
70   return test::mock::osi_socket::socket_new();
71 }
socket_new_from_fd(int fd)72 socket_t* socket_new_from_fd(int fd) {
73   inc_func_call_count(__func__);
74   return test::mock::osi_socket::socket_new_from_fd(fd);
75 }
socket_read(const socket_t * socket,void * buf,size_t count)76 ssize_t socket_read(const socket_t* socket, void* buf, size_t count) {
77   inc_func_call_count(__func__);
78   return test::mock::osi_socket::socket_read(socket, buf, count);
79 }
socket_register(socket_t * socket,reactor_t * reactor,void * context,socket_cb read_cb,socket_cb write_cb)80 void socket_register(socket_t* socket, reactor_t* reactor, void* context,
81                      socket_cb read_cb, socket_cb write_cb) {
82   inc_func_call_count(__func__);
83   test::mock::osi_socket::socket_register(socket, reactor, context, read_cb,
84                                           write_cb);
85 }
socket_unregister(socket_t * socket)86 void socket_unregister(socket_t* socket) {
87   inc_func_call_count(__func__);
88   test::mock::osi_socket::socket_unregister(socket);
89 }
socket_write(const socket_t * socket,const void * buf,size_t count)90 ssize_t socket_write(const socket_t* socket, const void* buf, size_t count) {
91   inc_func_call_count(__func__);
92   return test::mock::osi_socket::socket_write(socket, buf, count);
93 }
socket_write_and_transfer_fd(const socket_t * socket,const void * buf,size_t count,int fd)94 ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
95                                      size_t count, int fd) {
96   inc_func_call_count(__func__);
97   return test::mock::osi_socket::socket_write_and_transfer_fd(socket, buf,
98                                                               count, fd);
99 }
100 // Mocked functions complete
101 // END mockcify generation
osi_socket_local_server_bind(int,const char *,int)102 int osi_socket_local_server_bind(int /* s */, const char* /* name */,
103                                  int /* namespaceId */) {
104   inc_func_call_count(__func__);
105   return 0;
106 }
107