kopia lustrzana https://github.com/espressif/esp-idf
esp32: add sniffer filter api
Add sniffer filter to filter specified packetspull/560/merge
rodzic
1cbdb35e1e
commit
f40be8eb77
|
@ -610,6 +610,31 @@ esp_err_t esp_wifi_set_promiscuous(bool en);
|
|||
*/
|
||||
esp_err_t esp_wifi_get_promiscuous(bool *en);
|
||||
|
||||
/**
|
||||
* @brief Enable the promiscuous filter.
|
||||
*
|
||||
* @attention 1. The default filter is to filter all packets except WIFI_PKT_MISC
|
||||
*
|
||||
* @param filter the packet type filtered by promisucous
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
||||
*/
|
||||
esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter);
|
||||
|
||||
/**
|
||||
* @brief Get the promiscuous filter.
|
||||
*
|
||||
* @param[out] filter store the current status of promiscuous filter
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
|
||||
|
||||
/**
|
||||
* @brief Set the configuration of the ESP32 STA or AP
|
||||
*
|
||||
|
|
|
@ -246,12 +246,23 @@ typedef struct {
|
|||
*
|
||||
*/
|
||||
typedef enum {
|
||||
WIFI_PKT_CTRL, /**< control type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_MGMT, /**< management type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_DATA, /**< data type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_MISC, /**< other type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_MISC, /**< other type, such as MIMO etc, receive packet buf is wifi_promiscuous_pkt_t but the payload is NULL!!! */
|
||||
} wifi_promiscuous_pkt_type_t;
|
||||
|
||||
|
||||
#define WIFI_PROMIS_FILTER_MASK_ALL (0xFFFFFFFF) /**< filter all packets */
|
||||
#define WIFI_PROMIS_FILTER_MASK_MGMT (1) /**< filter the packets with type of WIFI_PKT_MGMT */
|
||||
#define WIFI_PROMIS_FILTER_MASK_DATA (1<<1) /**< filter the packets with type of WIFI_PKT_DATA */
|
||||
#define WIFI_PROMIS_FILTER_MASK_MISC (1<<2) /**< filter the packets with type of WIFI_PKT_MISC */
|
||||
#define WIFI_PROMIS_FILTER_MASK_DATA_MPDU (1<<3) /**< filter the MPDU which is a kind of WIFI_PKT_DATA */
|
||||
#define WIFI_PROMIS_FILTER_MASK_DATA_AMPDU (1<<4) /**< filter the AMPDU which is a kind of WIFI_PKT_DATA */
|
||||
|
||||
typedef struct {
|
||||
uint32_t filter_mask;
|
||||
} wifi_promiscuous_filter_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue