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_legacy_hal_stubs.h" 18 19 // TODO: Remove these stubs from HalTool in libwifi-system. 20 namespace android { 21 namespace hardware { 22 namespace wifi { 23 namespace V1_4 { 24 namespace implementation { 25 namespace legacy_hal { 26 template <typename> 27 struct stubFunction; 28 29 template <typename R, typename... Args> 30 struct stubFunction<R (*)(Args...)> { invokeandroid::hardware::wifi::V1_4::implementation::legacy_hal::stubFunction31 static constexpr R invoke(Args...) { return WIFI_ERROR_NOT_SUPPORTED; } 32 }; 33 template <typename... Args> 34 struct stubFunction<void (*)(Args...)> { invokeandroid::hardware::wifi::V1_4::implementation::legacy_hal::stubFunction35 static constexpr void invoke(Args...) {} 36 }; 37 38 template <typename T> populateStubFor(T * val)39void populateStubFor(T* val) { 40 *val = &stubFunction<T>::invoke; 41 } 42 initHalFuncTableWithStubs(wifi_hal_fn * hal_fn)43bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { 44 if (hal_fn == nullptr) { 45 return false; 46 } 47 populateStubFor(&hal_fn->wifi_initialize); 48 populateStubFor(&hal_fn->wifi_wait_for_driver_ready); 49 populateStubFor(&hal_fn->wifi_cleanup); 50 populateStubFor(&hal_fn->wifi_event_loop); 51 populateStubFor(&hal_fn->wifi_get_error_info); 52 populateStubFor(&hal_fn->wifi_get_supported_feature_set); 53 populateStubFor(&hal_fn->wifi_get_concurrency_matrix); 54 populateStubFor(&hal_fn->wifi_set_scanning_mac_oui); 55 populateStubFor(&hal_fn->wifi_get_supported_channels); 56 populateStubFor(&hal_fn->wifi_is_epr_supported); 57 populateStubFor(&hal_fn->wifi_get_ifaces); 58 populateStubFor(&hal_fn->wifi_get_iface_name); 59 populateStubFor(&hal_fn->wifi_set_iface_event_handler); 60 populateStubFor(&hal_fn->wifi_reset_iface_event_handler); 61 populateStubFor(&hal_fn->wifi_start_gscan); 62 populateStubFor(&hal_fn->wifi_stop_gscan); 63 populateStubFor(&hal_fn->wifi_get_cached_gscan_results); 64 populateStubFor(&hal_fn->wifi_set_bssid_hotlist); 65 populateStubFor(&hal_fn->wifi_reset_bssid_hotlist); 66 populateStubFor(&hal_fn->wifi_set_significant_change_handler); 67 populateStubFor(&hal_fn->wifi_reset_significant_change_handler); 68 populateStubFor(&hal_fn->wifi_get_gscan_capabilities); 69 populateStubFor(&hal_fn->wifi_set_link_stats); 70 populateStubFor(&hal_fn->wifi_get_link_stats); 71 populateStubFor(&hal_fn->wifi_clear_link_stats); 72 populateStubFor(&hal_fn->wifi_get_valid_channels); 73 populateStubFor(&hal_fn->wifi_rtt_range_request); 74 populateStubFor(&hal_fn->wifi_rtt_range_cancel); 75 populateStubFor(&hal_fn->wifi_get_rtt_capabilities); 76 populateStubFor(&hal_fn->wifi_rtt_get_responder_info); 77 populateStubFor(&hal_fn->wifi_enable_responder); 78 populateStubFor(&hal_fn->wifi_disable_responder); 79 populateStubFor(&hal_fn->wifi_set_nodfs_flag); 80 populateStubFor(&hal_fn->wifi_start_logging); 81 populateStubFor(&hal_fn->wifi_set_epno_list); 82 populateStubFor(&hal_fn->wifi_reset_epno_list); 83 populateStubFor(&hal_fn->wifi_set_country_code); 84 populateStubFor(&hal_fn->wifi_get_firmware_memory_dump); 85 populateStubFor(&hal_fn->wifi_set_log_handler); 86 populateStubFor(&hal_fn->wifi_reset_log_handler); 87 populateStubFor(&hal_fn->wifi_set_alert_handler); 88 populateStubFor(&hal_fn->wifi_reset_alert_handler); 89 populateStubFor(&hal_fn->wifi_get_firmware_version); 90 populateStubFor(&hal_fn->wifi_get_ring_buffers_status); 91 populateStubFor(&hal_fn->wifi_get_logger_supported_feature_set); 92 populateStubFor(&hal_fn->wifi_get_ring_data); 93 populateStubFor(&hal_fn->wifi_enable_tdls); 94 populateStubFor(&hal_fn->wifi_disable_tdls); 95 populateStubFor(&hal_fn->wifi_get_tdls_status); 96 populateStubFor(&hal_fn->wifi_get_tdls_capabilities); 97 populateStubFor(&hal_fn->wifi_get_driver_version); 98 populateStubFor(&hal_fn->wifi_set_passpoint_list); 99 populateStubFor(&hal_fn->wifi_reset_passpoint_list); 100 populateStubFor(&hal_fn->wifi_set_lci); 101 populateStubFor(&hal_fn->wifi_set_lcr); 102 populateStubFor(&hal_fn->wifi_start_sending_offloaded_packet); 103 populateStubFor(&hal_fn->wifi_stop_sending_offloaded_packet); 104 populateStubFor(&hal_fn->wifi_start_rssi_monitoring); 105 populateStubFor(&hal_fn->wifi_stop_rssi_monitoring); 106 populateStubFor(&hal_fn->wifi_get_wake_reason_stats); 107 populateStubFor(&hal_fn->wifi_configure_nd_offload); 108 populateStubFor(&hal_fn->wifi_get_driver_memory_dump); 109 populateStubFor(&hal_fn->wifi_start_pkt_fate_monitoring); 110 populateStubFor(&hal_fn->wifi_get_tx_pkt_fates); 111 populateStubFor(&hal_fn->wifi_get_rx_pkt_fates); 112 populateStubFor(&hal_fn->wifi_nan_enable_request); 113 populateStubFor(&hal_fn->wifi_nan_disable_request); 114 populateStubFor(&hal_fn->wifi_nan_publish_request); 115 populateStubFor(&hal_fn->wifi_nan_publish_cancel_request); 116 populateStubFor(&hal_fn->wifi_nan_subscribe_request); 117 populateStubFor(&hal_fn->wifi_nan_subscribe_cancel_request); 118 populateStubFor(&hal_fn->wifi_nan_transmit_followup_request); 119 populateStubFor(&hal_fn->wifi_nan_stats_request); 120 populateStubFor(&hal_fn->wifi_nan_config_request); 121 populateStubFor(&hal_fn->wifi_nan_tca_request); 122 populateStubFor(&hal_fn->wifi_nan_beacon_sdf_payload_request); 123 populateStubFor(&hal_fn->wifi_nan_register_handler); 124 populateStubFor(&hal_fn->wifi_nan_get_version); 125 populateStubFor(&hal_fn->wifi_nan_get_capabilities); 126 populateStubFor(&hal_fn->wifi_nan_data_interface_create); 127 populateStubFor(&hal_fn->wifi_nan_data_interface_delete); 128 populateStubFor(&hal_fn->wifi_nan_data_request_initiator); 129 populateStubFor(&hal_fn->wifi_nan_data_indication_response); 130 populateStubFor(&hal_fn->wifi_nan_data_end); 131 populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); 132 populateStubFor(&hal_fn->wifi_set_packet_filter); 133 populateStubFor(&hal_fn->wifi_read_packet_filter); 134 populateStubFor(&hal_fn->wifi_get_roaming_capabilities); 135 populateStubFor(&hal_fn->wifi_enable_firmware_roaming); 136 populateStubFor(&hal_fn->wifi_configure_roaming); 137 populateStubFor(&hal_fn->wifi_select_tx_power_scenario); 138 populateStubFor(&hal_fn->wifi_reset_tx_power_scenario); 139 populateStubFor(&hal_fn->wifi_set_radio_mode_change_handler); 140 populateStubFor(&hal_fn->wifi_set_latency_mode); 141 populateStubFor(&hal_fn->wifi_set_thermal_mitigation_mode); 142 populateStubFor(&hal_fn->wifi_virtual_interface_create); 143 populateStubFor(&hal_fn->wifi_virtual_interface_delete); 144 populateStubFor(&hal_fn->wifi_map_dscp_access_category); 145 populateStubFor(&hal_fn->wifi_reset_dscp_mapping); 146 return true; 147 } 148 } // namespace legacy_hal 149 } // namespace implementation 150 } // namespace V1_4 151 } // namespace wifi 152 } // namespace hardware 153 } // namespace android 154