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 #ifndef __WIFI_HAL_H__
18 #define __WIFI_HAL_H__
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 #include <stdint.h>
25 
26 #define IFNAMSIZ 16
27 
28 /* WiFi Common definitions */
29 /* channel operating width */
30 typedef enum {
31     WIFI_CHAN_WIDTH_20    = 0,
32     WIFI_CHAN_WIDTH_40    = 1,
33     WIFI_CHAN_WIDTH_80    = 2,
34     WIFI_CHAN_WIDTH_160   = 3,
35     WIFI_CHAN_WIDTH_80P80 = 4,
36     WIFI_CHAN_WIDTH_5     = 5,
37     WIFI_CHAN_WIDTH_10    = 6,
38     WIFI_CHAN_WIDTH_INVALID = -1
39 } wifi_channel_width;
40 
41 /* Pre selected Power scenarios to be applied from BDF file */
42 typedef enum {
43     WIFI_POWER_SCENARIO_INVALID          = -2,
44     WIFI_POWER_SCENARIO_DEFAULT          = -1,
45     WIFI_POWER_SCENARIO_VOICE_CALL       = 0,
46     WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1,
47     WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON  = 2,
48     WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3,
49     WIFI_POWER_SCENARIO_ON_BODY_CELL_ON  = 4,
50     WIFI_POWER_SCENARIO_ON_BODY_BT       = 5,
51 } wifi_power_scenario;
52 
53 typedef enum {
54   WIFI_LATENCY_MODE_NORMAL    = 0,
55   WIFI_LATENCY_MODE_LOW       = 1,
56 } wifi_latency_mode;
57 
58 /*
59  * enum wlan_mac_band - Band information corresponding to the WLAN MAC.
60  */
61 typedef enum {
62 /* WLAN MAC Operates in 2.4 GHz Band */
63     WLAN_MAC_2_4_BAND = 1 << 0,
64 /* WLAN MAC Operates in 5 GHz Band */
65     WLAN_MAC_5_0_BAND = 1 << 1
66 } wlan_mac_band;
67 
68 typedef int wifi_radio;
69 typedef int wifi_channel;
70 
71 typedef struct {
72     wifi_channel_width width;
73     int center_frequency0;
74     int center_frequency1;
75     int primary_frequency;
76 } wifi_channel_spec;
77 
78 typedef enum {
79     WIFI_SUCCESS = 0,
80     WIFI_ERROR_NONE = 0,
81     WIFI_ERROR_UNKNOWN = -1,
82     WIFI_ERROR_UNINITIALIZED = -2,
83     WIFI_ERROR_NOT_SUPPORTED = -3,
84     WIFI_ERROR_NOT_AVAILABLE = -4,              // Not available right now, but try later
85     WIFI_ERROR_INVALID_ARGS = -5,
86     WIFI_ERROR_INVALID_REQUEST_ID = -6,
87     WIFI_ERROR_TIMED_OUT = -7,
88     WIFI_ERROR_TOO_MANY_REQUESTS = -8,          // Too many instances of this request
89     WIFI_ERROR_OUT_OF_MEMORY = -9,
90     WIFI_ERROR_BUSY = -10,
91 } wifi_error;
92 
93 typedef unsigned char byte;
94 typedef unsigned char u8;
95 typedef signed char s8;
96 typedef uint16_t u16;
97 typedef uint32_t u32;
98 typedef int32_t s32;
99 typedef uint64_t u64;
100 typedef int64_t s64;
101 typedef int wifi_request_id;
102 typedef int wifi_channel;                       // indicates channel frequency in MHz
103 typedef int wifi_rssi;
104 typedef byte mac_addr[6];
105 typedef byte oui[3];
106 typedef int64_t wifi_timestamp;                 // In microseconds (us)
107 typedef int64_t wifi_timespan;                  // In picoseconds  (ps)
108 
109 struct wifi_info;
110 struct wifi_interface_info;
111 typedef struct wifi_info *wifi_handle;
112 typedef struct wifi_interface_info *wifi_interface_handle;
113 
114 /* Initialize/Cleanup */
115 
116 wifi_error wifi_initialize(wifi_handle *handle);
117 
118 /**
119  * wifi_wait_for_driver
120  * Function should block until the driver is ready to proceed.
121  * Any errors from this function is considered fatal & will fail the HAL startup sequence.
122  *
123  * on success returns WIFI_SUCCESS
124  * on failure returns WIFI_ERROR_TIMED_OUT
125  */
126 wifi_error wifi_wait_for_driver_ready(void);
127 
128 typedef void (*wifi_cleaned_up_handler) (wifi_handle handle);
129 void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler);
130 void wifi_event_loop(wifi_handle handle);
131 
132 /* Error handling */
133 void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer to a static string
134 
135 /* Feature enums */
136 #define WIFI_FEATURE_INFRA              0x0001      // Basic infrastructure mode
137 #define WIFI_FEATURE_INFRA_5G           0x0002      // Support for 5 GHz Band
138 #define WIFI_FEATURE_HOTSPOT            0x0004      // Support for GAS/ANQP
139 #define WIFI_FEATURE_P2P                0x0008      // Wifi-Direct
140 #define WIFI_FEATURE_SOFT_AP            0x0010      // Soft AP
141 #define WIFI_FEATURE_GSCAN              0x0020      // Google-Scan APIs
142 #define WIFI_FEATURE_NAN                0x0040      // Neighbor Awareness Networking
143 #define WIFI_FEATURE_D2D_RTT            0x0080      // Device-to-device RTT
144 #define WIFI_FEATURE_D2AP_RTT           0x0100      // Device-to-AP RTT
145 #define WIFI_FEATURE_BATCH_SCAN         0x0200      // Batched Scan (legacy)
146 #define WIFI_FEATURE_PNO                0x0400      // Preferred network offload
147 #define WIFI_FEATURE_ADDITIONAL_STA     0x0800      // Support for two STAs
148 #define WIFI_FEATURE_TDLS               0x1000      // Tunnel directed link setup
149 #define WIFI_FEATURE_TDLS_OFFCHANNEL    0x2000      // Support for TDLS off channel
150 #define WIFI_FEATURE_EPR                0x4000      // Enhanced power reporting
151 #define WIFI_FEATURE_AP_STA             0x8000      // Support for AP STA Concurrency
152 #define WIFI_FEATURE_LINK_LAYER_STATS   0x10000     // Link layer stats collection
153 #define WIFI_FEATURE_LOGGER             0x20000     // WiFi Logger
154 #define WIFI_FEATURE_HAL_EPNO           0x40000     // WiFi PNO enhanced
155 #define WIFI_FEATURE_RSSI_MONITOR       0x80000     // RSSI Monitor
156 #define WIFI_FEATURE_MKEEP_ALIVE        0x100000    // WiFi mkeep_alive
157 #define WIFI_FEATURE_CONFIG_NDO         0x200000    // ND offload configure
158 #define WIFI_FEATURE_TX_TRANSMIT_POWER  0x400000    // Capture Tx transmit power levels
159 #define WIFI_FEATURE_CONTROL_ROAMING    0x800000    // Enable/Disable firmware roaming
160 #define WIFI_FEATURE_IE_WHITELIST       0x1000000   // Support Probe IE white listing
161 #define WIFI_FEATURE_SCAN_RAND          0x2000000   // Support MAC & Probe Sequence Number randomization
162 #define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000   // Support Tx Power Limit setting
163 #define WIFI_FEATURE_USE_BODY_HEAD_SAR  0x8000000   // Support Using Body/Head Proximity for SAR
164 #define WIFI_FEATURE_SET_LATENCY_MODE   0x40000000  // Support Latency mode setting
165 #define WIFI_FEATURE_P2P_RAND_MAC       0x80000000  // Support Support P2P MAC randomization
166 // Add more features here
167 
168 
169 typedef int feature_set;
170 
171 #define IS_MASK_SET(mask, flags)        (((flags) & (mask)) == (mask))
172 
173 #define IS_SUPPORTED_FEATURE(feature, featureSet)       IS_MASK_SET(feature, featureSet)
174 
175 /* Feature set */
176 wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set);
177 
178 /*
179  * Each row represents a valid feature combination;
180  * all other combinations are invalid!
181  */
182 wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max,
183         feature_set set[], int *set_size);
184 
185 /* multiple interface support */
186 
187 wifi_error wifi_get_ifaces(wifi_handle handle, int *num_ifaces, wifi_interface_handle **ifaces);
188 wifi_error wifi_get_iface_name(wifi_interface_handle iface, char *name, size_t size);
189 wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name);
190 
191 /* Configuration events */
192 
193 typedef struct {
194     void (*on_country_code_changed)(char code[2]);      // We can get this from supplicant too
195 
196     // More event handlers
197 } wifi_event_handler;
198 
199 typedef struct {
200     char iface_name[IFNAMSIZ + 1];
201     wifi_channel channel;
202 } wifi_iface_info;
203 
204 typedef struct {
205     u32 wlan_mac_id;
206 /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */
207     u32 mac_band;
208 /* Represents the connected Wi-Fi interfaces associated with each MAC */
209     int num_iface;
210     wifi_iface_info *iface_info;
211 } wifi_mac_info;
212 
213 typedef struct {
214         void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac,
215                                      wifi_mac_info *mac_info);
216 } wifi_radio_mode_change_handler;
217 
218 typedef struct {
219         void (*on_rssi_threshold_breached)(wifi_request_id id, u8 *cur_bssid, s8 cur_rssi);
220 } wifi_rssi_event_handler;
221 
222 wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh);
223 wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface);
224 
225 wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs);
226 wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario);
227 wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle);
228 wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode);
229 
230 typedef struct rx_data_cnt_details_t {
231     int rx_unicast_cnt;     /*Total rx unicast packet which woke up host */
232     int rx_multicast_cnt;   /*Total rx multicast packet which woke up host */
233     int rx_broadcast_cnt;   /*Total rx broadcast packet which woke up host */
234 } RX_DATA_WAKE_CNT_DETAILS;
235 
236 typedef struct rx_wake_pkt_type_classification_t {
237     int icmp_pkt;   /*wake icmp packet count */
238     int icmp6_pkt;  /*wake icmp6 packet count */
239     int icmp6_ra;   /*wake icmp6 RA packet count */
240     int icmp6_na;   /*wake icmp6 NA packet count */
241     int icmp6_ns;   /*wake icmp6 NS packet count */
242     //ToDo: Any more interesting classification to add?
243 } RX_WAKE_PKT_TYPE_CLASSFICATION;
244 
245 typedef struct rx_multicast_cnt_t{
246     int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */
247     int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */
248     int other_rx_multicast_addr_cnt;/*Rx wake packet was non-ipv4 and non-ipv6*/
249 } RX_MULTICAST_WAKE_DATA_CNT;
250 
251 /*
252  * Structure holding all the driver/firmware wake count reasons.
253  *
254  * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt)
255  * are allocated and freed by the framework. The size of each allocated
256  * array is indicated by the corresponding |_cnt| field. HAL needs to fill in
257  * the corresponding |_used| field to indicate the number of elements used in
258  * the array.
259  */
260 typedef struct wlan_driver_wake_reason_cnt_t {
261     int total_cmd_event_wake;    /* Total count of cmd event wakes */
262     int *cmd_event_wake_cnt;     /* Individual wake count array, each index a reason */
263     int cmd_event_wake_cnt_sz;   /* Max number of cmd event wake reasons */
264     int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */
265 
266     int total_driver_fw_local_wake;    /* Total count of drive/fw wakes, for local reasons */
267     int *driver_fw_local_wake_cnt;     /* Individual wake count array, each index a reason */
268     int driver_fw_local_wake_cnt_sz;   /* Max number of local driver/fw wake reasons */
269     int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the driver */
270 
271     int total_rx_data_wake;     /* total data rx packets, that woke up host */
272     RX_DATA_WAKE_CNT_DETAILS rx_wake_details;
273     RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info;
274     RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info;
275 } WLAN_DRIVER_WAKE_REASON_CNT;
276 
277 /* include various feature headers */
278 
279 #include "gscan.h"
280 #include "link_layer_stats.h"
281 #include "rtt.h"
282 #include "tdls.h"
283 #include "wifi_logger.h"
284 #include "wifi_config.h"
285 #include "wifi_nan.h"
286 #include "wifi_offload.h"
287 #include "roam.h"
288 
289 //wifi HAL function pointer table
290 typedef struct {
291     wifi_error (* wifi_initialize) (wifi_handle *);
292     wifi_error (* wifi_wait_for_driver_ready) (void);
293     void (* wifi_cleanup) (wifi_handle, wifi_cleaned_up_handler);
294     void (*wifi_event_loop)(wifi_handle);
295     void (* wifi_get_error_info) (wifi_error , const char **);
296     wifi_error (* wifi_get_supported_feature_set) (wifi_interface_handle, feature_set *);
297     wifi_error (* wifi_get_concurrency_matrix) (wifi_interface_handle, int, feature_set *, int *);
298     wifi_error (* wifi_set_scanning_mac_oui) (wifi_interface_handle, unsigned char *);
299     wifi_error (* wifi_get_supported_channels)(wifi_handle, int *, wifi_channel *);
300     wifi_error (* wifi_is_epr_supported)(wifi_handle);
301     wifi_error (* wifi_get_ifaces) (wifi_handle , int *, wifi_interface_handle **);
302     wifi_error (* wifi_get_iface_name) (wifi_interface_handle, char *name, size_t);
303     wifi_error (* wifi_set_iface_event_handler) (wifi_request_id,wifi_interface_handle ,
304             wifi_event_handler);
305     wifi_error (* wifi_reset_iface_event_handler) (wifi_request_id, wifi_interface_handle);
306     wifi_error (* wifi_start_gscan) (wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params,
307             wifi_scan_result_handler);
308     wifi_error (* wifi_stop_gscan)(wifi_request_id, wifi_interface_handle);
309     wifi_error (* wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int,
310             wifi_cached_scan_results *, int *);
311     wifi_error (* wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle,
312             wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler);
313     wifi_error (* wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle);
314     wifi_error (* wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle,
315             wifi_significant_change_params, wifi_significant_change_handler);
316     wifi_error (* wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle);
317     wifi_error (* wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities *);
318     wifi_error (* wifi_set_link_stats) (wifi_interface_handle, wifi_link_layer_params);
319     wifi_error (* wifi_get_link_stats) (wifi_request_id,wifi_interface_handle,
320             wifi_stats_result_handler);
321     wifi_error (* wifi_clear_link_stats)(wifi_interface_handle,u32, u32 *, u8, u8 *);
322     wifi_error (* wifi_get_valid_channels)(wifi_interface_handle,int, int, wifi_channel *, int *);
323     wifi_error (* wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned,
324             wifi_rtt_config[], wifi_rtt_event_handler);
325     wifi_error (* wifi_rtt_range_cancel)(wifi_request_id,  wifi_interface_handle, unsigned,
326             mac_addr[]);
327     wifi_error (* wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities *);
328     wifi_error (* wifi_rtt_get_responder_info)(wifi_interface_handle iface,
329             wifi_rtt_responder *responder_info);
330     wifi_error (* wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface,
331             wifi_channel_info channel_hint, unsigned max_duration_seconds,
332             wifi_rtt_responder *responder_info);
333     wifi_error (* wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface);
334     wifi_error (* wifi_set_nodfs_flag)(wifi_interface_handle, u32);
335     wifi_error (* wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char *);
336     wifi_error (* wifi_set_epno_list)(wifi_request_id, wifi_interface_handle,
337             const wifi_epno_params *, wifi_epno_handler);
338     wifi_error (* wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle);
339     wifi_error (* wifi_set_country_code)(wifi_interface_handle, const char *);
340     wifi_error (* wifi_get_firmware_memory_dump)( wifi_interface_handle iface,
341             wifi_firmware_memory_dump_handler handler);
342     wifi_error (* wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface,
343         wifi_ring_buffer_data_handler handler);
344     wifi_error (* wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface);
345     wifi_error (* wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface,
346         wifi_alert_handler handler);
347     wifi_error (* wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface);
348     wifi_error (* wifi_get_firmware_version)(wifi_interface_handle iface, char *buffer,
349             int buffer_size);
350     wifi_error (* wifi_get_ring_buffers_status)(wifi_interface_handle iface,
351             u32 *num_rings, wifi_ring_buffer_status *status);
352     wifi_error (* wifi_get_logger_supported_feature_set)(wifi_interface_handle iface,
353             unsigned int *support);
354     wifi_error (* wifi_get_ring_data)(wifi_interface_handle iface, char *ring_name);
355     wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params *,
356             wifi_tdls_handler);
357     wifi_error (* wifi_disable_tdls)(wifi_interface_handle, mac_addr);
358     wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, wifi_tdls_status *);
359     wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface,
360             wifi_tdls_capabilities *capabilities);
361     wifi_error (* wifi_get_driver_version)(wifi_interface_handle iface, char *buffer,
362             int buffer_size);
363     wifi_error (* wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface,
364             int num, wifi_passpoint_network *networks, wifi_passpoint_event_handler handler);
365     wifi_error (* wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface);
366     wifi_error (*wifi_set_lci) (wifi_request_id id, wifi_interface_handle iface,
367 	                             wifi_lci_information *lci);
368     wifi_error (*wifi_set_lcr) (wifi_request_id id, wifi_interface_handle iface,
369 	                             wifi_lcr_information *lcr);
370     wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id,
371                                 wifi_interface_handle iface, u16 ether_type, u8 *ip_packet,
372                                 u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr,
373                                 u32 period_msec);
374     wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id,
375                                 wifi_interface_handle iface);
376     wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle
377                         iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh);
378     wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface);
379     wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface,
380                                 WLAN_DRIVER_WAKE_REASON_CNT *wifi_wake_reason_cnt);
381     wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable);
382     wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface,
383                                 wifi_driver_memory_dump_callbacks callbacks);
384     wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface);
385     wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle,
386         wifi_tx_report *tx_report_bufs,
387         size_t n_requested_fates,
388         size_t *n_provided_fates);
389     wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle,
390         wifi_rx_report *rx_report_bufs,
391         size_t n_requested_fates,
392         size_t *n_provided_fates);
393 
394     /* NAN functions */
395     wifi_error (*wifi_nan_enable_request)(transaction_id id,
396         wifi_interface_handle iface,
397         NanEnableRequest* msg);
398     wifi_error (*wifi_nan_disable_request)(transaction_id id,
399         wifi_interface_handle iface);
400     wifi_error (*wifi_nan_publish_request)(transaction_id id,
401         wifi_interface_handle iface,
402         NanPublishRequest* msg);
403     wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id,
404         wifi_interface_handle iface,
405         NanPublishCancelRequest* msg);
406     wifi_error (*wifi_nan_subscribe_request)(transaction_id id,
407         wifi_interface_handle iface,
408         NanSubscribeRequest* msg);
409     wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id,
410         wifi_interface_handle iface,
411         NanSubscribeCancelRequest* msg);
412     wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id,
413         wifi_interface_handle iface,
414         NanTransmitFollowupRequest* msg);
415     wifi_error (*wifi_nan_stats_request)(transaction_id id,
416         wifi_interface_handle iface,
417         NanStatsRequest* msg);
418     wifi_error (*wifi_nan_config_request)(transaction_id id,
419         wifi_interface_handle iface,
420         NanConfigRequest* msg);
421     wifi_error (*wifi_nan_tca_request)(transaction_id id,
422         wifi_interface_handle iface,
423         NanTCARequest* msg);
424     wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id,
425         wifi_interface_handle iface,
426         NanBeaconSdfPayloadRequest* msg);
427     wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface,
428         NanCallbackHandler handlers);
429     wifi_error (*wifi_nan_get_version)(wifi_handle handle,
430         NanVersion* version);
431     wifi_error (*wifi_nan_get_capabilities)(transaction_id id,
432         wifi_interface_handle iface);
433     wifi_error (*wifi_nan_data_interface_create)(transaction_id id,
434                                                  wifi_interface_handle iface,
435                                                  char *iface_name);
436     wifi_error (*wifi_nan_data_interface_delete)(transaction_id id,
437                                                  wifi_interface_handle iface,
438                                                  char *iface_name);
439     wifi_error (*wifi_nan_data_request_initiator)(
440         transaction_id id, wifi_interface_handle iface,
441         NanDataPathInitiatorRequest *msg);
442     wifi_error (*wifi_nan_data_indication_response)(
443         transaction_id id, wifi_interface_handle iface,
444         NanDataPathIndicationResponse *msg);
445     wifi_error (*wifi_nan_data_end)(transaction_id id,
446                                     wifi_interface_handle iface,
447                                     NanDataPathEndRequest *msg);
448     wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface,
449                                                 wifi_power_scenario scenario);
450     wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface);
451 
452     /**
453      * Returns the chipset's hardware filtering capabilities:
454      * @param version pointer to version of the packet filter interpreter
455      *                supported, filled in upon return. 0 indicates no support.
456      * @param max_len pointer to maximum size of the filter bytecode, filled in
457      *                upon return.
458      */
459     wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle,
460                                                       u32 *version, u32 *max_len);
461     /**
462      * Programs the packet filter.
463      * @param program pointer to the program byte-code.
464      * @param len length of the program byte-code.
465      */
466     wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle,
467                                          const u8 *program, u32 len);
468     wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle,
469                                           u32 src_offset, u8 *host_dst,
470                                           u32 length);
471     wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle,
472                                                 wifi_roaming_capabilities *caps);
473     wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle,
474                                                fw_roaming_state_t state);
475     wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle,
476                                          wifi_roaming_config *roaming_config);
477     wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, wifi_interface_handle
478                         iface, wifi_radio_mode_change_handler eh);
479     wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface,
480                                         wifi_latency_mode mode);
481 } wifi_hal_fn;
482 wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn);
483 #ifdef __cplusplus
484 }
485 #endif
486 
487 #endif
488