1 /*
2  * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ESP_DPP_I_H
8 #define ESP_DPP_I_H
9 
10 #include "esp_err.h"
11 #include "utils/includes.h"
12 #include "utils/common.h"
13 
14 #include "common/dpp.h"
15 #include "esp_dpp.h"
16 #include "esp_wifi_driver.h"
17 
18 #define DPP_TASK_STACK_SIZE  (6144 + TASK_STACK_SIZE_ADD)
19 
20 enum SIG_DPP {
21     SIG_DPP_RESET = 0,
22     SIG_DPP_BOOTSTRAP_GEN,
23     SIG_DPP_RX_ACTION,
24     SIG_DPP_LISTEN_NEXT_CHANNEL,
25     SIG_DPP_DEL_TASK,
26     SIG_DPP_DEINIT_AUTH,
27     SIG_DPP_MAX,
28 };
29 
30 typedef struct {
31     uint32_t id;
32     uint32_t data;
33 } dpp_event_t;
34 
35 #define BOOTSTRAP_ROC_WAIT_TIME 500
36 #define OFFCHAN_TX_WAIT_TIME 500
37 
38 struct dpp_bootstrap_params_t {
39     enum dpp_bootstrap_type type;
40     uint8_t chan_list[14];
41     uint8_t num_chan;
42     uint8_t mac[6];
43     uint32_t info_len;
44     char *info;
45 };
46 
47 struct esp_dpp_context_t {
48     struct dpp_bootstrap_params_t bootstrap_params;
49     struct dpp_authentication *dpp_auth;
50     int gas_dialog_token;
51     esp_supp_dpp_event_cb_t dpp_event_cb;
52     struct dpp_global *dpp_global;
53     wifi_config_t wifi_cfg;
54     int id;
55 };
56 
57 int esp_supp_rx_action(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel);
58 
59 #ifdef CONFIG_ESP_WIFI_DPP_SUPPORT
60 bool is_dpp_enabled(void);
61 #else
is_dpp_enabled(void)62 static inline bool is_dpp_enabled(void)
63 {
64     return false;
65 }
66 #endif
67 #endif /* ESP_DPP_I_H */
68