2022-01-04 11:34:06 +05:30
|
|
|
/*
|
2025-05-05 15:43:07 +05:30
|
|
|
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
2022-01-04 11:34:06 +05:30
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2020-10-27 18:17:38 +05:30
|
|
|
|
|
|
|
#ifndef ESP_DPP_H
|
|
|
|
#define ESP_DPP_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
2023-11-06 14:25:23 +05:30
|
|
|
#include "esp_wifi_types.h"
|
2020-10-27 18:17:38 +05:30
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2024-09-20 14:46:05 +08:00
|
|
|
#define ESP_DPP_MAX_CHAN_COUNT 5
|
2023-11-28 07:52:35 +05:30
|
|
|
|
2020-10-27 18:23:19 +05:30
|
|
|
#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 */
|
2024-05-24 11:57:37 +05:30
|
|
|
#define ESP_ERR_DPP_AUTH_TIMEOUT (ESP_ERR_WIFI_BASE + 154) /*!< DPP Auth response was not received in time */
|
2024-09-20 14:46:05 +08:00
|
|
|
#define ESP_ERR_DPP_INVALID_LIST (ESP_ERR_WIFI_BASE + 155) /*!< Channel list given in esp_supp_dpp_bootstrap_gen() is not valid or too big */
|
2024-10-07 14:38:56 +05:30
|
|
|
#define ESP_ERR_DPP_CONF_TIMEOUT (ESP_ERR_WIFI_BASE + 156) /*!< DPP Configuration was not received in time */
|
2024-09-20 14:46:05 +08:00
|
|
|
|
2020-10-27 18:23:19 +05:30
|
|
|
/** @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;
|
2020-10-27 18:17:38 +05:30
|
|
|
|
2020-10-27 18:23:19 +05:30
|
|
|
/**
|
|
|
|
* @brief Initialize DPP Supplicant
|
|
|
|
*
|
|
|
|
* Starts DPP Supplicant and initializes related Data Structures.
|
|
|
|
*
|
|
|
|
* return
|
|
|
|
* - ESP_OK: Success
|
|
|
|
* - ESP_FAIL: Failure
|
|
|
|
*/
|
2025-07-14 18:09:20 +05:30
|
|
|
esp_err_t esp_supp_dpp_init(void);
|
2020-10-27 18:23:19 +05:30
|
|
|
|
|
|
|
/**
|
2025-04-30 18:35:39 +08:00
|
|
|
* @brief De-initialize DPP Supplicant
|
2020-10-27 18:23:19 +05:30
|
|
|
*
|
|
|
|
* Frees memory from DPP Supplicant Data Structures.
|
2023-11-06 14:25:23 +05:30
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK: Success
|
2020-10-27 18:23:19 +05:30
|
|
|
*/
|
2023-11-06 14:25:23 +05:30
|
|
|
esp_err_t esp_supp_dpp_deinit(void);
|
2020-10-27 18:17:38 +05:30
|
|
|
|
2020-10-27 18:23:19 +05:30
|
|
|
/**
|
|
|
|
* @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.
|
2022-03-08 17:22:02 +05:30
|
|
|
* @param key (Optional) 32 byte Raw Private Key for generating a Bootstrapping Public Key
|
2024-01-23 15:09:45 +01:00
|
|
|
* @param info (Optional) Ancillary Device Information like Serial Number
|
2020-10-27 18:23:19 +05:30
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK: Success
|
2024-09-20 14:46:05 +08:00
|
|
|
* - ESP_ERR_DPP_INVALID_LIST: Channel list not valid
|
2020-10-27 18:23:19 +05:30
|
|
|
* - 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);
|
2020-10-27 18:17:38 +05:30
|
|
|
|
2020-10-27 18:23:19 +05:30
|
|
|
/**
|
|
|
|
* @brief Stop listening on Channels.
|
|
|
|
*
|
|
|
|
* Stops listening on Channels and cancels ongoing listen operation.
|
2023-11-06 14:25:23 +05:30
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK: Success
|
|
|
|
* - ESP_FAIL: Failure
|
2020-10-27 18:23:19 +05:30
|
|
|
*/
|
2023-11-06 14:25:23 +05:30
|
|
|
esp_err_t esp_supp_dpp_stop_listen(void);
|
2020-10-27 18:17:38 +05:30
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* ESP_DPP_H */
|