1 /*
2 * Copyright (C) 2016 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 #include "wifi_hal/hal_tool.h"
18
19 #include <android-base/logging.h>
20
21 namespace android {
22 namespace wifi_system {
23 namespace {
24
wifi_initialize_stub(wifi_handle * handle)25 wifi_error wifi_initialize_stub(wifi_handle* handle) {
26 return WIFI_ERROR_NOT_SUPPORTED;
27 }
28
wifi_wait_for_driver_ready_stub(void)29 wifi_error wifi_wait_for_driver_ready_stub(void) {
30 return WIFI_ERROR_NOT_SUPPORTED;
31 }
32
wifi_cleanup_stub(wifi_handle handle,wifi_cleaned_up_handler handler)33 void wifi_cleanup_stub(wifi_handle handle, wifi_cleaned_up_handler handler) {}
34
wifi_event_loop_stub(wifi_handle handle)35 void wifi_event_loop_stub(wifi_handle handle) {}
36
wifi_get_error_info_stub(wifi_error err,const char ** msg)37 void wifi_get_error_info_stub(wifi_error err, const char** msg) { *msg = NULL; }
38
wifi_get_supported_feature_set_stub(wifi_interface_handle handle,feature_set * set)39 wifi_error wifi_get_supported_feature_set_stub(wifi_interface_handle handle,
40 feature_set* set) {
41 return WIFI_ERROR_UNINITIALIZED;
42 }
43
wifi_get_concurrency_matrix_stub(wifi_interface_handle handle,int max_size,feature_set * matrix,int * size)44 wifi_error wifi_get_concurrency_matrix_stub(wifi_interface_handle handle,
45 int max_size, feature_set* matrix,
46 int* size) {
47 return WIFI_ERROR_UNINITIALIZED;
48 }
49
wifi_set_scanning_mac_oui_stub(wifi_interface_handle handle,unsigned char * oui_data)50 wifi_error wifi_set_scanning_mac_oui_stub(wifi_interface_handle handle,
51 unsigned char* oui_data) {
52 return WIFI_ERROR_UNINITIALIZED;
53 }
54
55 /* List of all supported channels, including 5GHz channels */
wifi_get_supported_channels_stub(wifi_handle handle,int * size,wifi_channel * list)56 wifi_error wifi_get_supported_channels_stub(wifi_handle handle, int* size,
57 wifi_channel* list) {
58 return WIFI_ERROR_UNINITIALIZED;
59 }
60
61 /* Enhanced power reporting */
wifi_is_epr_supported_stub(wifi_handle handle)62 wifi_error wifi_is_epr_supported_stub(wifi_handle handle) {
63 return WIFI_ERROR_UNINITIALIZED;
64 }
65
66 /* multiple interface support */
wifi_get_ifaces_stub(wifi_handle handle,int * num_ifaces,wifi_interface_handle ** ifaces)67 wifi_error wifi_get_ifaces_stub(wifi_handle handle, int* num_ifaces,
68 wifi_interface_handle** ifaces) {
69 return WIFI_ERROR_UNINITIALIZED;
70 }
71
wifi_get_iface_name_stub(wifi_interface_handle iface,char * name,size_t size)72 wifi_error wifi_get_iface_name_stub(wifi_interface_handle iface, char* name,
73 size_t size) {
74 return WIFI_ERROR_UNINITIALIZED;
75 }
76
wifi_set_iface_event_handler_stub(wifi_request_id id,wifi_interface_handle iface,wifi_event_handler eh)77 wifi_error wifi_set_iface_event_handler_stub(wifi_request_id id,
78 wifi_interface_handle iface,
79 wifi_event_handler eh) {
80 return WIFI_ERROR_UNINITIALIZED;
81 }
82
wifi_reset_iface_event_handler_stub(wifi_request_id id,wifi_interface_handle iface)83 wifi_error wifi_reset_iface_event_handler_stub(wifi_request_id id,
84 wifi_interface_handle iface) {
85 return WIFI_ERROR_UNINITIALIZED;
86 }
87
wifi_start_gscan_stub(wifi_request_id id,wifi_interface_handle iface,wifi_scan_cmd_params params,wifi_scan_result_handler handler)88 wifi_error wifi_start_gscan_stub(wifi_request_id id,
89 wifi_interface_handle iface,
90 wifi_scan_cmd_params params,
91 wifi_scan_result_handler handler) {
92 return WIFI_ERROR_UNINITIALIZED;
93 }
94
wifi_stop_gscan_stub(wifi_request_id id,wifi_interface_handle iface)95 wifi_error wifi_stop_gscan_stub(wifi_request_id id,
96 wifi_interface_handle iface) {
97 return WIFI_ERROR_UNINITIALIZED;
98 }
99
wifi_get_cached_gscan_results_stub(wifi_interface_handle iface,byte flush,int max,wifi_cached_scan_results * results,int * num)100 wifi_error wifi_get_cached_gscan_results_stub(wifi_interface_handle iface,
101 byte flush, int max,
102 wifi_cached_scan_results* results,
103 int* num) {
104 return WIFI_ERROR_UNINITIALIZED;
105 }
106
wifi_set_bssid_hotlist_stub(wifi_request_id id,wifi_interface_handle iface,wifi_bssid_hotlist_params params,wifi_hotlist_ap_found_handler handler)107 wifi_error wifi_set_bssid_hotlist_stub(wifi_request_id id,
108 wifi_interface_handle iface,
109 wifi_bssid_hotlist_params params,
110 wifi_hotlist_ap_found_handler handler) {
111 return WIFI_ERROR_UNINITIALIZED;
112 }
113
wifi_reset_bssid_hotlist_stub(wifi_request_id id,wifi_interface_handle iface)114 wifi_error wifi_reset_bssid_hotlist_stub(wifi_request_id id,
115 wifi_interface_handle iface) {
116 return WIFI_ERROR_UNINITIALIZED;
117 }
118
wifi_set_significant_change_handler_stub(wifi_request_id id,wifi_interface_handle iface,wifi_significant_change_params params,wifi_significant_change_handler handler)119 wifi_error wifi_set_significant_change_handler_stub(
120 wifi_request_id id, wifi_interface_handle iface,
121 wifi_significant_change_params params,
122 wifi_significant_change_handler handler) {
123 return WIFI_ERROR_UNINITIALIZED;
124 }
125
wifi_reset_significant_change_handler_stub(wifi_request_id id,wifi_interface_handle iface)126 wifi_error wifi_reset_significant_change_handler_stub(
127 wifi_request_id id, wifi_interface_handle iface) {
128 return WIFI_ERROR_UNINITIALIZED;
129 }
130
wifi_get_gscan_capabilities_stub(wifi_interface_handle handle,wifi_gscan_capabilities * capabilities)131 wifi_error wifi_get_gscan_capabilities_stub(
132 wifi_interface_handle handle, wifi_gscan_capabilities* capabilities) {
133 return WIFI_ERROR_UNINITIALIZED;
134 }
135
wifi_set_link_stats_stub(wifi_interface_handle iface,wifi_link_layer_params params)136 wifi_error wifi_set_link_stats_stub(wifi_interface_handle iface,
137 wifi_link_layer_params params) {
138 return WIFI_ERROR_UNINITIALIZED;
139 }
140
wifi_get_link_stats_stub(wifi_request_id id,wifi_interface_handle iface,wifi_stats_result_handler handler)141 wifi_error wifi_get_link_stats_stub(wifi_request_id id,
142 wifi_interface_handle iface,
143 wifi_stats_result_handler handler) {
144 return WIFI_ERROR_UNINITIALIZED;
145 }
146
wifi_clear_link_stats_stub(wifi_interface_handle iface,u32 stats_clear_req_mask,u32 * stats_clear_rsp_mask,u8 stop_req,u8 * stop_rsp)147 wifi_error wifi_clear_link_stats_stub(wifi_interface_handle iface,
148 u32 stats_clear_req_mask,
149 u32* stats_clear_rsp_mask, u8 stop_req,
150 u8* stop_rsp) {
151 return WIFI_ERROR_UNINITIALIZED;
152 }
153
wifi_get_valid_channels_stub(wifi_interface_handle handle,int band,int max_channels,wifi_channel * channels,int * num_channels)154 wifi_error wifi_get_valid_channels_stub(wifi_interface_handle handle, int band,
155 int max_channels,
156 wifi_channel* channels,
157 int* num_channels) {
158 return WIFI_ERROR_UNINITIALIZED;
159 }
160
161 /* API to request RTT measurement */
wifi_rtt_range_request_stub(wifi_request_id id,wifi_interface_handle iface,unsigned num_rtt_config,wifi_rtt_config rtt_config[],wifi_rtt_event_handler handler)162 wifi_error wifi_rtt_range_request_stub(wifi_request_id id,
163 wifi_interface_handle iface,
164 unsigned num_rtt_config,
165 wifi_rtt_config rtt_config[],
166 wifi_rtt_event_handler handler) {
167 return WIFI_ERROR_NOT_SUPPORTED;
168 }
169
170 /* API to cancel RTT measurements */
wifi_rtt_range_cancel_stub(wifi_request_id id,wifi_interface_handle iface,unsigned num_devices,mac_addr addr[])171 wifi_error wifi_rtt_range_cancel_stub(wifi_request_id id,
172 wifi_interface_handle iface,
173 unsigned num_devices, mac_addr addr[]) {
174 return WIFI_ERROR_NOT_SUPPORTED;
175 }
176
177 /* API to get RTT capability */
wifi_get_rtt_capabilities_stub(wifi_interface_handle iface,wifi_rtt_capabilities * capabilities)178 wifi_error wifi_get_rtt_capabilities_stub(wifi_interface_handle iface,
179 wifi_rtt_capabilities* capabilities) {
180 return WIFI_ERROR_NOT_SUPPORTED;
181 }
182
183 /* API to enable RTT responder role */
wifi_enable_responder_stub(wifi_request_id id,wifi_interface_handle iface,wifi_channel_info channel_hint,unsigned max_duration_seconds,wifi_channel_info * channel_used)184 wifi_error wifi_enable_responder_stub(wifi_request_id id,
185 wifi_interface_handle iface,
186 wifi_channel_info channel_hint,
187 unsigned max_duration_seconds,
188 wifi_channel_info* channel_used) {
189 return WIFI_ERROR_NOT_SUPPORTED;
190 }
191
192 /* API to disable RTT responder role */
wifi_disable_responder_stub(wifi_request_id id,wifi_interface_handle iface)193 wifi_error wifi_disable_responder_stub(wifi_request_id id,
194 wifi_interface_handle iface) {
195 return WIFI_ERROR_NOT_SUPPORTED;
196 }
197
198 /* API to get available channel for RTT responder role */
wifi_rtt_get_available_channel_stub(wifi_interface_handle iface,wifi_channel_info * channel)199 wifi_error wifi_rtt_get_available_channel_stub(wifi_interface_handle iface,
200 wifi_channel_info* channel) {
201 return WIFI_ERROR_NOT_SUPPORTED;
202 }
203
wifi_set_nodfs_flag_stub(wifi_interface_handle iface,u32 nodfs)204 wifi_error wifi_set_nodfs_flag_stub(wifi_interface_handle iface, u32 nodfs) {
205 return WIFI_ERROR_NOT_SUPPORTED;
206 }
207
wifi_start_logging_stub(wifi_interface_handle iface,u32 verbose_level,u32 flags,u32 max_interval_sec,u32 min_data_size,char * buffer_name)208 wifi_error wifi_start_logging_stub(wifi_interface_handle iface,
209 u32 verbose_level, u32 flags,
210 u32 max_interval_sec, u32 min_data_size,
211 char* buffer_name) {
212 return WIFI_ERROR_NOT_SUPPORTED;
213 }
214
wifi_set_epno_list_stub(int id,wifi_interface_info * iface,const wifi_epno_params * params,wifi_epno_handler handler)215 wifi_error wifi_set_epno_list_stub(int id, wifi_interface_info* iface,
216 const wifi_epno_params* params,
217 wifi_epno_handler handler) {
218 return WIFI_ERROR_NOT_SUPPORTED;
219 }
220
wifi_reset_epno_list_stub(int id,wifi_interface_info * iface)221 wifi_error wifi_reset_epno_list_stub(int id, wifi_interface_info* iface) {
222 return WIFI_ERROR_NOT_SUPPORTED;
223 }
224
wifi_set_country_code_stub(wifi_interface_handle iface,const char * code)225 wifi_error wifi_set_country_code_stub(wifi_interface_handle iface,
226 const char* code) {
227 return WIFI_ERROR_NOT_SUPPORTED;
228 }
229
wifi_get_firmware_memory_dump_stub(wifi_interface_handle iface,wifi_firmware_memory_dump_handler handler)230 wifi_error wifi_get_firmware_memory_dump_stub(
231 wifi_interface_handle iface, wifi_firmware_memory_dump_handler handler) {
232 return WIFI_ERROR_NOT_SUPPORTED;
233 }
234
wifi_set_log_handler_stub(wifi_request_id id,wifi_interface_handle iface,wifi_ring_buffer_data_handler handler)235 wifi_error wifi_set_log_handler_stub(wifi_request_id id,
236 wifi_interface_handle iface,
237 wifi_ring_buffer_data_handler handler) {
238 return WIFI_ERROR_NOT_SUPPORTED;
239 }
240
wifi_reset_log_handler_stub(wifi_request_id id,wifi_interface_handle iface)241 wifi_error wifi_reset_log_handler_stub(wifi_request_id id,
242 wifi_interface_handle iface) {
243 return WIFI_ERROR_NOT_SUPPORTED;
244 }
245
wifi_set_alert_handler_stub(wifi_request_id id,wifi_interface_handle iface,wifi_alert_handler handler)246 wifi_error wifi_set_alert_handler_stub(wifi_request_id id,
247 wifi_interface_handle iface,
248 wifi_alert_handler handler) {
249 return WIFI_ERROR_NOT_SUPPORTED;
250 }
251
wifi_reset_alert_handler_stub(wifi_request_id id,wifi_interface_handle iface)252 wifi_error wifi_reset_alert_handler_stub(wifi_request_id id,
253 wifi_interface_handle iface) {
254 return WIFI_ERROR_NOT_SUPPORTED;
255 }
256
wifi_get_firmware_version_stub(wifi_interface_handle iface,char * buffer,int buffer_size)257 wifi_error wifi_get_firmware_version_stub(wifi_interface_handle iface,
258 char* buffer, int buffer_size) {
259 return WIFI_ERROR_NOT_SUPPORTED;
260 }
261
wifi_get_ring_buffers_status_stub(wifi_interface_handle iface,u32 * num_rings,wifi_ring_buffer_status * status)262 wifi_error wifi_get_ring_buffers_status_stub(wifi_interface_handle iface,
263 u32* num_rings,
264 wifi_ring_buffer_status* status) {
265 return WIFI_ERROR_NOT_SUPPORTED;
266 }
267
wifi_get_logger_supported_feature_set_stub(wifi_interface_handle iface,unsigned int * support)268 wifi_error wifi_get_logger_supported_feature_set_stub(
269 wifi_interface_handle iface, unsigned int* support) {
270 return WIFI_ERROR_NOT_SUPPORTED;
271 }
272
wifi_get_ring_data_stub(wifi_interface_handle iface,char * ring_name)273 wifi_error wifi_get_ring_data_stub(wifi_interface_handle iface,
274 char* ring_name) {
275 return WIFI_ERROR_NOT_SUPPORTED;
276 }
277
wifi_get_driver_version_stub(wifi_interface_handle iface,char * buffer,int buffer_size)278 wifi_error wifi_get_driver_version_stub(wifi_interface_handle iface,
279 char* buffer, int buffer_size) {
280 return WIFI_ERROR_NOT_SUPPORTED;
281 }
282
wifi_enable_tdls_stub(wifi_interface_handle iface,mac_addr addr,wifi_tdls_params * params,wifi_tdls_handler handler)283 wifi_error wifi_enable_tdls_stub(wifi_interface_handle iface, mac_addr addr,
284 wifi_tdls_params* params,
285 wifi_tdls_handler handler) {
286 return WIFI_ERROR_NOT_SUPPORTED;
287 }
288
wifi_disable_tdls_stub(wifi_interface_handle iface,mac_addr addr)289 wifi_error wifi_disable_tdls_stub(wifi_interface_handle iface, mac_addr addr) {
290 return WIFI_ERROR_NOT_SUPPORTED;
291 }
292
wifi_get_tdls_status_stub(wifi_interface_handle iface,mac_addr addr,wifi_tdls_status * status)293 wifi_error wifi_get_tdls_status_stub(wifi_interface_handle iface, mac_addr addr,
294 wifi_tdls_status* status) {
295 return WIFI_ERROR_NOT_SUPPORTED;
296 }
297
wifi_get_tdls_capabilities_stub(wifi_interface_handle iface,wifi_tdls_capabilities * capabilities)298 wifi_error wifi_get_tdls_capabilities_stub(
299 wifi_interface_handle iface, wifi_tdls_capabilities* capabilities) {
300 return WIFI_ERROR_NOT_SUPPORTED;
301 }
302
wifi_start_sending_offloaded_packet_stub(wifi_request_id id,wifi_interface_handle iface,u16 ether_type,u8 * ip_packet,u16 ip_packet_len,u8 * src_mac_addr,u8 * dst_mac_addr,u32 period_msec)303 wifi_error wifi_start_sending_offloaded_packet_stub(
304 wifi_request_id id, wifi_interface_handle iface, u16 ether_type,
305 u8* ip_packet, u16 ip_packet_len, u8* src_mac_addr, u8* dst_mac_addr,
306 u32 period_msec) {
307 return WIFI_ERROR_NOT_SUPPORTED;
308 }
309
wifi_stop_sending_offloaded_packet_stub(wifi_request_id id,wifi_interface_handle iface)310 wifi_error wifi_stop_sending_offloaded_packet_stub(
311 wifi_request_id id, wifi_interface_handle iface) {
312 return WIFI_ERROR_NOT_SUPPORTED;
313 }
314
wifi_get_wake_reason_stats_stub(wifi_interface_handle iface,WLAN_DRIVER_WAKE_REASON_CNT * wifi_wake_reason_cnt)315 wifi_error wifi_get_wake_reason_stats_stub(
316 wifi_interface_handle iface,
317 WLAN_DRIVER_WAKE_REASON_CNT* wifi_wake_reason_cnt) {
318 return WIFI_ERROR_NOT_SUPPORTED;
319 }
320
wifi_configure_nd_offload_stub(wifi_interface_handle iface,u8 enable)321 wifi_error wifi_configure_nd_offload_stub(wifi_interface_handle iface,
322 u8 enable) {
323 return WIFI_ERROR_NOT_SUPPORTED;
324 }
325
wifi_get_driver_memory_dump_stub(wifi_interface_handle iface,wifi_driver_memory_dump_callbacks callbacks)326 wifi_error wifi_get_driver_memory_dump_stub(
327 wifi_interface_handle iface, wifi_driver_memory_dump_callbacks callbacks) {
328 return WIFI_ERROR_NOT_SUPPORTED;
329 }
330
wifi_start_pkt_fate_monitoring_stub(wifi_interface_handle iface)331 wifi_error wifi_start_pkt_fate_monitoring_stub(wifi_interface_handle iface) {
332 return WIFI_ERROR_NOT_SUPPORTED;
333 }
334
wifi_get_tx_pkt_fates_stub(wifi_interface_handle handle,wifi_tx_report * tx_report_bufs,size_t n_requested_fates,size_t * n_provided_fates)335 wifi_error wifi_get_tx_pkt_fates_stub(wifi_interface_handle handle,
336 wifi_tx_report* tx_report_bufs,
337 size_t n_requested_fates,
338 size_t* n_provided_fates) {
339 return WIFI_ERROR_NOT_SUPPORTED;
340 }
341
wifi_get_rx_pkt_fates_stub(wifi_interface_handle handle,wifi_rx_report * rx_report_bufs,size_t n_requested_fates,size_t * n_provided_fates)342 wifi_error wifi_get_rx_pkt_fates_stub(wifi_interface_handle handle,
343 wifi_rx_report* rx_report_bufs,
344 size_t n_requested_fates,
345 size_t* n_provided_fates) {
346 return WIFI_ERROR_NOT_SUPPORTED;
347 }
wifi_nan_enable_request_stub(transaction_id id,wifi_interface_handle iface,NanEnableRequest * msg)348 wifi_error wifi_nan_enable_request_stub(transaction_id id,
349 wifi_interface_handle iface,
350 NanEnableRequest* msg) {
351 return WIFI_ERROR_NOT_SUPPORTED;
352 }
353
wifi_nan_disable_request_stub(transaction_id id,wifi_interface_handle iface)354 wifi_error wifi_nan_disable_request_stub(transaction_id id,
355 wifi_interface_handle iface) {
356 return WIFI_ERROR_NOT_SUPPORTED;
357 }
358
wifi_nan_publish_request_stub(transaction_id id,wifi_interface_handle iface,NanPublishRequest * msg)359 wifi_error wifi_nan_publish_request_stub(transaction_id id,
360 wifi_interface_handle iface,
361 NanPublishRequest* msg) {
362 return WIFI_ERROR_NOT_SUPPORTED;
363 }
364
wifi_nan_publish_cancel_request_stub(transaction_id id,wifi_interface_handle iface,NanPublishCancelRequest * msg)365 wifi_error wifi_nan_publish_cancel_request_stub(transaction_id id,
366 wifi_interface_handle iface,
367 NanPublishCancelRequest* msg) {
368 return WIFI_ERROR_NOT_SUPPORTED;
369 }
370
wifi_nan_subscribe_request_stub(transaction_id id,wifi_interface_handle iface,NanSubscribeRequest * msg)371 wifi_error wifi_nan_subscribe_request_stub(transaction_id id,
372 wifi_interface_handle iface,
373 NanSubscribeRequest* msg) {
374 return WIFI_ERROR_NOT_SUPPORTED;
375 }
376
wifi_nan_subscribe_cancel_request_stub(transaction_id id,wifi_interface_handle iface,NanSubscribeCancelRequest * msg)377 wifi_error wifi_nan_subscribe_cancel_request_stub(
378 transaction_id id, wifi_interface_handle iface,
379 NanSubscribeCancelRequest* msg) {
380 return WIFI_ERROR_NOT_SUPPORTED;
381 }
382
wifi_nan_transmit_followup_request_stub(transaction_id id,wifi_interface_handle iface,NanTransmitFollowupRequest * msg)383 wifi_error wifi_nan_transmit_followup_request_stub(
384 transaction_id id, wifi_interface_handle iface,
385 NanTransmitFollowupRequest* msg) {
386 return WIFI_ERROR_NOT_SUPPORTED;
387 }
388
wifi_nan_stats_request_stub(transaction_id id,wifi_interface_handle iface,NanStatsRequest * msg)389 wifi_error wifi_nan_stats_request_stub(transaction_id id,
390 wifi_interface_handle iface,
391 NanStatsRequest* msg) {
392 return WIFI_ERROR_NOT_SUPPORTED;
393 }
394
wifi_nan_config_request_stub(transaction_id id,wifi_interface_handle iface,NanConfigRequest * msg)395 wifi_error wifi_nan_config_request_stub(transaction_id id,
396 wifi_interface_handle iface,
397 NanConfigRequest* msg) {
398 return WIFI_ERROR_NOT_SUPPORTED;
399 }
400
wifi_nan_tca_request_stub(transaction_id id,wifi_interface_handle iface,NanTCARequest * msg)401 wifi_error wifi_nan_tca_request_stub(transaction_id id,
402 wifi_interface_handle iface,
403 NanTCARequest* msg) {
404 return WIFI_ERROR_NOT_SUPPORTED;
405 }
406
wifi_nan_beacon_sdf_payload_request_stub(transaction_id id,wifi_interface_handle iface,NanBeaconSdfPayloadRequest * msg)407 wifi_error wifi_nan_beacon_sdf_payload_request_stub(
408 transaction_id id, wifi_interface_handle iface,
409 NanBeaconSdfPayloadRequest* msg) {
410 return WIFI_ERROR_NOT_SUPPORTED;
411 }
412
wifi_nan_register_handler_stub(wifi_interface_handle iface,NanCallbackHandler handlers)413 wifi_error wifi_nan_register_handler_stub(wifi_interface_handle iface,
414 NanCallbackHandler handlers) {
415 return WIFI_ERROR_NOT_SUPPORTED;
416 }
417
wifi_nan_get_version_stub(wifi_handle handle,NanVersion * version)418 wifi_error wifi_nan_get_version_stub(wifi_handle handle, NanVersion* version) {
419 return WIFI_ERROR_NOT_SUPPORTED;
420 }
421
wifi_nan_get_capabilities_stub(transaction_id id,wifi_interface_handle iface)422 wifi_error wifi_nan_get_capabilities_stub(transaction_id id,
423 wifi_interface_handle iface) {
424 return WIFI_ERROR_NOT_SUPPORTED;
425 }
426
wifi_nan_data_interface_create_stub(transaction_id id,wifi_interface_handle iface,char * iface_name)427 wifi_error wifi_nan_data_interface_create_stub(transaction_id id,
428 wifi_interface_handle iface,
429 char* iface_name) {
430 return WIFI_ERROR_NOT_SUPPORTED;
431 }
432
wifi_nan_data_interface_delete_stub(transaction_id id,wifi_interface_handle iface,char * iface_name)433 wifi_error wifi_nan_data_interface_delete_stub(transaction_id id,
434 wifi_interface_handle iface,
435 char* iface_name) {
436 return WIFI_ERROR_NOT_SUPPORTED;
437 }
438
wifi_nan_data_request_initiator_stub(transaction_id id,wifi_interface_handle iface,NanDataPathInitiatorRequest * msg)439 wifi_error wifi_nan_data_request_initiator_stub(
440 transaction_id id, wifi_interface_handle iface,
441 NanDataPathInitiatorRequest* msg) {
442 return WIFI_ERROR_NOT_SUPPORTED;
443 }
444
wifi_nan_data_indication_response_stub(transaction_id id,wifi_interface_handle iface,NanDataPathIndicationResponse * msg)445 wifi_error wifi_nan_data_indication_response_stub(
446 transaction_id id, wifi_interface_handle iface,
447 NanDataPathIndicationResponse* msg) {
448 return WIFI_ERROR_NOT_SUPPORTED;
449 }
450
wifi_nan_data_end_stub(transaction_id id,wifi_interface_handle iface,NanDataPathEndRequest * msg)451 wifi_error wifi_nan_data_end_stub(transaction_id id,
452 wifi_interface_handle iface,
453 NanDataPathEndRequest* msg) {
454 return WIFI_ERROR_NOT_SUPPORTED;
455 }
456
wifi_get_packet_filter_capabilities_stub(wifi_interface_handle handle,u32 * version,u32 * max_len)457 wifi_error wifi_get_packet_filter_capabilities_stub(
458 wifi_interface_handle handle, u32* version, u32* max_len) {
459 return WIFI_ERROR_NOT_SUPPORTED;
460 }
461
wifi_set_packet_filter_stub(wifi_interface_handle handle,const u8 * program,u32 len)462 wifi_error wifi_set_packet_filter_stub(wifi_interface_handle handle,
463 const u8* program, u32 len) {
464 return WIFI_ERROR_NOT_SUPPORTED;
465 }
466
init_wifi_stub_hal_func_table(wifi_hal_fn * hal_fn)467 bool init_wifi_stub_hal_func_table(wifi_hal_fn* hal_fn) {
468 if (hal_fn == NULL) {
469 return false;
470 }
471 hal_fn->wifi_initialize = wifi_initialize_stub;
472 hal_fn->wifi_wait_for_driver_ready = wifi_wait_for_driver_ready_stub;
473 hal_fn->wifi_cleanup = wifi_cleanup_stub;
474 hal_fn->wifi_event_loop = wifi_event_loop_stub;
475 hal_fn->wifi_get_error_info = wifi_get_error_info_stub;
476 hal_fn->wifi_get_supported_feature_set = wifi_get_supported_feature_set_stub;
477 hal_fn->wifi_get_concurrency_matrix = wifi_get_concurrency_matrix_stub;
478 hal_fn->wifi_set_scanning_mac_oui = wifi_set_scanning_mac_oui_stub;
479 hal_fn->wifi_get_supported_channels = wifi_get_supported_channels_stub;
480 hal_fn->wifi_is_epr_supported = wifi_is_epr_supported_stub;
481 hal_fn->wifi_get_ifaces = wifi_get_ifaces_stub;
482 hal_fn->wifi_get_iface_name = wifi_get_iface_name_stub;
483 hal_fn->wifi_reset_iface_event_handler = wifi_reset_iface_event_handler_stub;
484 hal_fn->wifi_start_gscan = wifi_start_gscan_stub;
485 hal_fn->wifi_stop_gscan = wifi_stop_gscan_stub;
486 hal_fn->wifi_get_cached_gscan_results = wifi_get_cached_gscan_results_stub;
487 hal_fn->wifi_set_bssid_hotlist = wifi_set_bssid_hotlist_stub;
488 hal_fn->wifi_reset_bssid_hotlist = wifi_reset_bssid_hotlist_stub;
489 hal_fn->wifi_set_significant_change_handler =
490 wifi_set_significant_change_handler_stub;
491 hal_fn->wifi_reset_significant_change_handler =
492 wifi_reset_significant_change_handler_stub;
493 hal_fn->wifi_get_gscan_capabilities = wifi_get_gscan_capabilities_stub;
494 hal_fn->wifi_set_link_stats = wifi_set_link_stats_stub;
495 hal_fn->wifi_get_link_stats = wifi_get_link_stats_stub;
496 hal_fn->wifi_clear_link_stats = wifi_clear_link_stats_stub;
497 hal_fn->wifi_get_valid_channels = wifi_get_valid_channels_stub;
498 hal_fn->wifi_rtt_range_request = wifi_rtt_range_request_stub;
499 hal_fn->wifi_rtt_range_cancel = wifi_rtt_range_cancel_stub;
500 hal_fn->wifi_get_rtt_capabilities = wifi_get_rtt_capabilities_stub;
501 hal_fn->wifi_start_logging = wifi_start_logging_stub;
502 hal_fn->wifi_set_epno_list = wifi_set_epno_list_stub;
503 hal_fn->wifi_set_country_code = wifi_set_country_code_stub;
504 hal_fn->wifi_enable_tdls = wifi_enable_tdls_stub;
505 hal_fn->wifi_disable_tdls = wifi_disable_tdls_stub;
506 hal_fn->wifi_get_tdls_status = wifi_get_tdls_status_stub;
507 hal_fn->wifi_get_tdls_capabilities = wifi_get_tdls_capabilities_stub;
508 hal_fn->wifi_set_nodfs_flag = wifi_set_nodfs_flag_stub;
509 hal_fn->wifi_get_firmware_memory_dump = wifi_get_firmware_memory_dump_stub;
510 hal_fn->wifi_set_log_handler = wifi_set_log_handler_stub;
511 hal_fn->wifi_reset_log_handler = wifi_reset_log_handler_stub;
512 hal_fn->wifi_set_alert_handler = wifi_set_alert_handler_stub;
513 hal_fn->wifi_reset_alert_handler = wifi_reset_alert_handler_stub;
514 hal_fn->wifi_get_firmware_version = wifi_get_firmware_version_stub;
515 hal_fn->wifi_get_ring_buffers_status = wifi_get_ring_buffers_status_stub;
516 hal_fn->wifi_get_logger_supported_feature_set =
517 wifi_get_logger_supported_feature_set_stub;
518 hal_fn->wifi_get_ring_data = wifi_get_ring_data_stub;
519 hal_fn->wifi_get_driver_version = wifi_get_driver_version_stub;
520 hal_fn->wifi_start_sending_offloaded_packet =
521 wifi_start_sending_offloaded_packet_stub;
522 hal_fn->wifi_stop_sending_offloaded_packet =
523 wifi_stop_sending_offloaded_packet_stub;
524 hal_fn->wifi_get_wake_reason_stats = wifi_get_wake_reason_stats_stub;
525 hal_fn->wifi_configure_nd_offload = wifi_configure_nd_offload_stub;
526 hal_fn->wifi_get_driver_memory_dump = wifi_get_driver_memory_dump_stub;
527 hal_fn->wifi_start_pkt_fate_monitoring = wifi_start_pkt_fate_monitoring_stub;
528 hal_fn->wifi_get_tx_pkt_fates = wifi_get_tx_pkt_fates_stub;
529 hal_fn->wifi_get_rx_pkt_fates = wifi_get_rx_pkt_fates_stub;
530 hal_fn->wifi_nan_enable_request = wifi_nan_enable_request_stub;
531 hal_fn->wifi_nan_disable_request = wifi_nan_disable_request_stub;
532 hal_fn->wifi_nan_publish_request = wifi_nan_publish_request_stub;
533 hal_fn->wifi_nan_publish_cancel_request =
534 wifi_nan_publish_cancel_request_stub;
535 hal_fn->wifi_nan_subscribe_request = wifi_nan_subscribe_request_stub;
536 hal_fn->wifi_nan_subscribe_cancel_request =
537 wifi_nan_subscribe_cancel_request_stub;
538 hal_fn->wifi_nan_transmit_followup_request =
539 wifi_nan_transmit_followup_request_stub;
540 hal_fn->wifi_nan_stats_request = wifi_nan_stats_request_stub;
541 hal_fn->wifi_nan_config_request = wifi_nan_config_request_stub;
542 hal_fn->wifi_nan_tca_request = wifi_nan_tca_request_stub;
543 hal_fn->wifi_nan_beacon_sdf_payload_request =
544 wifi_nan_beacon_sdf_payload_request_stub;
545 hal_fn->wifi_nan_register_handler = wifi_nan_register_handler_stub;
546 hal_fn->wifi_nan_get_version = wifi_nan_get_version_stub;
547 hal_fn->wifi_nan_get_capabilities = wifi_nan_get_capabilities_stub;
548 hal_fn->wifi_nan_data_interface_create = wifi_nan_data_interface_create_stub;
549 hal_fn->wifi_nan_data_interface_delete = wifi_nan_data_interface_delete_stub;
550 hal_fn->wifi_nan_data_request_initiator =
551 wifi_nan_data_request_initiator_stub;
552 hal_fn->wifi_nan_data_indication_response =
553 wifi_nan_data_indication_response_stub;
554 hal_fn->wifi_nan_data_end = wifi_nan_data_end_stub;
555 hal_fn->wifi_get_packet_filter_capabilities =
556 wifi_get_packet_filter_capabilities_stub;
557 hal_fn->wifi_set_packet_filter = wifi_set_packet_filter_stub;
558
559 return true;
560 }
561
562 } // namespace
563
InitFunctionTable(wifi_hal_fn * hal_fn)564 bool HalTool::InitFunctionTable(wifi_hal_fn* hal_fn) {
565 #ifndef WIFI_MULTIPLE_VENDOR_HALS
566 if (!init_wifi_stub_hal_func_table(hal_fn)) {
567 LOG(ERROR) << "Can not initialize the basic function pointer table";
568 return false;
569 }
570
571 if (init_wifi_vendor_hal_func_table(hal_fn) != WIFI_SUCCESS) {
572 LOG(ERROR) << "Can not initialize the vendor function pointer table";
573 return false;
574 }
575
576 return true;
577 #else
578 // vendor HAL library are dynamically loaded from the WIFI HAL.
579 LOG(ERROR) << "InitFunctionTable no longer supported.";
580 return false;
581 #endif
582 }
583
CanGetValidChannels(wifi_hal_fn * hal_fn)584 bool HalTool::CanGetValidChannels(wifi_hal_fn* hal_fn) {
585 return hal_fn &&
586 (hal_fn->wifi_get_valid_channels != wifi_get_valid_channels_stub);
587 }
588
589 } // namespace wifi_system
590 } // namespace android
591