ESP8266_RTOS_SDK  v1.4.0
Typedefs | Functions
Sniffer APIs

WiFi sniffer APIs. More...

Typedefs

typedef void(* wifi_promiscuous_cb_t) (uint8 *buf, uint16 len)
 The RX callback function in the promiscuous mode. More...
 

Functions

void wifi_set_promiscuous_rx_cb (wifi_promiscuous_cb_t cb)
 Register the RX callback function in the promiscuous mode. More...
 
uint8 wifi_get_channel (void)
 Get the channel number for sniffer functions. More...
 
bool wifi_set_channel (uint8 channel)
 Set the channel number for sniffer functions. More...
 
bool wifi_promiscuous_set_mac (const uint8_t *address)
 Set the MAC address filter for the sniffer mode. More...
 
void wifi_promiscuous_enable (uint8 promiscuous)
 Enable the promiscuous mode. More...
 

Detailed Description

WiFi sniffer APIs.

Typedef Documentation

typedef void(* wifi_promiscuous_cb_t) (uint8 *buf, uint16 len)

The RX callback function in the promiscuous mode.

Each time a packet is received, the callback function will be called.

Parameters
uint8*buf : the data received
uint16len : data length
Returns
null

Function Documentation

uint8 wifi_get_channel ( void  )

Get the channel number for sniffer functions.

Parameters
null
Returns
channel number
void wifi_promiscuous_enable ( uint8  promiscuous)

Enable the promiscuous mode.

Attention
1. The promiscuous mode can only be enabled in the ESP8266 station mode. Do not call this API in user_init.
2. When in the promiscuous mode, the ESP8266 station and soft-AP are disabled.
3. Call wifi_station_disconnect to disconnect before enabling the promiscuous mode.
4. Don't call any other APIs when in the promiscuous mode. Call wifi_promiscuous_enable(0) to quit sniffer before calling other APIs.
Parameters
uint8promiscuous :
  • 0: to disable the promiscuous mode
  • 1: to enable the promiscuous mode
Returns
null
bool wifi_promiscuous_set_mac ( const uint8_t *  address)

Set the MAC address filter for the sniffer mode.

Attention
This filter works only for the current sniffer mode. If users disable and then enable the sniffer mode, and then enable sniffer, they need to set the MAC address filter again.
Parameters
constuint8_t *address : MAC address
Returns
true : succeed
false : fail
bool wifi_set_channel ( uint8  channel)

Set the channel number for sniffer functions.

Parameters
uint8channel : channel number
Returns
true : succeed
false : fail
void wifi_set_promiscuous_rx_cb ( wifi_promiscuous_cb_t  cb)

Register the RX callback function in the promiscuous mode.

Each time a packet is received, the registered callback function will be called.

Parameters
wifi_promiscuous_cb_tcb : callback
Returns
null