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:12 20 * 21 * mockcify.pl ver 0.2.1 22 */ 23 24 #include <cstdint> 25 #include <functional> 26 #include <map> 27 #include <string> 28 29 extern std::map<std::string, int> mock_function_count_map; 30 31 // Original included files, if any 32 // NOTE: Since this is a mock file with mock definitions some number of 33 // include files may not be required. The include-what-you-use 34 // still applies, but crafting proper inclusion is out of scope 35 // for this effort. This compilation unit may compile as-is, or 36 // may need attention to prune the inclusion set. 37 #include <base/logging.h> 38 #include <base/strings/stringprintf.h> 39 40 #include <cstdint> 41 #include <cstring> 42 43 #include "stack/include/pan_api.h" 44 #include "types/raw_address.h" 45 46 // Mocked compile conditionals, if any 47 #ifndef UNUSED_ATTR 48 #define UNUSED_ATTR 49 #endif 50 51 namespace test { 52 namespace mock { 53 namespace stack_pan_api { 54 55 // Shared state between mocked functions and tests 56 // Name: PAN_Connect 57 // Params: const RawAddress& rem_bda, tPAN_ROLE src_role, tPAN_ROLE dst_role, 58 // uint16_t* handle Returns: tPAN_RESULT 59 struct PAN_Connect { 60 std::function<tPAN_RESULT(const RawAddress& rem_bda, tPAN_ROLE src_role, 61 tPAN_ROLE dst_role, uint16_t* handle)> 62 body{[](const RawAddress& rem_bda, tPAN_ROLE src_role, tPAN_ROLE dst_role, 63 uint16_t* handle) { return PAN_SUCCESS; }}; operatorPAN_Connect64 tPAN_RESULT operator()(const RawAddress& rem_bda, tPAN_ROLE src_role, 65 tPAN_ROLE dst_role, uint16_t* handle) { 66 return body(rem_bda, src_role, dst_role, handle); 67 }; 68 }; 69 extern struct PAN_Connect PAN_Connect; 70 // Name: PAN_Disconnect 71 // Params: uint16_t handle 72 // Returns: tPAN_RESULT 73 struct PAN_Disconnect { 74 std::function<tPAN_RESULT(uint16_t handle)> body{ 75 [](uint16_t handle) { return PAN_SUCCESS; }}; operatorPAN_Disconnect76 tPAN_RESULT operator()(uint16_t handle) { return body(handle); }; 77 }; 78 extern struct PAN_Disconnect PAN_Disconnect; 79 // Name: PAN_SetMulticastFilters 80 // Params: uint16_t handle, uint16_t num_mcast_filters, uint8_t* p_start_array, 81 // uint8_t* p_end_array Returns: tPAN_RESULT 82 struct PAN_SetMulticastFilters { 83 std::function<tPAN_RESULT(uint16_t handle, uint16_t num_mcast_filters, 84 uint8_t* p_start_array, uint8_t* p_end_array)> 85 body{[](uint16_t handle, uint16_t num_mcast_filters, 86 uint8_t* p_start_array, 87 uint8_t* p_end_array) { return PAN_SUCCESS; }}; operatorPAN_SetMulticastFilters88 tPAN_RESULT operator()(uint16_t handle, uint16_t num_mcast_filters, 89 uint8_t* p_start_array, uint8_t* p_end_array) { 90 return body(handle, num_mcast_filters, p_start_array, p_end_array); 91 }; 92 }; 93 extern struct PAN_SetMulticastFilters PAN_SetMulticastFilters; 94 // Name: PAN_SetProtocolFilters 95 // Params: uint16_t handle, uint16_t num_filters, uint16_t* p_start_array, 96 // uint16_t* p_end_array Returns: tPAN_RESULT 97 struct PAN_SetProtocolFilters { 98 std::function<tPAN_RESULT(uint16_t handle, uint16_t num_filters, 99 uint16_t* p_start_array, uint16_t* p_end_array)> 100 body{[](uint16_t handle, uint16_t num_filters, uint16_t* p_start_array, 101 uint16_t* p_end_array) { return PAN_SUCCESS; }}; operatorPAN_SetProtocolFilters102 tPAN_RESULT operator()(uint16_t handle, uint16_t num_filters, 103 uint16_t* p_start_array, uint16_t* p_end_array) { 104 return body(handle, num_filters, p_start_array, p_end_array); 105 }; 106 }; 107 extern struct PAN_SetProtocolFilters PAN_SetProtocolFilters; 108 // Name: PAN_SetRole 109 // Params: uint8_t role, const std::string p_user_name, const std::string 110 // p_nap_name Returns: tPAN_RESULT 111 struct PAN_SetRole { 112 std::function<tPAN_RESULT(uint8_t role, std::string p_user_name, 113 std::string p_nap_name)> 114 body{[](uint8_t role, std::string p_user_name, std::string p_nap_name) { 115 return PAN_SUCCESS; 116 }}; operatorPAN_SetRole117 tPAN_RESULT operator()(uint8_t role, std::string p_user_name, 118 std::string p_nap_name) { 119 return body(role, p_user_name, p_nap_name); 120 }; 121 }; 122 extern struct PAN_SetRole PAN_SetRole; 123 // Name: PAN_Write 124 // Params: uint16_t handle, const RawAddress& dst, const RawAddress& src, 125 // uint16_t protocol, uint8_t* p_data, uint16_t len, bool ext Returns: 126 // tPAN_RESULT 127 struct PAN_Write { 128 std::function<tPAN_RESULT(uint16_t handle, const RawAddress& dst, 129 const RawAddress& src, uint16_t protocol, 130 uint8_t* p_data, uint16_t len, bool ext)> 131 body{[](uint16_t handle, const RawAddress& dst, const RawAddress& src, 132 uint16_t protocol, uint8_t* p_data, uint16_t len, 133 bool ext) { return PAN_SUCCESS; }}; operatorPAN_Write134 tPAN_RESULT operator()(uint16_t handle, const RawAddress& dst, 135 const RawAddress& src, uint16_t protocol, 136 uint8_t* p_data, uint16_t len, bool ext) { 137 return body(handle, dst, src, protocol, p_data, len, ext); 138 }; 139 }; 140 extern struct PAN_Write PAN_Write; 141 // Name: PAN_WriteBuf 142 // Params: uint16_t handle, const RawAddress& dst, const RawAddress& src, 143 // uint16_t protocol, BT_HDR* p_buf, bool ext Returns: tPAN_RESULT 144 struct PAN_WriteBuf { 145 std::function<tPAN_RESULT(uint16_t handle, const RawAddress& dst, 146 const RawAddress& src, uint16_t protocol, 147 BT_HDR* p_buf, bool ext)> 148 body{[](uint16_t handle, const RawAddress& dst, const RawAddress& src, 149 uint16_t protocol, BT_HDR* p_buf, 150 bool ext) { return PAN_SUCCESS; }}; operatorPAN_WriteBuf151 tPAN_RESULT operator()(uint16_t handle, const RawAddress& dst, 152 const RawAddress& src, uint16_t protocol, 153 BT_HDR* p_buf, bool ext) { 154 return body(handle, dst, src, protocol, p_buf, ext); 155 }; 156 }; 157 extern struct PAN_WriteBuf PAN_WriteBuf; 158 // Name: PAN_SetTraceLevel 159 // Params: uint8_t new_level 160 // Returns: uint8_t 161 struct PAN_SetTraceLevel { 162 std::function<uint8_t(uint8_t new_level)> body{ 163 [](uint8_t new_level) { return 0; }}; operatorPAN_SetTraceLevel164 uint8_t operator()(uint8_t new_level) { return body(new_level); }; 165 }; 166 extern struct PAN_SetTraceLevel PAN_SetTraceLevel; 167 // Name: PAN_Deregister 168 // Params: void 169 // Returns: void 170 struct PAN_Deregister { 171 std::function<void(void)> body{[](void) { ; }}; operatorPAN_Deregister172 void operator()(void) { body(); }; 173 }; 174 extern struct PAN_Deregister PAN_Deregister; 175 // Name: PAN_Dumpsys 176 // Params: int fd 177 // Returns: void 178 struct PAN_Dumpsys { 179 std::function<void(int fd)> body{[](int fd) { ; }}; operatorPAN_Dumpsys180 void operator()(int fd) { body(fd); }; 181 }; 182 extern struct PAN_Dumpsys PAN_Dumpsys; 183 // Name: PAN_Init 184 // Params: void 185 // Returns: void 186 struct PAN_Init { 187 std::function<void(void)> body{[](void) { ; }}; operatorPAN_Init188 void operator()(void) { body(); }; 189 }; 190 extern struct PAN_Init PAN_Init; 191 // Name: PAN_Register 192 // Params: tPAN_REGISTER* p_register 193 // Returns: void 194 struct PAN_Register { 195 std::function<void(tPAN_REGISTER* p_register)> body{ 196 [](tPAN_REGISTER* p_register) { ; }}; operatorPAN_Register197 void operator()(tPAN_REGISTER* p_register) { body(p_register); }; 198 }; 199 extern struct PAN_Register PAN_Register; 200 201 } // namespace stack_pan_api 202 } // namespace mock 203 } // namespace test 204 205 // END mockcify generation 206