1 /******************************************************************************
2  * Copyright (c) 2013-2016 Realtek Semiconductor Corp.
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 _UTIL_H
18 #define _UTIL_H
19 
20 #include <wireless.h>
21 #include <wlan_intf.h>
22 #include <wifi_constants.h>
23 #include "wifi_structures.h"
24 
25 #ifdef	__cplusplus
26 extern "C" {
27 #endif
28 
29 int wext_get_ssid(const char *ifname, __u8 *ssid);
30 int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
31 int wext_set_bssid(const char *ifname, const __u8 *bssid);
32 int wext_get_bssid(const char *ifname, __u8 *bssid);
33 int wext_set_auth_param(const char *ifname, __u16 idx, __u32 value);
34 int wext_set_mfp_support(const char *ifname, __u8 value);
35 #ifdef CONFIG_SAE_SUPPORT
36 int wext_set_group_id(const char *ifname, __u8 value);
37 int wext_set_support_wpa3(__u8 enable);
38 unsigned char wext_get_support_wpa3(void);
39 #endif
40 #ifdef CONFIG_PMKSA_CACHING
41 int wext_set_pmk_cache_enable(const char *ifname, __u8 value);
42 #endif
43 int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr, int key_idx, int set_tx, const __u8 *seq, __u16 seq_len, __u8 *key, __u16 key_len);
44 int wext_get_enc_ext(const char *ifname, __u16 *alg, __u8 *key_idx, __u8 *passphrase);
45 int wext_set_passphrase(const char *ifname, const __u8 *passphrase, __u16 passphrase_len);
46 int wext_get_passphrase(const char *ifname, __u8 *passphrase);
47 int wext_set_mode(const char *ifname, int mode);
48 int wext_get_mode(const char *ifname, int *mode);
49 int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
50 int wext_set_country(const char *ifname, rtw_country_code_t country_code);
51 int wext_get_rssi(const char *ifname, int *rssi);
52 int wifi_get_bcn_rssi(int *pRSSI);
53 int wext_set_channel(const char *ifname, __u8 ch);
54 int wext_get_channel(const char *ifname, __u8 *ch);
55 int wext_register_multicast_address(const char *ifname, rtw_mac_t *mac);
56 int wext_unregister_multicast_address(const char *ifname, rtw_mac_t *mac);
57 int wext_set_scan(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
58 int wext_get_scan(const char *ifname, char *buf, __u16 buf_len);
59 int wext_set_mac_address(const char *ifname, char * mac);
60 int wext_get_mac_address(const char *ifname, char * mac);
61 int wext_enable_powersave(const char *ifname, __u8 lps_mode, __u8 ips_mode);
62 int wext_resume_powersave(const char *ifname);
63 int wext_disable_powersave(const char *ifname);
64 int wext_set_tdma_param(const char *ifname, __u8 slot_period, __u8 rfon_period_len_1, __u8 rfon_period_len_2, __u8 rfon_period_len_3);
65 int wext_set_lps_dtim(const char *ifname, __u8 lps_dtim);
66 int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim);
67 int wext_set_lps_thresh(const char *ifname, __u8 low_thresh);
68 #ifdef LONG_PERIOD_TICKLESS
69 int wext_set_lps_smartps(const char *ifname, __u8 smart_ps);
70 #endif
71 int wext_set_beacon_mode(const char *ifname, __u8 mode);
72 int wext_set_lps_level(const char *ifname, __u8 lps_level);
73 int wext_get_tx_power(const char *ifname, __u8 *poweridx);
74 int wext_set_txpower(const char *ifname, int poweridx);
75 int wext_get_associated_client_list(const char *ifname, void * client_list_buffer, __u16 buffer_length);
76 int wext_get_ap_info(const char *ifname, rtw_bss_info_t * ap_info, rtw_security_t* security);
77 int wext_mp_command(const char *ifname, char *cmd, int show_msg);
78 int wext_private_command(const char *ifname, char *cmd, int show_msg);
79 int wext_private_command_with_retval(const char *ifname, char *cmd, char *ret_buf, int ret_len);
80 void wext_wlan_indicate(unsigned int cmd, union iwreq_data *wrqu, char *extra);
81 int wext_set_pscan_channel(const char *ifname, __u8 *ch, __u8 *pscan_config, __u8 length);
82 int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retry_times, __u16 timeout);
83 int wext_get_autoreconnect(const char *ifname, __u8 *mode);
84 int wext_set_adaptivity(rtw_adaptivity_mode_t adaptivity_mode);
85 int wext_set_trp_tis(__u8 enable);
86 int wext_set_anti_interference(__u8 enable);
87 int wext_set_adaptivity_th_l2h_ini(__u8 l2h_threshold);
88 int wext_get_auto_chl(const char *ifname, unsigned char *channel_set, unsigned char channel_num);
89 int wext_set_sta_num(unsigned char ap_sta_num);
90 int wext_del_station(const char *ifname, unsigned char* hwaddr);
91 int wext_init_mac_filter(void);
92 int wext_deinit_mac_filter(void);
93 int wext_add_mac_filter(unsigned char* hwaddr);
94 int wext_del_mac_filter(unsigned char* hwaddr);
95 void wext_set_indicate_mgnt(int enable);
96 #ifdef CONFIG_SW_MAILBOX_EN
97 int wext_mailbox_to_wifi(const char *ifname, char *buf, __u16 buf_len);
98 #endif
99 #ifdef CONFIG_CUSTOM_IE
100 int wext_add_custom_ie(const char *ifname, void * cus_ie, int ie_num);
101 int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index);
102 int wext_del_custom_ie(const char *ifname);
103 #endif
104 
105 #define wext_handshake_done rltk_wlan_handshake_done
106 
107 int wext_send_mgnt(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
108 int wext_send_eapol(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
109 int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
110 int wext_get_drv_ability(const char *ifname, __u32 *ability);
111 int wext_enable_forwarding(const char *ifname);
112 int wext_disable_forwarding(const char *ifname);
113 int wext_set_ch_deauth(const char *ifname, __u8 enable);
114 int wext_ap_switch_chl_and_inform(unsigned char new_channel);
115 #ifdef CONFIG_WOWLAN
116 int wext_wowlan_ctrl(const char *ifname, int enable);
117 int wext_wowlan_set_pattern(const char *ifname, wowlan_pattern_t pattern);
118 int wext_wlan_redl_fw(const char *ifname);
119 #endif
120 
121 #ifdef CONFIG_POWER_SAVING
122 void wext_set_powersave_mode(__u8 ps_mode);
123 void wext_get_powersave_mode(__u8 *ps_mode);
124 #endif
125 
126 int wext_get_bcn_rssi(const char *ifname, int *rssi);
127 int wext_set_ant_div_gpio(__u8 type);
128 int wext_set_bw40_enable(__u8 enable);
129 
130 extern int (*p_wlan_mgmt_filter)(__u8 *ie, __u16 ie_len, __u16 frame_type);
131 extern int (*p_wlan_action_filter)(__u8 *ie, __u16 ie_len, __u16 frame_type);
132 
133 #ifdef	__cplusplus
134 }
135 #endif
136 
137 #endif /* _UTIL_H */
138 
139