1
6
7
8
9
10
11
12
13
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
39
40
44
45
46
52
53
54
55
56
57
58
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
99
100
101
102
103
104
105
106
107
108
109
110
111
112
115
116
117
118
122
123
127
128
132
133
137
138
139
140
141
/* ... */
#include "esp_wifi_driver.h"
#include "esp_wps.h"
#include "wps/wps.h"
#include "wps/wps_attr_parse.h"
enum wps_msg_flag {
WPS_MSG_FLAG_MORE = 0x01,
WPS_MSG_FLAG_LEN = 0x02
}{ ... };
#ifdef USE_WPS_TASK
enum wps_sig_type {
SIG_WPS_ENABLE = 1,
SIG_WPS_DISABLE,
SIG_WPS_START,
SIG_WPS_RX,
SIG_WPS_TIMER_TIMEOUT,
SIG_WPS_TIMER_MSG_TIMEOUT,
SIG_WPS_TIMER_SUCCESS_CB,
SIG_WPS_TIMER_SCAN,
SIG_WPS_TIMER_EAPOL_START,
SIG_WPS_NUM,
}{ ... };
/* ... */#endif
enum wps_reg_sig_type {
SIG_WPS_REG_ENABLE = 1,
SIG_WPS_REG_DISABLE,
SIG_WPS_REG_START,
SIG_WPS_REG_MAX,
}{ ... };
typedef struct {
void *arg;
int ret;
}{ ... } wps_ioctl_param_t;
#ifdef ESP_SUPPLICANT
enum wps_sm_state {
WAIT_START,
WPA_MESG,
WPA_FAIL
}{ ... };
/* ... */#endif
#define WPS_IGNORE_SEL_REG_MAX_CNT 10
#define WPS_MAX_DIS_AP_NUM 10
struct discard_ap_list_t {
u8 bssid[6];
}{ ... };
struct wps_sm {
u8 state;
struct wps_config *wps_cfg;
struct wps_context *wps_ctx;
struct wps_data *wps;
char identity[32];
u8 identity_len;
u8 ownaddr[ETH_ALEN];
u8 bssid[ETH_ALEN];
struct wps_credential creds[MAX_CRED_COUNT];
u8 ap_cred_cnt;
struct wps_device_data *dev;
u8 uuid[16];
u8 current_identifier;
bool is_wps_scan;
u8 channel;
u8 scan_cnt;
#ifdef USE_WPS_TASK
u8 wps_sig_cnt[SIG_WPS_NUM];
#endif
u8 discover_ssid_cnt;
bool ignore_sel_reg;
bool wps_pbc_overlap;
struct discard_ap_list_t dis_ap_list[WPS_MAX_DIS_AP_NUM];
u8 discard_ap_cnt;
}{ ... };
#define API_MUTEX_TAKE() do {\
if (!s_wps_api_lock) {\
s_wps_api_lock = os_recursive_mutex_create();\
if (!s_wps_api_lock) {\
wpa_printf(MSG_ERROR, "wps api lock create failed");\
return ESP_ERR_NO_MEM;\
}{...}\
}{...}\
os_mutex_lock(s_wps_api_lock);\
}{...} while(0)...
#define API_MUTEX_GIVE() os_mutex_unlock(s_wps_api_lock)
#define DATA_MUTEX_TAKE() os_mutex_lock(s_wps_data_lock)
#define DATA_MUTEX_GIVE() os_mutex_unlock(s_wps_data_lock)
struct wps_sm *wps_sm_get(void);
int wps_station_wps_unregister_cb(void);
int wps_start_pending(void);
int wps_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len);
int wps_dev_deinit(struct wps_device_data *dev);
int wps_dev_init(void);
int wps_set_factory_info(const esp_wps_config_t *config);
struct wps_sm_funcs {
void (*wps_sm_notify_deauth)(void);
}{ ... };
struct wps_sm_funcs* wps_get_wps_sm_cb(void);
static inline int wps_get_type(void)
{
return esp_wifi_get_wps_type_internal();
}{ ... }
static inline int wps_set_type(uint32_t type)
{
return esp_wifi_set_wps_type_internal(type);
}{ ... }
static inline int wps_get_status(void)
{
return esp_wifi_get_wps_status_internal();
}{ ... }
static inline int wps_set_status(uint32_t status)
{
return esp_wifi_set_wps_status_internal(status);
}{ ... }
bool is_wps_enabled(void);
int wps_init_cfg_pin(struct wps_config *cfg);
void wifi_station_wps_eapol_start_handle(void *data, void *user_ctx);
int wifi_ap_wps_disable_internal(void);