This commit is contained in:
pvvx 2017-04-22 16:44:33 +03:00
parent cf7a2d9683
commit f7b901aa27
76 changed files with 3753 additions and 3990 deletions

View file

@ -10,8 +10,10 @@
#include <lwip/netif.h>
#include "wifi/wifi_conf.h"
#include <platform/platform_stdlib.h>
#ifdef CONFIG_ENABLE_EAP
#include <polarssl/ssl.h>
#include <polarssl/memory.h>
#endif
#define WLAN0_NAME "wlan0"
#ifndef ENABLE
@ -21,6 +23,21 @@
#define DISABLE (0)
#endif
#ifndef CONFIG_ENABLE_EAP
int get_eap_phase(void){
return 0;
}
int get_eap_method(void){
return 0;
}
void eap_autoreconnect_hdl(u8 method_id)
{
(void) method_id;
}
#else
u8 eap_phase = 0;
u8 eap_method = 0;
@ -42,9 +59,6 @@ void eap_eapol_recvd_hdl(char *buf, int buf_len, int flags, void* handler_user_d
void eap_eapol_start_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
#endif
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
int get_eap_phase(void){
return eap_phase;
@ -54,6 +68,10 @@ int get_eap_method(void){
return eap_method;
}
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
void reset_config(void){
eap_target_ssid = NULL;
eap_identity = NULL;
@ -64,6 +82,8 @@ void reset_config(void){
eap_client_key_pwd = NULL;
}
#ifdef CONFIG_ENABLE_EAP
void judge_station_disconnect(void)
{
int mode = 0;
@ -82,7 +102,7 @@ void judge_station_disconnect(void)
wifi_disconnect();
}
}
#ifdef CONFIG_ENABLE_EAP
void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){
// printf("disconnected\n");
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl);
@ -258,11 +278,12 @@ static int connect_by_open_system(char *target_ssid)
if (target_ssid != NULL) {
while (1) {
rtw_msleep_os(500); //wait scan complete.
ret = wifi_connect(target_ssid,
ret = wifi_connect(
NULL,
0,
target_ssid,
RTW_SECURITY_OPEN,
NULL,
strlen(target_ssid),
0,
0,
NULL);
if (ret == RTW_SUCCESS) {
@ -451,3 +472,5 @@ int eap_cert_setup(ssl_context *ssl)
#endif
return 0;
}
#endif //#ifdef CONFIG_ENABLE_EAP

View file

@ -303,11 +303,12 @@ static int wps_connect_to_AP_by_certificate(rtw_network_info_t *wifi)
printf("ssid_len = %d\n", wifi->ssid.len);
printf("password_len = %d\n", wifi->password_len);
while (1) {
ret = wifi_connect((char*)wifi->ssid.val,
ret = wifi_connect(
NULL,
0,
(char*)wifi->ssid.val,
wifi->security_type,
(char*)wifi->password,
wifi->ssid.len,
wifi->password_len,
wifi->key_id,
NULL);
if (ret == RTW_SUCCESS) {
@ -336,11 +337,11 @@ static int wps_connect_to_AP_by_open_system(char *target_ssid)
if (target_ssid != NULL) {
rtw_msleep_os(500); //wait scan complete.
while (1) {
ret = wifi_connect(target_ssid,
RTW_SECURITY_OPEN,
ret = wifi_connect(
NULL,
strlen(target_ssid),
0,
target_ssid,
RTW_SECURITY_OPEN,
0,
NULL);
if (ret == RTW_SUCCESS) {