• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _WIFI_HOST_H
16 #define _WIFI_HOST_H
17 
18 #include <string.h>
19 #include "wb_co_list.h"
20 #include "al_rtos.h"
21 #ifdef CONFIG_RWNX_LWIP
22 #include "porting_net_al.h"
23 #endif /* CONFIG_RWNX_LWIP */
24 #include "wifi_mac.h"
25 #include "wifi_host_api.h"
26 #include "wifi_cfg_nx.h"
27 #include "plf.h"
28 
29 #define STA_MAX (NX_REMOTE_STA_MAX + NX_VIRT_DEV_MAX)
30 
31 #define BROADCAST_STA_IDX_MIN NX_REMOTE_STA_MAX
32 #define VIF_TO_BCMC_IDX(idx)    (BROADCAST_STA_IDX_MIN + (idx))
33 
34 #define TRACE_FHOST(fmt, ...)  dbg(fmt, ## __VA_ARGS__)
35 
36 #ifdef CFG_CS_HSU_CHKSUM
37 /// Macro used to lock the checksum mutex
38 #define FHOST_CHECKSUM_LOCK()    rtos_mutex_lock(checksum_lock, -1)
39 /// Macro used to unlock the TX mutex
40 #define FHOST_CHECKSUM_UNLOCK()  rtos_mutex_unlock(checksum_lock)
41 
42 extern rtos_semaphore checksum_lock;
43 #endif /* CFG_CS_HSU_CHKSUM */
44 
45 /// Type of messages sent using @ref fhost_msg structure
46 enum fhost_msg_type {
47     /**
48      * Message received from IPC layer (for test/development only)
49      */
50     FHOST_MSG_IPC,
51     /**
52      * Messages received from WIFI stack
53      */
54     FHOST_MSG_KE_WIFI,
55     /**
56      * Configuration/control messages received from supplicant application
57      */
58     FHOST_MSG_CFGRWNX,
59     /**
60      * Message received from console layer (for test/development only)
61      */
62     FHOST_MSG_CONSOLE,
63     /**
64      * Messages received from tx cfm callback (for 802.11 frame)
65      */
66     FHOST_MSG_TXCFM_CB,
67 };
68 
69 /*
70  * TYPE DEFINITIONS
71  ****************************************************************************************
72  */
73 
74 /// STA Info Table
75 struct sta_info_tag
76 {
77     /// linked list header
78     struct co_list_hdr list_hdr;
79     /**
80      * Beacon Interval used by peer AP or peer Mesh STA (in microseconds).
81      * Used only for a VIF of type STA or MP
82      */
83     uint32_t bcn_int;
84     /// maximum size of HE A-MPDUs supported by the STA
85     uint32_t ampdu_size_max_he;
86     /// maximum size of VHT A-MPDUs supported by the STA
87     uint32_t ampdu_size_max_vht;
88     /// maximum size of HT A-MPDUs supported by the STA
89     uint16_t ampdu_size_max_ht;
90     /// PartialAid/GroupId to be put in the THD when transmitting to this STA
91     uint32_t paid_gid;
92     /// Minimal spacing to be inserted when transmitting to this STA
93     uint8_t ampdu_spacing_min;
94 
95     uint32_t cipher_suite;
96     uint8_t  key_added;
97     #if (NX_POWERSAVE)
98     /**
99      * Maximum drift on one beacon period
100      * Used only for a VIF of type STA or MP
101      */
102     uint16_t drift;
103     #endif //(NX_POWERSAVE)
104     /// AID of the station
105     uint16_t aid;
106     /// Interface the station belongs to
107     uint8_t inst_nbr;
108     /// Station index
109     uint8_t staid;
110     /// Power save state of the associated STA
111     uint8_t ps_state;
112     /// Flag indicating if the STA entry is valid or not
113     bool valid;
114     /// MAC address of the STA
115     struct mac_addr mac_addr;
116 
117     /// Logical port state
118     uint8_t ctrl_port_state;
119 
120     #if (NX_UMAC_PRESENT)
121     /// PS/UAPSD traffic availability on host and/or internally
122     enum sta_ps_traffic traffic_avail;
123     /// PS/UAPSD service period status
124     enum sta_ps_sp ps_service_period;
125     /// control port protocol
126     uint16_t ctrl_port_ethertype;
127     /// STA Security Information
128     struct sta_mgmt_sec_info sta_sec_info;
129     /// Generic station information
130     struct sta_capa_info info;
131     /// Per-TID sequence numbers
132     uint16_t seq_nbr[TID_MAX];
133     /// TX policy table control
134     struct sta_pol_tbl_cntl pol_tbl;
135     #endif //(NX_UMAC_PRESENT)
136 
137     #if (NX_AMPDU_TX)
138     /// For TX BA agreements per TID
139     //struct ba_agmt ba_agmts_tx[TID_MAX];
140     #endif //(NX_AMPDU_TX && !NX_UMAC_PRESENT)
141 
142     #if (NX_REORD)
143     /// For RX BA agreements per TID
144     //struct rxu_cntrl_reord *ba_agmts_rx[TID_MAX];
145     #endif //(NX_REORD)
146 
147     #if (NX_UMAC_PRESENT)
148     /// UMAC information related to the TX block ack agreements established
149     struct sta_mgmt_ba_info ba_info[TID_MAX];
150     /// Duplicate Detection Status (non-QoS data frames)
151     uint16_t rx_nqos_last_seqcntl;
152     /// Duplicate Detection Status (QoS data frames)
153     uint16_t rx_qos_last_seqcntl[TID_MAX];
154     #endif //(NX_UMAC_PRESENT)
155 
156     #if (NX_TX_FRAME)
157     /// List of TX descriptor whose transmission has been postponed
158     struct co_list tx_desc_post;
159     #endif //(NX_TX_FRAME)
160 
161     #if (RW_MESH_EN)
162     /// Mesh Link Index
163     uint8_t mlink_idx;
164     #endif //(RW_MESH_EN)
165 
166     #if (NX_TDLS)
167     /// TDLS specific information
168     struct tdls_info_tag tdls;
169     /// Flag indicating if the station is a TDLS station
170     bool is_tdls;
171     #endif
172 
173     uint32_t last_active_time_us;;
174 };
175 /// Information related to the BSS a VIF is linked to
176 struct me_bss_info
177 {
178     /// Network BSSID.
179     struct mac_addr bssid;
180 };
181 /// VIF Info Table
182 struct vif_info_tag
183 {
184     /// linked list header
185     //struct co_list_hdr list_hdr;
186     /// Bitfield indicating if this VIF currently allows sleep or not
187     uint32_t prevent_sleep;
188     /// EDCA parameters of the different TX queues for this VIF
189     uint32_t txq_params[AC_MAX];
190 
191     #if (NX_MULTI_ROLE || NX_CHNL_CTXT || (NX_P2P_GO && NX_POWERSAVE))
192     /// TBTT timer structure
193     struct mm_timer_tag tbtt_timer;
194     #endif //(NX_MULTI_ROLE || NX_CHNL_CTXT || (NX_P2P_GO && NX_POWERSAVE))
195 
196     #if (NX_P2P || NX_CHNL_CTXT)
197     /// Timer used for Beacon Reception Timeout
198     struct mm_timer_tag tmr_bcn_to;
199     #endif //(NX_P2P || NX_CHNL_CTXT)
200 
201     #if (NX_MULTI_ROLE || NX_TDLS)
202     /// BSSID this VIF belongs to
203     struct mac_addr bssid;
204     #endif //(NX_MULTI_ROLE)
205 
206     #if (NX_CHNL_CTXT)
207     /// Channel context on which this VIF is attached
208     struct chan_ctxt_tag *chan_ctxt;
209     /// TBTT Switch Information
210     struct chan_tbtt_tag tbtt_switch;
211     #endif //(NX_CHNL_CTXT)
212 
213     /// MAC address of the VIF
214     struct mac_addr mac_addr;
215 
216     /// Type of the interface (@ref VIF_STA, @ref VIF_IBSS, @ref VIF_MESH_POINT or @ref VIF_AP)
217     uint8_t type;
218     /// Index of the interface
219     uint8_t index;
220     /// Flag indicating if the VIF is active or not
221     bool active;
222 
223     /// TX power configured for the interface (dBm)
224     int8_t tx_power;
225 
226     /// TX power configured for the interface (dBm) by user space
227     /// (Taken into account only if lower than regulatory one)
228     int8_t user_tx_power;
229 
230     union
231     {
232         /// STA specific parameter structure
233         struct
234         {
235             #if NX_POWERSAVE
236             /// Listen interval
237             uint16_t listen_interval;
238             /// Flag indicating if we are expecting BC/MC traffic or not
239             bool dont_wait_bcmc;
240             /// Number of error seen during transmission of last NULL frame indicating PS change
241             uint8_t ps_retry;
242             #endif
243             /// Index of the station being the peer AP
244             uint8_t ap_id;
245             #if NX_UAPSD
246             /// Time of last UAPSD transmitted/received frame
247             uint32_t uapsd_last_rxtx;
248             /// Bitfield indicating which queues are U-APSD enabled
249             uint8_t uapsd_queues;
250             /// UAPSD highest TID, used in the QoS-NULL trigger frames
251             uint8_t uapsd_tid;
252             #endif
253             #if NX_CONNECTION_MONITOR
254             /// Time of last keep-alive frame sent to AP
255             uint32_t mon_last_tx;
256             /// CRC of last received beacon
257             uint32_t mon_last_crc;
258             /// Number of beacon losses since last beacon reception
259             uint8_t beacon_loss_cnt;
260             #endif
261 
262             #if (NX_P2P)
263             /// Last computed TSF Offset
264             int32_t last_tsf_offset;
265             /// Addition duration to be added to the CTWindow, due to the TBTT_DELAY + drift value computed in mm_tbtt_compute
266             uint32_t ctw_add_dur;
267             /// Status indicated if Service Period has been paused due to GO absence
268             bool sp_paused;
269             #endif //(NX_P2P)
270 
271             #if (NX_P2P_GO)
272             // Indicate if AP Beacon has been received at least one time
273             bool bcn_rcved;
274             #endif //(NX_P2P_GO)
275 
276             // Current RSSI
277             int8_t rssi;
278             // RSSI threshold (0=threshold not set)
279             int8_t rssi_thold;
280             // RSSI hysteresis
281             uint8_t rssi_hyst;
282             // Current status of RSSI (0=RSSI is high, 1=RSSI is low)
283             bool rssi_status;
284 
285             /// Current CSA counter
286             uint8_t csa_count;
287             /// Indicate if channel switch (due to CSA) just happened
288             bool csa_occured;
289 
290             #if (NX_TDLS)
291             /// TDLS station index which requested the channel switch
292             uint8_t tdls_chsw_sta_idx;
293             #endif
294             uint8_t vif_name[33];
295         } sta;
296         /// AP specific parameter structure
297         struct
298         {
299             uint32_t dummy;
300             /// Flag indicating how many connected stations are currently in PS
301             uint8_t ps_sta_cnt;
302             /// Control port ethertype
303             uint16_t ctrl_port_ethertype;
304             /// Current CSA counter
305             uint8_t csa_count;
306 
307             rtos_semaphore csa_semaphore;
308         } ap;
309     } u;    ///< Union of AP/STA specific parameter structures
310 
311     /// List of stations linked to this VIF
312     struct co_list sta_list;
313 
314     /// Information about the BSS linked to this VIF
315     struct me_bss_info bss_info;
316 
317     #if NX_MAC_HE
318     /// TXOP RTS threshold
319     uint16_t txop_dur_rts_thres;
320     #endif
321     #if (NX_P2P)
322     /// Indicate if this interface is configured for P2P operations
323     bool p2p;
324     /// Index of the linked P2P Information structure
325     uint8_t p2p_index;
326     /// Contain current number of registered P2P links for the VIF
327     uint8_t p2p_link_nb;
328     #endif //(NX_P2P)
329 
330     #if (RW_UMESH_EN)
331     /// Mesh ID - Index of the used mesh_vif_info_tag structure when type is VIF_MESH_POINT
332     uint8_t mvif_idx;
333     #endif //(RW_UMESH_EN)
334 };
335 /// Structure containing the information about the virtual interfaces
336 struct fhost_vif_tag
337 {
338     /// RTOS network interface structure
339     net_if_t net_if;
340     /// MAC address of the VIF
341     struct mac_addr mac_addr;
342     /// Socket for scan events
343     int scan_sock;
344     /// Socket for connect/disconnect events
345     int conn_sock;
346     /// Socket for AP
347     int ap_sock;
348     /// Pointer to the MAC VIF structure
349     struct vif_info_tag *mac_vif;
350     /// Index of the STA being the AP peer of the device - TODO rework
351     uint8_t ap_id;
352     /// Parameter to indicate if admission control is mandatory for any access category - TODO rework
353     uint8_t acm;
354     /// UAPSD queue config for STA interface (bitfield, same format as QoS info)
355     uint8_t uapsd_queues;
356     /// connect router band
357     uint8_t band;
358     uint8_t chan_index;
359 };
360 
361 /// Structure used for the inter-task communication
362 struct fhost_env_tag
363 {
364     /// Table of RTOS network interface structures
365     struct fhost_vif_tag vif[NX_VIRT_DEV_MAX];
366     /// Table linking the MAC VIFs to the FHOST VIFs
367     struct fhost_vif_tag *mac2fhost_vif[NX_VIRT_DEV_MAX];
368 };
369 
370 /// Generate fhost msg ID from a type and an index
371 #define FHOST_MSG_ID(type, idx) ((type << 12) | (idx & 0xfff))
372 /// Extract msg Type from msg ID
373 #define FHOST_MSG_TYPE(id) ((id >> 12) & 0xf)
374 /// Extract msg Index from msg ID
375 #define FHOST_MSG_INDEX(id) (id & 0xfff)
376 
377 /// Generic Message format
378 struct fhost_msg {
379     /// ID of the message. Id is a combination of a type and an index.
380     /// To be set using @ref FHOST_MSG_ID macro
381     uint16_t id;
382     /// Length, in bytes, of the message
383     uint16_t len;
384     /// Pointer to the message
385     void *data;
386 };
387 
388 #define TR_32(a) (uint16_t)((uint32_t)(a) >> 16), (uint16_t)((uint32_t)(a))
389 
390 /*
391  * GLOBAL VARIABLES
392  ****************************************************************************************
393  */
394 /// FullHost module environment variable
395 extern struct fhost_env_tag fhost_env;
396 
397 /*
398  * FUNCTIONS
399  ****************************************************************************************
400  */
401 /**
402  ****************************************************************************************
403  * @brief Get MAC VIF owned by a FHOST VIF.
404  *
405  * @param[in] fhost_vif_idx Index of the FHOST VIF
406  *
407  * @return A pointer to the corresponding MAC VIF
408  ****************************************************************************************
409  */
fhost_to_mac_vif(uint8_t fhost_vif_idx)410 static inline struct vif_info_tag *fhost_to_mac_vif(uint8_t fhost_vif_idx)
411 {
412     struct vif_info_tag *mac_vif = fhost_env.vif[fhost_vif_idx].mac_vif;
413 
414     // Sanity check - Currently we consider that when this function is called there shall
415     // be a MAC VIF attached to the FHOST VIF. If in the future this has to change then
416     // this assertion will be removed
417     ASSERT_ERR(mac_vif != NULL);
418 
419     return mac_vif;
420 }
421 
422 /**
423  ****************************************************************************************
424  * @brief Get FHOST VIF owner of a MAC VIF.
425  *
426  * @param[in] mac_vif_idx Index of the MAC VIF
427  *
428  * @return A pointer to the corresponding FHOST VIF
429  ****************************************************************************************
430  */
fhost_from_mac_vif(uint8_t mac_vif_idx)431 static inline struct fhost_vif_tag *fhost_from_mac_vif(uint8_t mac_vif_idx)
432 {
433     struct fhost_vif_tag *fhost_vif;
434 
435     // Sanity check - Check that mac_vif_idx is valid
436     ASSERT_ERR(mac_vif_idx < NX_VIRT_DEV_MAX);
437 
438     fhost_vif = fhost_env.mac2fhost_vif[mac_vif_idx];
439 
440     // Sanity check - Currently we consider that when this function is called there shall
441     // be a FHOST VIF attached to the MAC VIF. If in the future this has to change then
442     // this assertion will be removed
443     ASSERT_ERR(fhost_vif != NULL);
444 
445     return fhost_vif;
446 }
447 
448 #ifdef CONFIG_RWNX_LWIP
449 /**
450  ****************************************************************************************
451  * @brief Get Network interface associated to a FHOST VIF.
452  *
453  * @param[in] fhost_vif_idx Index of the FHOST VIF
454  *
455  * @return A pointer to the corresponding network interface
456  ****************************************************************************************
457  */
fhost_to_net_if(uint8_t fhost_vif_idx)458 __STATIC_INLINE net_if_t *fhost_to_net_if(uint8_t fhost_vif_idx)
459 {
460     ASSERT_ERR(fhost_vif_idx < NX_VIRT_DEV_MAX);
461     return &(fhost_env.vif[fhost_vif_idx].net_if);
462 }
463 #endif /* CONFIG_RWNX_LWIP */
464 
465 /**
466  ****************************************************************************************
467  * @brief Get FHOST VIF name.
468  *
469  * Copy name of a FHOST VIF inside provided buffer including a terminating a null byte.
470  * If the buffer is not big enough then interface name is truncated and the null byte
471  * is not written in the buffer.
472  *
473  * @param[in] fhost_vif_idx  Index of the FHOST VIF
474  * @param[in] name           Buffer to retrieve interface name
475  * @param[in] len            Size, in bytes, of the @p name buffer
476  *
477  * @return < 0 if error occurred, otherwise the number of characters (excluding the
478  * terminating null byte) needed to write the interface name. If return value is greater
479  * or equal to @p len, it means that the interface name has been truncated.
480  ****************************************************************************************
481  */
482 int fhost_vif_name(int fhost_vif_idx, char *name, int len);
483 
484 /**
485  ****************************************************************************************
486  * @brief Get FHOST VIF index from its name.
487  *
488  * @param[in] name Interface name
489  *
490  * @return index of the fhost vif and < 0 if there is no interface with the provided name
491  ****************************************************************************************
492  */
493 int fhost_vif_idx_from_name(const char *name);
494 
495 /**
496  ****************************************************************************************
497  * @brief Configure default queues enabled for U-APSD.
498  *
499  * This configuration is used when an interface configured as STA connects to an AP that
500  * supports U-APSD. This can be called at any time, but the configuration will only be
501  * applied for the next connections.
502  *
503  * @param[in] fhost_vif_idx  Index of the FHOST VIF. (Use -1 to configure all interfaces)
504  * @param[in] uapsd_queues   AC bitfield as expected in Qos Info field
505  *                           (i.e. Bit0=VO, Bit1=VI, Bit2=BK, bit3=BE)
506  *
507  * @return 0 on success and != 0 if error occurred.
508  ****************************************************************************************
509  */
510 int fhost_vif_set_uapsd_queues(int fhost_vif_idx, uint8_t uapsd_queues);
511 
512 /**
513  ****************************************************************************************
514  * @brief Initialization of the application.
515  *
516  * Called during the initialization procedure (i.e. when RTOS scheduler is not yet active).
517  * Implementation of this function will depends of the final application and in most
518  * cases it will create one of several application tasks and their required communication
519  * interface (queue, semaphore, ...)
520  *
521  * @return 0 on success and != 0 if error occurred.
522  ****************************************************************************************
523  */
524 int fhost_application_init(void);
525 
526 /**
527  ****************************************************************************************
528  * @brief Create a socket and connect it to loopback address on the specified port
529  *
530  * @param[in] port UDP port to connect to
531  * @return socket file descriptor and <0 if error occurred
532  ****************************************************************************************
533  */
534 int fhost_open_loopback_udp_sock(int port);
535 
536 /**
537  ****************************************************************************************
538  * @brief Print a pre-formatted string buffer.
539  *
540  * Implementation of this function will depend of target/application
541  *
542  * @param[in] handle Task handle of the RTOS task sending the message
543  *                   (can be null to indicate current task)
544  * @param[in] buf    Formatted string buffer
545  *
546  * @return 0 on success and != 0 if error occurred.
547  ****************************************************************************************
548  */
549 int fhost_print_buf(rtos_task_handle handle, const char *buf);
550 
551 /**
552  ****************************************************************************************
553  * @brief Print a message.
554  *
555  * Implementation of this function will depend of target/application
556  *
557  * @param[in] handle Task handle of the RTOS task sending the message
558  *                   (can be null to indicate current task)
559  * @param[in] fmt    Format string
560  *
561  * @return 0 on success and != 0 if error occurred.
562  ****************************************************************************************
563  */
564 int fhost_print(rtos_task_handle handle, const char *fmt, ...);
565 
566 
567 /**
568  ****************************************************************************************
569  * @brief Compute checksum on a given IP packet
570  *
571  * Compute IP packet checksum using HSU and fallback to software computation if HSU is
572  * unavailable
573  *
574  * @param[in] dataptr Buffer containing the IP packet
575  * @param[in] len     Buffer length (in bytes)
576  * @return IP packet checksum
577  ****************************************************************************************
578  */
579 uint16_t fhost_ip_chksum(const void *dataptr, int len);
580 
581 
582 /**
583  ****************************************************************************************
584  * @brief Connect a STA interface to an AP
585  *
586  * This is blocking until connection is successful.
587  *
588  * @param[in] fhost_vif_idx  Fhost VIF index
589  * @param[in] cfg            Interface configuration
590  *
591  * @return 0 on success and != 0 if error occurred.
592  ****************************************************************************************
593  */
594 int fhost_sta_cfg(int fhost_vif_idx, struct fhost_vif_sta_cfg *cfg);
595 
596 /**
597  ****************************************************************************************
598  * @brief Start an Access Point
599  *
600  * This is blocking until AP is operational.
601  *
602  * @param[in] fhost_vif_idx  Fhost VIF index
603  * @param[in] cfg            AP configuration
604  *
605  * @return 0 on success and != 0 if error occurred.
606  ****************************************************************************************
607  */
608 int fhost_ap_cfg(int fhost_vif_idx, struct fhost_vif_ap_cfg *cfg);
609 
610 
611 extern struct vif_info_tag vif_info_tab[NX_VIRT_DEV_MAX];
612 extern struct sta_info_tag sta_info_tab[STA_MAX + NX_VIRT_DEV_MAX];
613 extern int wlan_connected;
614 
615 extern void fhost_data_save(void);
616 extern void fhost_data_restore(void);
617 extern void fhost_sta_recover_connection(void);
618 extern void fhost_sta_ipc_rxbuf_recover(void);
619 extern uint8_t vif_mgmt_get_staid(const struct vif_info_tag *vif, const struct mac_addr *sta_addr);
620 extern int fhost_ipc_cntrl_init(uint32_t ipc_irq_prio);
621 extern int ipc_host_cntrl_start(void);
622 extern uint8_t vif_mgmt_sta_cnt(void);
623 
624 extern int ipc_host_fw_init(void);
625 
626 extern struct co_list free_sta_list;
627 
628 typedef enum wifi_mac_status    {
629     WIFI_MAC_STATUS_DISCONNECTED,
630     WIFI_MAC_STATUS_CONNECTED,
631 }wifi_mac_status_e;
632 typedef void (*fhost_mac_status_get_func_t)(wifi_mac_status_e st);
633 void fhost_get_mac_status_register(fhost_mac_status_get_func_t func);
634 
635 extern fhost_mac_status_get_func_t fhost_mac_status_get_callback;
636 
637 uint8_t user_limit_sta_num_get(void);
638 void user_limit_sta_num_set(uint8_t num);
639 
640 
641 extern fhost_mac_status_get_func_t fhost_reconnect_dhcp_callback;
642 void fhost_reconnect_dhcp_register(fhost_mac_status_get_func_t func);
643 
644 int fhost_scan_for_ssid_pwd(struct fhost_cntrl_link *link, int fvif_idx, uint8_t *p_ssid, uint8_t *p_password);
645 
646 #if defined(CONFIG_RWNX_LWIP) && defined(CFG_HOSTIF)
647 typedef enum hostif_status
648 {
649     HOSTIF_ST_IDLE,
650     HOSTIF_ST_AWAKE,
651     HOSTIF_ST_DEEPSLEEP,
652 }hostif_status_e;
653 void set_hostif_wlan_status(hostif_status_e st);
654 hostif_status_e get_hostif_wlan_status(void);
655 typedef struct ip_packet_filter
656 {
657     uint8_t  used;
658     uint8_t  protocol;
659     uint16_t destination_port;
660 }ip_packet_filter_t;
661 /* filter_num <= 8 */
662 void set_hostif_user_filter(ip_packet_filter_t *filter, uint8_t filter_num);
663 ip_packet_filter_t * get_hostif_user_filter(void);
664 #endif /* CONFIG_RWNX_LWIP && CFG_HOSTIF */
665 
666 #endif // _WIFI_HOST_H
667