Skip to content

Commit 7005cee

Browse files
committed
Merge branch 'feature/refactor_wifi_promiscuous_mode' into 'master'
feat(esp8266): refactor wifi promiscuous mode api See merge request sdk/ESP8266_RTOS_SDK!280
2 parents 18313d0 + e111562 commit 7005cee

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

components/esp8266/include/esp_wifi.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,7 @@ esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
565565
* @param type promiscuous packet type.
566566
*
567567
*/
568-
//typedef void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);
569-
typedef void (* wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len);
568+
typedef void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);
570569
/**
571570
* @brief Register the RX callback function in the promiscuous mode.
572571
*

components/esp8266/include/esp_wifi_types.h

+27-16
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef enum {
145145
WIFI_ANT_MAX, /**< Invalid WiFi antenna */
146146
} wifi_ant_t;
147147

148-
/** @brief Description of an WiFi AP */
148+
/** @brief Description of a WiFi AP */
149149
typedef struct {
150150
uint8_t bssid[6]; /**< MAC address of AP */
151151
uint8_t ssid[33]; /**< SSID of AP */
@@ -299,30 +299,30 @@ typedef struct {
299299
/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */
300300
typedef struct {
301301
signed rssi:8; /**< signal intensity of packet */
302-
unsigned rate:5; /**< data rate */
302+
unsigned rate:4; /**< data rate */
303+
unsigned is_group:1;
303304
unsigned :1; /**< reserve */
304305
unsigned sig_mode:2; /**< 0:is not 11n packet; 1:is 11n packet */
305-
unsigned :16; /**< reserve */
306+
unsigned legacy_length:12;
307+
unsigned damatch0:1;
308+
unsigned damatch1:1;
309+
unsigned bssidmatch0:1;
310+
unsigned bssidmatch1:1;
306311
unsigned mcs:7; /**< if is 11n packet, shows the modulation(range from 0 to 76) */
307312
unsigned cwb:1; /**< if is 11n packet, shows if is HT40 packet or not */
308-
unsigned :16; /**< reserve */
313+
unsigned HT_length:16; /**< reserve */
309314
unsigned smoothing:1; /**< reserve */
310315
unsigned not_sounding:1; /**< reserve */
311316
unsigned :1; /**< reserve */
312317
unsigned aggregation:1; /**< Aggregation */
313318
unsigned stbc:2; /**< STBC */
314319
unsigned fec_coding:1; /**< Flag is set for 11n packets which are LDPC */
315320
unsigned sgi:1; /**< SGI */
316-
unsigned noise_floor:8; /**< noise floor */
321+
unsigned rxend_state:8;
317322
unsigned ampdu_cnt:8; /**< ampdu cnt */
318323
unsigned channel:4; /**< which channel this packet in */
319-
unsigned :12; /**< reserve */
320-
unsigned timestamp:32; /**< timestamp */
321-
unsigned :32; /**< reserve */
322-
unsigned :32; /**< reserve */
323-
unsigned sig_len:12; /**< length of packet */
324-
unsigned :12; /**< reserve */
325-
unsigned rx_state:8; /**< rx state */
324+
unsigned :4; /**< reserve */
325+
signed noise_floor:8;
326326
} wifi_pkt_rx_ctrl_t;
327327

328328
/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback.
@@ -340,17 +340,28 @@ typedef struct {
340340
*/
341341
typedef enum {
342342
WIFI_PKT_MGMT, /**< Management frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */
343+
WIFI_PKT_CTRL, /**< Control frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */
343344
WIFI_PKT_DATA, /**< Data frame, indiciates 'buf' argument is wifi_promiscuous_pkt_t */
344345
WIFI_PKT_MISC, /**< Other type, such as MIMO etc. 'buf' argument is wifi_promiscuous_pkt_t but the payload is zero length. */
345346
} wifi_promiscuous_pkt_type_t;
346347

347348

348349
#define WIFI_PROMIS_FILTER_MASK_ALL (0xFFFFFFFF) /**< filter all packets */
349350
#define WIFI_PROMIS_FILTER_MASK_MGMT (1) /**< filter the packets with type of WIFI_PKT_MGMT */
350-
#define WIFI_PROMIS_FILTER_MASK_DATA (1<<1) /**< filter the packets with type of WIFI_PKT_DATA */
351-
#define WIFI_PROMIS_FILTER_MASK_MISC (1<<2) /**< filter the packets with type of WIFI_PKT_MISC */
352-
#define WIFI_PROMIS_FILTER_MASK_DATA_MPDU (1<<3) /**< filter the MPDU which is a kind of WIFI_PKT_DATA */
353-
#define WIFI_PROMIS_FILTER_MASK_DATA_AMPDU (1<<4) /**< filter the AMPDU which is a kind of WIFI_PKT_DATA */
351+
#define WIFI_PROMIS_FILTER_MASK_CTRL (1<<1) /**< filter the packets with type of WIFI_PKT_CTRL */
352+
#define WIFI_PROMIS_FILTER_MASK_DATA (1<<2) /**< filter the packets with type of WIFI_PKT_DATA */
353+
#define WIFI_PROMIS_FILTER_MASK_MISC (1<<3) /**< filter the packets with type of WIFI_PKT_MISC */
354+
355+
#define WIFI_PROMIS_CTRL_FILTER_MASK_ALL (0xFF800000) /**< filter all control packets */
356+
#define WIFI_PROMIS_CTRL_FILTER_MASK_WRAPPER (1<<23) /**< filter the control packets with subtype of Control Wrapper */
357+
#define WIFI_PROMIS_CTRL_FILTER_MASK_BAR (1<<24) /**< filter the control packets with subtype of Block Ack Request */
358+
#define WIFI_PROMIS_CTRL_FILTER_MASK_BA (1<<25) /**< filter the control packets with subtype of Block Ack */
359+
#define WIFI_PROMIS_CTRL_FILTER_MASK_PSPOLL (1<<26) /**< filter the control packets with subtype of PS-Poll */
360+
#define WIFI_PROMIS_CTRL_FILTER_MASK_RTS (1<<27) /**< filter the control packets with subtype of RTS */
361+
#define WIFI_PROMIS_CTRL_FILTER_MASK_CTS (1<<28) /**< filter the control packets with subtype of CTS */
362+
#define WIFI_PROMIS_CTRL_FILTER_MASK_ACK (1<<29) /**< filter the control packets with subtype of ACK */
363+
#define WIFI_PROMIS_CTRL_FILTER_MASK_CFEND (1<<30) /**< filter the control packets with subtype of CF-END */
364+
#define WIFI_PROMIS_CTRL_FILTER_MASK_CFENDACK (1<<31) /**< filter the control packets with subtype of CF-END+CF-ACK */
354365

355366
/** @brief Mask for filtering different packet types in promiscuous mode. */
356367
typedef struct {

components/esp8266/lib/VERSION

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ gwen:
22
crypto: 8943c89
33
espnow: 8943c89
44
core: 915e6ba
5-
net80211: fdd8880
6-
pp: fdd8880
5+
net80211: 915e6ba
6+
pp: 915e6ba
77
pwm: 0181338
88
smartconfig:9ec59b5
99
wpa: 8943c89

components/esp8266/lib/libnet80211.a

456 Bytes
Binary file not shown.

components/esp8266/lib/libpp.a

4.25 KB
Binary file not shown.

0 commit comments

Comments
 (0)