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
21namespace android {
22namespace wifi_system {
23namespace {
24
25wifi_error wifi_initialize_stub(wifi_handle* handle) {
26  return WIFI_ERROR_NOT_SUPPORTED;
27}
28
29wifi_error wifi_wait_for_driver_ready_stub(void) {
30  return WIFI_ERROR_NOT_SUPPORTED;
31}
32
33void wifi_cleanup_stub(wifi_handle handle, wifi_cleaned_up_handler handler) {}
34
35void wifi_event_loop_stub(wifi_handle handle) {}
36
37void wifi_get_error_info_stub(wifi_error err, const char** msg) { *msg = NULL; }
38
39wifi_error wifi_get_supported_feature_set_stub(wifi_interface_handle handle,
40                                               feature_set* set) {
41  return WIFI_ERROR_UNINITIALIZED;
42}
43
44wifi_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
50wifi_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 */
56wifi_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 */
62wifi_error wifi_is_epr_supported_stub(wifi_handle handle) {
63  return WIFI_ERROR_UNINITIALIZED;
64}
65
66/* multiple interface support */
67wifi_error wifi_get_ifaces_stub(wifi_handle handle, int* num_ifaces,
68                                wifi_interface_handle** ifaces) {
69  return WIFI_ERROR_UNINITIALIZED;
70}
71
72wifi_error wifi_get_iface_name_stub(wifi_interface_handle iface, char* name,
73                                    size_t size) {
74  return WIFI_ERROR_UNINITIALIZED;
75}
76
77wifi_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
83wifi_error wifi_reset_iface_event_handler_stub(wifi_request_id id,
84                                               wifi_interface_handle iface) {
85  return WIFI_ERROR_UNINITIALIZED;
86}
87
88wifi_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
95wifi_error wifi_stop_gscan_stub(wifi_request_id id,
96                                wifi_interface_handle iface) {
97  return WIFI_ERROR_UNINITIALIZED;
98}
99
100wifi_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
107wifi_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
114wifi_error wifi_reset_bssid_hotlist_stub(wifi_request_id id,
115                                         wifi_interface_handle iface) {
116  return WIFI_ERROR_UNINITIALIZED;
117}
118
119wifi_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
126wifi_error wifi_reset_significant_change_handler_stub(
127    wifi_request_id id, wifi_interface_handle iface) {
128  return WIFI_ERROR_UNINITIALIZED;
129}
130
131wifi_error wifi_get_gscan_capabilities_stub(
132    wifi_interface_handle handle, wifi_gscan_capabilities* capabilities) {
133  return WIFI_ERROR_UNINITIALIZED;
134}
135
136wifi_error wifi_set_link_stats_stub(wifi_interface_handle iface,
137                                    wifi_link_layer_params params) {
138  return WIFI_ERROR_UNINITIALIZED;
139}
140
141wifi_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
147wifi_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
154wifi_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 */
162wifi_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 */
171wifi_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 */
178wifi_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 */
184wifi_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 */
193wifi_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 */
199wifi_error wifi_rtt_get_available_channel_stub(wifi_interface_handle iface,
200                                               wifi_channel_info* channel) {
201  return WIFI_ERROR_NOT_SUPPORTED;
202}
203
204wifi_error wifi_set_nodfs_flag_stub(wifi_interface_handle iface, u32 nodfs) {
205  return WIFI_ERROR_NOT_SUPPORTED;
206}
207
208wifi_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
215wifi_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
221wifi_error wifi_reset_epno_list_stub(int id, wifi_interface_info* iface) {
222  return WIFI_ERROR_NOT_SUPPORTED;
223}
224
225wifi_error wifi_set_country_code_stub(wifi_interface_handle iface,
226                                      const char* code) {
227  return WIFI_ERROR_NOT_SUPPORTED;
228}
229
230wifi_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
235wifi_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
241wifi_error wifi_reset_log_handler_stub(wifi_request_id id,
242                                       wifi_interface_handle iface) {
243  return WIFI_ERROR_NOT_SUPPORTED;
244}
245
246wifi_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
252wifi_error wifi_reset_alert_handler_stub(wifi_request_id id,
253                                         wifi_interface_handle iface) {
254  return WIFI_ERROR_NOT_SUPPORTED;
255}
256
257wifi_error wifi_get_firmware_version_stub(wifi_interface_handle iface,
258                                          char* buffer, int buffer_size) {
259  return WIFI_ERROR_NOT_SUPPORTED;
260}
261
262wifi_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
268wifi_error wifi_get_logger_supported_feature_set_stub(
269    wifi_interface_handle iface, unsigned int* support) {
270  return WIFI_ERROR_NOT_SUPPORTED;
271}
272
273wifi_error wifi_get_ring_data_stub(wifi_interface_handle iface,
274                                   char* ring_name) {
275  return WIFI_ERROR_NOT_SUPPORTED;
276}
277
278wifi_error wifi_get_driver_version_stub(wifi_interface_handle iface,
279                                        char* buffer, int buffer_size) {
280  return WIFI_ERROR_NOT_SUPPORTED;
281}
282
283wifi_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
289wifi_error wifi_disable_tdls_stub(wifi_interface_handle iface, mac_addr addr) {
290  return WIFI_ERROR_NOT_SUPPORTED;
291}
292
293wifi_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
298wifi_error wifi_get_tdls_capabilities_stub(
299    wifi_interface_handle iface, wifi_tdls_capabilities* capabilities) {
300  return WIFI_ERROR_NOT_SUPPORTED;
301}
302
303wifi_error wifi_start_sending_offloaded_packet_stub(
304    wifi_request_id id, wifi_interface_handle iface, u8* ip_packet,
305    u16 ip_packet_len, u8* src_mac_addr, u8* dst_mac_addr, u32 period_msec) {
306  return WIFI_ERROR_NOT_SUPPORTED;
307}
308
309wifi_error wifi_stop_sending_offloaded_packet_stub(
310    wifi_request_id id, wifi_interface_handle iface) {
311  return WIFI_ERROR_NOT_SUPPORTED;
312}
313
314wifi_error wifi_get_wake_reason_stats_stub(
315    wifi_interface_handle iface,
316    WLAN_DRIVER_WAKE_REASON_CNT* wifi_wake_reason_cnt) {
317  return WIFI_ERROR_NOT_SUPPORTED;
318}
319
320wifi_error wifi_configure_nd_offload_stub(wifi_interface_handle iface,
321                                          u8 enable) {
322  return WIFI_ERROR_NOT_SUPPORTED;
323}
324
325wifi_error wifi_get_driver_memory_dump_stub(
326    wifi_interface_handle iface, wifi_driver_memory_dump_callbacks callbacks) {
327  return WIFI_ERROR_NOT_SUPPORTED;
328}
329
330wifi_error wifi_start_pkt_fate_monitoring_stub(wifi_interface_handle iface) {
331  return WIFI_ERROR_NOT_SUPPORTED;
332}
333
334wifi_error wifi_get_tx_pkt_fates_stub(wifi_interface_handle handle,
335                                      wifi_tx_report* tx_report_bufs,
336                                      size_t n_requested_fates,
337                                      size_t* n_provided_fates) {
338  return WIFI_ERROR_NOT_SUPPORTED;
339}
340
341wifi_error wifi_get_rx_pkt_fates_stub(wifi_interface_handle handle,
342                                      wifi_rx_report* rx_report_bufs,
343                                      size_t n_requested_fates,
344                                      size_t* n_provided_fates) {
345  return WIFI_ERROR_NOT_SUPPORTED;
346}
347wifi_error wifi_nan_enable_request_stub(transaction_id id,
348                                        wifi_interface_handle iface,
349                                        NanEnableRequest* msg) {
350  return WIFI_ERROR_NOT_SUPPORTED;
351}
352
353wifi_error wifi_nan_disable_request_stub(transaction_id id,
354                                         wifi_interface_handle iface) {
355  return WIFI_ERROR_NOT_SUPPORTED;
356}
357
358wifi_error wifi_nan_publish_request_stub(transaction_id id,
359                                         wifi_interface_handle iface,
360                                         NanPublishRequest* msg) {
361  return WIFI_ERROR_NOT_SUPPORTED;
362}
363
364wifi_error wifi_nan_publish_cancel_request_stub(transaction_id id,
365                                                wifi_interface_handle iface,
366                                                NanPublishCancelRequest* msg) {
367  return WIFI_ERROR_NOT_SUPPORTED;
368}
369
370wifi_error wifi_nan_subscribe_request_stub(transaction_id id,
371                                           wifi_interface_handle iface,
372                                           NanSubscribeRequest* msg) {
373  return WIFI_ERROR_NOT_SUPPORTED;
374}
375
376wifi_error wifi_nan_subscribe_cancel_request_stub(
377    transaction_id id, wifi_interface_handle iface,
378    NanSubscribeCancelRequest* msg) {
379  return WIFI_ERROR_NOT_SUPPORTED;
380}
381
382wifi_error wifi_nan_transmit_followup_request_stub(
383    transaction_id id, wifi_interface_handle iface,
384    NanTransmitFollowupRequest* msg) {
385  return WIFI_ERROR_NOT_SUPPORTED;
386}
387
388wifi_error wifi_nan_stats_request_stub(transaction_id id,
389                                       wifi_interface_handle iface,
390                                       NanStatsRequest* msg) {
391  return WIFI_ERROR_NOT_SUPPORTED;
392}
393
394wifi_error wifi_nan_config_request_stub(transaction_id id,
395                                        wifi_interface_handle iface,
396                                        NanConfigRequest* msg) {
397  return WIFI_ERROR_NOT_SUPPORTED;
398}
399
400wifi_error wifi_nan_tca_request_stub(transaction_id id,
401                                     wifi_interface_handle iface,
402                                     NanTCARequest* msg) {
403  return WIFI_ERROR_NOT_SUPPORTED;
404}
405
406wifi_error wifi_nan_beacon_sdf_payload_request_stub(
407    transaction_id id, wifi_interface_handle iface,
408    NanBeaconSdfPayloadRequest* msg) {
409  return WIFI_ERROR_NOT_SUPPORTED;
410}
411
412wifi_error wifi_nan_register_handler_stub(wifi_interface_handle iface,
413                                          NanCallbackHandler handlers) {
414  return WIFI_ERROR_NOT_SUPPORTED;
415}
416
417wifi_error wifi_nan_get_version_stub(wifi_handle handle, NanVersion* version) {
418  return WIFI_ERROR_NOT_SUPPORTED;
419}
420
421wifi_error wifi_nan_get_capabilities_stub(transaction_id id,
422                                          wifi_interface_handle iface) {
423  return WIFI_ERROR_NOT_SUPPORTED;
424}
425
426wifi_error wifi_nan_data_interface_create_stub(transaction_id id,
427                                               wifi_interface_handle iface,
428                                               char* iface_name) {
429  return WIFI_ERROR_NOT_SUPPORTED;
430}
431
432wifi_error wifi_nan_data_interface_delete_stub(transaction_id id,
433                                               wifi_interface_handle iface,
434                                               char* iface_name) {
435  return WIFI_ERROR_NOT_SUPPORTED;
436}
437
438wifi_error wifi_nan_data_request_initiator_stub(
439    transaction_id id, wifi_interface_handle iface,
440    NanDataPathInitiatorRequest* msg) {
441  return WIFI_ERROR_NOT_SUPPORTED;
442}
443
444wifi_error wifi_nan_data_indication_response_stub(
445    transaction_id id, wifi_interface_handle iface,
446    NanDataPathIndicationResponse* msg) {
447  return WIFI_ERROR_NOT_SUPPORTED;
448}
449
450wifi_error wifi_nan_data_end_stub(transaction_id id,
451                                  wifi_interface_handle iface,
452                                  NanDataPathEndRequest* msg) {
453  return WIFI_ERROR_NOT_SUPPORTED;
454}
455
456wifi_error wifi_get_packet_filter_capabilities_stub(
457    wifi_interface_handle handle, u32* version, u32* max_len) {
458  return WIFI_ERROR_NOT_SUPPORTED;
459}
460
461wifi_error wifi_set_packet_filter_stub(wifi_interface_handle handle,
462                                       const u8* program, u32 len) {
463  return WIFI_ERROR_NOT_SUPPORTED;
464}
465
466bool init_wifi_stub_hal_func_table(wifi_hal_fn* hal_fn) {
467  if (hal_fn == NULL) {
468    return false;
469  }
470  hal_fn->wifi_initialize = wifi_initialize_stub;
471  hal_fn->wifi_wait_for_driver_ready = wifi_wait_for_driver_ready_stub;
472  hal_fn->wifi_cleanup = wifi_cleanup_stub;
473  hal_fn->wifi_event_loop = wifi_event_loop_stub;
474  hal_fn->wifi_get_error_info = wifi_get_error_info_stub;
475  hal_fn->wifi_get_supported_feature_set = wifi_get_supported_feature_set_stub;
476  hal_fn->wifi_get_concurrency_matrix = wifi_get_concurrency_matrix_stub;
477  hal_fn->wifi_set_scanning_mac_oui = wifi_set_scanning_mac_oui_stub;
478  hal_fn->wifi_get_supported_channels = wifi_get_supported_channels_stub;
479  hal_fn->wifi_is_epr_supported = wifi_is_epr_supported_stub;
480  hal_fn->wifi_get_ifaces = wifi_get_ifaces_stub;
481  hal_fn->wifi_get_iface_name = wifi_get_iface_name_stub;
482  hal_fn->wifi_reset_iface_event_handler = wifi_reset_iface_event_handler_stub;
483  hal_fn->wifi_start_gscan = wifi_start_gscan_stub;
484  hal_fn->wifi_stop_gscan = wifi_stop_gscan_stub;
485  hal_fn->wifi_get_cached_gscan_results = wifi_get_cached_gscan_results_stub;
486  hal_fn->wifi_set_bssid_hotlist = wifi_set_bssid_hotlist_stub;
487  hal_fn->wifi_reset_bssid_hotlist = wifi_reset_bssid_hotlist_stub;
488  hal_fn->wifi_set_significant_change_handler =
489      wifi_set_significant_change_handler_stub;
490  hal_fn->wifi_reset_significant_change_handler =
491      wifi_reset_significant_change_handler_stub;
492  hal_fn->wifi_get_gscan_capabilities = wifi_get_gscan_capabilities_stub;
493  hal_fn->wifi_set_link_stats = wifi_set_link_stats_stub;
494  hal_fn->wifi_get_link_stats = wifi_get_link_stats_stub;
495  hal_fn->wifi_clear_link_stats = wifi_clear_link_stats_stub;
496  hal_fn->wifi_get_valid_channels = wifi_get_valid_channels_stub;
497  hal_fn->wifi_rtt_range_request = wifi_rtt_range_request_stub;
498  hal_fn->wifi_rtt_range_cancel = wifi_rtt_range_cancel_stub;
499  hal_fn->wifi_get_rtt_capabilities = wifi_get_rtt_capabilities_stub;
500  hal_fn->wifi_start_logging = wifi_start_logging_stub;
501  hal_fn->wifi_set_epno_list = wifi_set_epno_list_stub;
502  hal_fn->wifi_set_country_code = wifi_set_country_code_stub;
503  hal_fn->wifi_enable_tdls = wifi_enable_tdls_stub;
504  hal_fn->wifi_disable_tdls = wifi_disable_tdls_stub;
505  hal_fn->wifi_get_tdls_status = wifi_get_tdls_status_stub;
506  hal_fn->wifi_get_tdls_capabilities = wifi_get_tdls_capabilities_stub;
507  hal_fn->wifi_set_nodfs_flag = wifi_set_nodfs_flag_stub;
508  hal_fn->wifi_get_firmware_memory_dump = wifi_get_firmware_memory_dump_stub;
509  hal_fn->wifi_set_log_handler = wifi_set_log_handler_stub;
510  hal_fn->wifi_reset_log_handler = wifi_reset_log_handler_stub;
511  hal_fn->wifi_set_alert_handler = wifi_set_alert_handler_stub;
512  hal_fn->wifi_reset_alert_handler = wifi_reset_alert_handler_stub;
513  hal_fn->wifi_get_firmware_version = wifi_get_firmware_version_stub;
514  hal_fn->wifi_get_ring_buffers_status = wifi_get_ring_buffers_status_stub;
515  hal_fn->wifi_get_logger_supported_feature_set =
516      wifi_get_logger_supported_feature_set_stub;
517  hal_fn->wifi_get_ring_data = wifi_get_ring_data_stub;
518  hal_fn->wifi_get_driver_version = wifi_get_driver_version_stub;
519  hal_fn->wifi_start_sending_offloaded_packet =
520      wifi_start_sending_offloaded_packet_stub;
521  hal_fn->wifi_stop_sending_offloaded_packet =
522      wifi_stop_sending_offloaded_packet_stub;
523  hal_fn->wifi_get_wake_reason_stats = wifi_get_wake_reason_stats_stub;
524  hal_fn->wifi_configure_nd_offload = wifi_configure_nd_offload_stub;
525  hal_fn->wifi_get_driver_memory_dump = wifi_get_driver_memory_dump_stub;
526  hal_fn->wifi_start_pkt_fate_monitoring = wifi_start_pkt_fate_monitoring_stub;
527  hal_fn->wifi_get_tx_pkt_fates = wifi_get_tx_pkt_fates_stub;
528  hal_fn->wifi_get_rx_pkt_fates = wifi_get_rx_pkt_fates_stub;
529  hal_fn->wifi_nan_enable_request = wifi_nan_enable_request_stub;
530  hal_fn->wifi_nan_disable_request = wifi_nan_disable_request_stub;
531  hal_fn->wifi_nan_publish_request = wifi_nan_publish_request_stub;
532  hal_fn->wifi_nan_publish_cancel_request =
533      wifi_nan_publish_cancel_request_stub;
534  hal_fn->wifi_nan_subscribe_request = wifi_nan_subscribe_request_stub;
535  hal_fn->wifi_nan_subscribe_cancel_request =
536      wifi_nan_subscribe_cancel_request_stub;
537  hal_fn->wifi_nan_transmit_followup_request =
538      wifi_nan_transmit_followup_request_stub;
539  hal_fn->wifi_nan_stats_request = wifi_nan_stats_request_stub;
540  hal_fn->wifi_nan_config_request = wifi_nan_config_request_stub;
541  hal_fn->wifi_nan_tca_request = wifi_nan_tca_request_stub;
542  hal_fn->wifi_nan_beacon_sdf_payload_request =
543      wifi_nan_beacon_sdf_payload_request_stub;
544  hal_fn->wifi_nan_register_handler = wifi_nan_register_handler_stub;
545  hal_fn->wifi_nan_get_version = wifi_nan_get_version_stub;
546  hal_fn->wifi_nan_get_capabilities = wifi_nan_get_capabilities_stub;
547  hal_fn->wifi_nan_data_interface_create = wifi_nan_data_interface_create_stub;
548  hal_fn->wifi_nan_data_interface_delete = wifi_nan_data_interface_delete_stub;
549  hal_fn->wifi_nan_data_request_initiator =
550      wifi_nan_data_request_initiator_stub;
551  hal_fn->wifi_nan_data_indication_response =
552      wifi_nan_data_indication_response_stub;
553  hal_fn->wifi_nan_data_end = wifi_nan_data_end_stub;
554  hal_fn->wifi_get_packet_filter_capabilities =
555      wifi_get_packet_filter_capabilities_stub;
556  hal_fn->wifi_set_packet_filter = wifi_set_packet_filter_stub;
557
558  return true;
559}
560
561}  // namespace
562
563bool HalTool::InitFunctionTable(wifi_hal_fn* hal_fn) {
564  if (!init_wifi_stub_hal_func_table(hal_fn)) {
565    LOG(ERROR) << "Can not initialize the basic function pointer table";
566    return false;
567  }
568
569  if (init_wifi_vendor_hal_func_table(hal_fn) != WIFI_SUCCESS) {
570    LOG(ERROR) << "Can not initialize the vendor function pointer table";
571    return false;
572  }
573
574  return true;
575}
576
577bool HalTool::CanGetValidChannels(wifi_hal_fn* hal_fn) {
578  return hal_fn &&
579         (hal_fn->wifi_get_valid_channels != wifi_get_valid_channels_stub);
580}
581
582}  // namespace wifi_system
583}  // namespace android
584