forked from espressif/arduino-esp32
Esp32 s3 support (#6341)
Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com> Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com> Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com> Co-authored-by: Tomáš Pilný <34927466+PilnyTomas@users.noreply.github.com> Co-authored-by: Pedro Minatel <pedro.minatel@espressif.com> Co-authored-by: Ivan Grokhotkov <ivan@espressif.com> Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net>
This commit is contained in:
@ -0,0 +1,116 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef ESP_DPP_H
|
||||
#define ESP_DPP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_ERR_DPP_FAILURE (ESP_ERR_WIFI_BASE + 151) /*!< Generic failure during DPP Operation */
|
||||
#define ESP_ERR_DPP_TX_FAILURE (ESP_ERR_WIFI_BASE + 152) /*!< DPP Frame Tx failed OR not Acked */
|
||||
#define ESP_ERR_DPP_INVALID_ATTR (ESP_ERR_WIFI_BASE + 153) /*!< Encountered invalid DPP Attribute */
|
||||
|
||||
/** @brief Types of Bootstrap Methods for DPP. */
|
||||
typedef enum dpp_bootstrap_type {
|
||||
DPP_BOOTSTRAP_QR_CODE, /**< QR Code Method */
|
||||
DPP_BOOTSTRAP_PKEX, /**< Proof of Knowledge Method */
|
||||
DPP_BOOTSTRAP_NFC_URI, /**< NFC URI record Method */
|
||||
} esp_supp_dpp_bootstrap_t;
|
||||
|
||||
/** @brief Types of Callback Events received from DPP Supplicant. */
|
||||
typedef enum {
|
||||
ESP_SUPP_DPP_URI_READY, /**< URI is ready through Bootstrapping */
|
||||
ESP_SUPP_DPP_CFG_RECVD, /**< Config received via DPP Authentication */
|
||||
ESP_SUPP_DPP_FAIL, /**< DPP Authentication failure */
|
||||
} esp_supp_dpp_event_t;
|
||||
|
||||
/**
|
||||
* @brief Callback function for receiving DPP Events from Supplicant.
|
||||
*
|
||||
* Callback function will be called with DPP related information.
|
||||
*
|
||||
* @param evt DPP event ID
|
||||
* @param data Event data payload
|
||||
*/
|
||||
typedef void (*esp_supp_dpp_event_cb_t)(esp_supp_dpp_event_t evt, void *data);
|
||||
|
||||
/**
|
||||
* @brief Initialize DPP Supplicant
|
||||
*
|
||||
* Starts DPP Supplicant and initializes related Data Structures.
|
||||
*
|
||||
* @param evt_cb Callback function to receive DPP related events
|
||||
*
|
||||
* return
|
||||
* - ESP_OK: Success
|
||||
* - ESP_FAIL: Failure
|
||||
*/
|
||||
esp_err_t esp_supp_dpp_init(esp_supp_dpp_event_cb_t evt_cb);
|
||||
|
||||
/**
|
||||
* @brief De-initalize DPP Supplicant
|
||||
*
|
||||
* Frees memory from DPP Supplicant Data Structures.
|
||||
*/
|
||||
void esp_supp_dpp_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Generates Bootstrap Information as an Enrollee.
|
||||
*
|
||||
* Generates Out Of Band Bootstrap information as an Enrollee which can be
|
||||
* used by a DPP Configurator to provision the Enrollee.
|
||||
*
|
||||
* @param chan_list List of channels device will be available on for listening
|
||||
* @param type Bootstrap method type, only QR Code method is supported for now.
|
||||
* @param key (Optional) Private Key used to generate a Bootstrapping Public Key
|
||||
* @param info (Optional) Ancilliary Device Information like Serial Number
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
* - ESP_FAIL: Failure
|
||||
*/
|
||||
esp_err_t
|
||||
esp_supp_dpp_bootstrap_gen(const char *chan_list, esp_supp_dpp_bootstrap_t type,
|
||||
const char *key, const char *info);
|
||||
|
||||
/**
|
||||
* @brief Start listening on Channels provided during esp_supp_dpp_bootstrap_gen.
|
||||
*
|
||||
* Listens on every Channel from Channel List for a pre-defined wait time.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
* - ESP_FAIL: Generic Failure
|
||||
* - ESP_ERR_INVALID_STATE: ROC attempted before WiFi is started
|
||||
* - ESP_ERR_NO_MEM: Memory allocation failed while posting ROC request
|
||||
*/
|
||||
esp_err_t esp_supp_dpp_start_listen(void);
|
||||
|
||||
/**
|
||||
* @brief Stop listening on Channels.
|
||||
*
|
||||
* Stops listening on Channels and cancels ongoing listen operation.
|
||||
*/
|
||||
void esp_supp_dpp_stop_listen(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ESP_DPP_H */
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _ESP_MBO_H
|
||||
#define _ESP_MBO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* enum non_pref_chan_reason: Reason for non preference of channel
|
||||
*/
|
||||
enum non_pref_chan_reason {
|
||||
NON_PREF_CHAN_REASON_UNSPECIFIED = 0,
|
||||
NON_PREF_CHAN_REASON_RSSI = 1,
|
||||
NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2,
|
||||
NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Channel structure for non preferred channel
|
||||
*
|
||||
* @param reason: enum non_pref_chan_reason
|
||||
* @param oper_class: operating class for the channel
|
||||
* @param chan: channel number
|
||||
* @param preference: channel preference
|
||||
*/
|
||||
struct non_pref_chan {
|
||||
enum non_pref_chan_reason reason;
|
||||
uint8_t oper_class;
|
||||
uint8_t chan;
|
||||
uint8_t preference;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Array structure for non preferred channel struct
|
||||
*
|
||||
* @param non_pref_chan_num: channel count
|
||||
* @param chan: array of non_pref_chan type
|
||||
*/
|
||||
struct non_pref_chan_s {
|
||||
size_t non_pref_chan_num;
|
||||
struct non_pref_chan chan[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Update channel preference for MBO IE
|
||||
*
|
||||
* @param non_pref_chan: Non preference channel list
|
||||
*
|
||||
* @return
|
||||
* - 0: success else failure
|
||||
*/
|
||||
int esp_mbo_update_non_pref_chan(struct non_pref_chan_s *non_pref_chan);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _ESP_RRM_H
|
||||
#define _ESP_RRM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Callback function type to get neighbor report
|
||||
*
|
||||
* @param ctx: neighbor report context
|
||||
* @param report: neighbor report
|
||||
* @param report_len: neighbor report length
|
||||
*
|
||||
* @return
|
||||
* - void
|
||||
*/
|
||||
typedef void (*neighbor_rep_request_cb)(void *ctx, const uint8_t *report, size_t report_len);
|
||||
|
||||
/**
|
||||
* @brief Send Radio measurement neighbor report request to connected AP
|
||||
*
|
||||
* @param cb: callback function for neighbor report
|
||||
* @param cb_ctx: callback context
|
||||
*
|
||||
* @return
|
||||
* - 0: success else failure
|
||||
*/
|
||||
int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
|
||||
void *cb_ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _ESP_WNM_H
|
||||
#define _ESP_WNM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* enum btm_query_reason: Reason code for sending btm query
|
||||
*/
|
||||
enum btm_query_reason {
|
||||
REASON_UNSPECIFIED = 0,
|
||||
REASON_FRAME_LOSS = 1,
|
||||
REASON_DELAY = 2,
|
||||
REASON_BANDWIDTH = 3,
|
||||
REASON_LOAD_BALANCE = 4,
|
||||
REASON_RSSI = 5,
|
||||
REASON_RETRANSMISSIONS = 6,
|
||||
REASON_INTERFERENCE = 7,
|
||||
REASON_GRAY_ZONE = 8,
|
||||
REASON_PREMIUM_AP = 9,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Send bss transition query to connected AP
|
||||
*
|
||||
* @param query_reason: reason for sending query
|
||||
* @param btm_candidates: btm candidates list if available
|
||||
* @param cand_list: whether candidate list to be included from scan results available in supplicant's cache.
|
||||
*
|
||||
* @return
|
||||
* - 0: success else failure
|
||||
*/
|
||||
int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason,
|
||||
const char *btm_candidates,
|
||||
int cand_list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,79 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_WPA_H__
|
||||
#define __ESP_WPA_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
#include "esp_wifi_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup WiFi_APIs WiFi Related APIs
|
||||
* @brief WiFi APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup WiFi_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup WPA_APIs WPS APIs
|
||||
* @brief ESP32 Supplicant APIs
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup WPA_APIs
|
||||
* @{
|
||||
*/
|
||||
/* Crypto callback functions */
|
||||
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
/* Mesh crypto callback functions */
|
||||
const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
|
||||
|
||||
/**
|
||||
* @brief Supplicant initialization
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_ERR_NO_MEM : out of memory
|
||||
*/
|
||||
esp_err_t esp_supplicant_init(void);
|
||||
|
||||
/**
|
||||
* @brief Supplicant deinitialization
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - others: failed
|
||||
*/
|
||||
esp_err_t esp_supplicant_deinit(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESP_WPA_H__ */
|
@ -0,0 +1,252 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _ESP_WPA2_H
|
||||
#define _ESP_WPA2_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
typedef enum {
|
||||
ESP_EAP_TTLS_PHASE2_EAP,
|
||||
ESP_EAP_TTLS_PHASE2_MSCHAPV2,
|
||||
ESP_EAP_TTLS_PHASE2_MSCHAP,
|
||||
ESP_EAP_TTLS_PHASE2_PAP,
|
||||
ESP_EAP_TTLS_PHASE2_CHAP
|
||||
} esp_eap_ttls_phase2_types;
|
||||
|
||||
typedef struct {
|
||||
int fast_provisioning;
|
||||
int fast_max_pac_list_len;
|
||||
bool fast_pac_format_binary;
|
||||
} esp_eap_fast_config;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enable wpa2 enterprise authentication.
|
||||
*
|
||||
* @attention 1. wpa2 enterprise authentication can only be used when ESP32 station is enabled.
|
||||
* @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed.
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable wpa2 enterprise authentication.
|
||||
*
|
||||
* @attention 1. wpa2 enterprise authentication can only be used when ESP32 station is enabled.
|
||||
* @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed.
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Set identity for PEAP/TTLS method.
|
||||
*
|
||||
* @attention The API only passes the parameter identity to the global pointer variable in wpa2 enterprise module.
|
||||
*
|
||||
* @param identity: point to address where stores the identity;
|
||||
* @param len: length of identity, limited to 1~127
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_identity(const unsigned char *identity, int len);
|
||||
|
||||
/**
|
||||
* @brief Clear identity for PEAP/TTLS method.
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_identity(void);
|
||||
|
||||
/**
|
||||
* @brief Set username for PEAP/TTLS method.
|
||||
*
|
||||
* @attention The API only passes the parameter username to the global pointer variable in wpa2 enterprise module.
|
||||
*
|
||||
* @param username: point to address where stores the username;
|
||||
* @param len: length of username, limited to 1~127
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_username(const unsigned char *username, int len);
|
||||
|
||||
/**
|
||||
* @brief Clear username for PEAP/TTLS method.
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_username(void);
|
||||
|
||||
/**
|
||||
* @brief Set password for PEAP/TTLS method..
|
||||
*
|
||||
* @attention The API only passes the parameter password to the global pointer variable in wpa2 enterprise module.
|
||||
*
|
||||
* @param password: point to address where stores the password;
|
||||
* @param len: length of password(len > 0)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_INVALID_ARG: fail(len <= 0)
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_password(const unsigned char *password, int len);
|
||||
|
||||
/**
|
||||
* @brief Clear password for PEAP/TTLS method..
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_password(void);
|
||||
|
||||
/**
|
||||
* @brief Set new password for MSCHAPv2 method..
|
||||
*
|
||||
* @attention 1. The API only passes the parameter password to the global pointer variable in wpa2 enterprise module.
|
||||
* @attention 2. The new password is used to substitute the old password when eap-mschapv2 failure request message with error code ERROR_PASSWD_EXPIRED is received.
|
||||
*
|
||||
* @param new_password: point to address where stores the password;
|
||||
* @param len: length of password
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_INVALID_ARG: fail(len <= 0)
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(const unsigned char *new_password, int len);
|
||||
|
||||
/**
|
||||
* @brief Clear new password for MSCHAPv2 method..
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_new_password(void);
|
||||
|
||||
/**
|
||||
* @brief Set CA certificate for PEAP/TTLS method.
|
||||
*
|
||||
* @attention 1. The API only passes the parameter ca_cert to the global pointer variable in wpa2 enterprise module.
|
||||
* @attention 2. The ca_cert should be zero terminated.
|
||||
*
|
||||
* @param ca_cert: point to address where stores the CA certificate;
|
||||
* @param ca_cert_len: length of ca_cert
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(const unsigned char *ca_cert, int ca_cert_len);
|
||||
|
||||
/**
|
||||
* @brief Clear CA certificate for PEAP/TTLS method.
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_ca_cert(void);
|
||||
|
||||
/**
|
||||
* @brief Set client certificate and key.
|
||||
*
|
||||
* @attention 1. The API only passes the parameter client_cert, private_key and private_key_passwd to the global pointer variable in wpa2 enterprise module.
|
||||
* @attention 2. The client_cert, private_key and private_key_passwd should be zero terminated.
|
||||
*
|
||||
* @param client_cert: point to address where stores the client certificate;
|
||||
* @param client_cert_len: length of client certificate;
|
||||
* @param private_key: point to address where stores the private key;
|
||||
* @param private_key_len: length of private key, limited to 1~2048;
|
||||
* @param private_key_password: point to address where stores the private key password;
|
||||
* @param private_key_password_len: length of private key password;
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_cert_key(const unsigned char *client_cert, int client_cert_len, const unsigned char *private_key, int private_key_len, const unsigned char *private_key_passwd, int private_key_passwd_len);
|
||||
|
||||
/**
|
||||
* @brief Clear client certificate and key.
|
||||
*/
|
||||
void esp_wifi_sta_wpa2_ent_clear_cert_key(void);
|
||||
|
||||
/**
|
||||
* @brief Set wpa2 enterprise certs time check(disable or not).
|
||||
*
|
||||
* @param true: disable wpa2 enterprise certs time check
|
||||
* @param false: enable wpa2 enterprise certs time check
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_disable_time_check(bool disable);
|
||||
|
||||
/**
|
||||
* @brief Get wpa2 enterprise certs time check(disable or not).
|
||||
*
|
||||
* @param disable: store disable value
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_get_disable_time_check(bool *disable);
|
||||
|
||||
/**
|
||||
* @brief Set wpa2 enterprise ttls phase2 method
|
||||
*
|
||||
* @param type: the type of phase 2 method to be used
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(esp_eap_ttls_phase2_types type);
|
||||
|
||||
/**
|
||||
* @brief enable/disable 192 bit suite b certification checks
|
||||
*
|
||||
* @param enable: bool to enable/disable it.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_set_suiteb_192bit_certification(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Set client pac file
|
||||
*
|
||||
* @attention 1. For files read from the file system, length has to be decremented by 1 byte.
|
||||
* @attention 2. Disabling the WPA_MBEDTLS_CRYPTO config is required to use EAP-FAST.
|
||||
*
|
||||
* @param pac_file: pointer to the pac file
|
||||
* pac_file_len: length of the pac file
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_pac_file(const unsigned char *pac_file, int pac_file_len);
|
||||
|
||||
/**
|
||||
* @brief Set Phase 1 parameters for EAP-FAST
|
||||
*
|
||||
* @attention 1. Disabling the WPA_MBEDTLS_CRYPTO config is required to use EAP-FAST.
|
||||
*
|
||||
* @param config: eap fast phase 1 configuration
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_INVALID_ARG: fail(out of bound arguments)
|
||||
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_set_fast_phase1_params(esp_eap_fast_config config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,141 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_WPS_H__
|
||||
#define __ESP_WPS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
#include "esp_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup WiFi_APIs WiFi Related APIs
|
||||
* @brief WiFi APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup WiFi_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup WPS_APIs WPS APIs
|
||||
* @brief ESP32 WPS APIs
|
||||
*
|
||||
* WPS can only be used when ESP32 station is enabled.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup WPS_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ESP_ERR_WIFI_REGISTRAR (ESP_ERR_WIFI_BASE + 51) /*!< WPS registrar is not supported */
|
||||
#define ESP_ERR_WIFI_WPS_TYPE (ESP_ERR_WIFI_BASE + 52) /*!< WPS type error */
|
||||
#define ESP_ERR_WIFI_WPS_SM (ESP_ERR_WIFI_BASE + 53) /*!< WPS state machine is not initialized */
|
||||
|
||||
typedef enum wps_type {
|
||||
WPS_TYPE_DISABLE = 0,
|
||||
WPS_TYPE_PBC,
|
||||
WPS_TYPE_PIN,
|
||||
WPS_TYPE_MAX,
|
||||
} wps_type_t;
|
||||
|
||||
#define WPS_MAX_MANUFACTURER_LEN 65
|
||||
#define WPS_MAX_MODEL_NUMBER_LEN 33
|
||||
#define WPS_MAX_MODEL_NAME_LEN 33
|
||||
#define WPS_MAX_DEVICE_NAME_LEN 33
|
||||
|
||||
typedef struct {
|
||||
char manufacturer[WPS_MAX_MANUFACTURER_LEN]; /*!< Manufacturer, null-terminated string. The default manufcturer is used if the string is empty */
|
||||
char model_number[WPS_MAX_MODEL_NUMBER_LEN]; /*!< Model number, null-terminated string. The default model number is used if the string is empty */
|
||||
char model_name[WPS_MAX_MODEL_NAME_LEN]; /*!< Model name, null-terminated string. The default model name is used if the string is empty */
|
||||
char device_name[WPS_MAX_DEVICE_NAME_LEN]; /*!< Device name, null-terminated string. The default device name is used if the string is empty */
|
||||
} wps_factory_information_t;
|
||||
|
||||
typedef struct {
|
||||
wps_type_t wps_type;
|
||||
wps_factory_information_t factory_info;
|
||||
} esp_wps_config_t;
|
||||
|
||||
#define WPS_CONFIG_INIT_DEFAULT(type) { \
|
||||
.wps_type = type, \
|
||||
.factory_info = { \
|
||||
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(manufacturer, "ESPRESSIF") \
|
||||
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(model_number, "ESP32") \
|
||||
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(model_name, "ESPRESSIF IOT") \
|
||||
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(device_name, "ESP STATION") \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable Wi-Fi WPS function.
|
||||
*
|
||||
* @attention WPS can only be used when ESP32 station is enabled.
|
||||
*
|
||||
* @param wps_type_t wps_type : WPS type, so far only WPS_TYPE_PBC and WPS_TYPE_PIN is supported
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
|
||||
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
|
||||
* - ESP_FAIL : wps initialization fails
|
||||
*/
|
||||
esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Disable Wi-Fi WPS function and release resource it taken.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
|
||||
*/
|
||||
esp_err_t esp_wifi_wps_disable(void);
|
||||
|
||||
/**
|
||||
* @brief WPS starts to work.
|
||||
*
|
||||
* @attention WPS can only be used when ESP32 station is enabled.
|
||||
*
|
||||
* @param timeout_ms : maximum blocking time before API return.
|
||||
* - 0 : non-blocking
|
||||
* - 1~120000 : blocking time (not supported in IDF v1.0)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
|
||||
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
|
||||
* - ESP_ERR_WIFI_WPS_SM : wps state machine is not initialized
|
||||
* - ESP_FAIL : wps initialization fails
|
||||
*/
|
||||
esp_err_t esp_wifi_wps_start(int timeout_ms);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESP_WPS_H__ */
|
Reference in New Issue
Block a user