1 // Copyright 2020 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef ESP_DPP_I_H
16 #define ESP_DPP_I_H
17 
18 #include "esp_err.h"
19 #include "utils/includes.h"
20 #include "utils/common.h"
21 
22 #include "common/dpp.h"
23 #include "esp_dpp.h"
24 #include "esp_wifi_driver.h"
25 
26 #define DPP_TASK_STACK_SIZE  (6144 + TASK_STACK_SIZE_ADD)
27 
28 enum SIG_DPP {
29     SIG_DPP_RESET = 0,
30     SIG_DPP_BOOTSTRAP_GEN,
31     SIG_DPP_RX_ACTION,
32     SIG_DPP_LISTEN_NEXT_CHANNEL,
33     SIG_DPP_DEL_TASK,
34     SIG_DPP_MAX,
35 };
36 
37 typedef struct {
38     uint32_t id;
39     uint32_t data;
40 } dpp_event_t;
41 
42 #define BOOTSTRAP_ROC_WAIT_TIME 500
43 #define OFFCHAN_TX_WAIT_TIME 500
44 
45 struct dpp_bootstrap_params_t {
46     enum dpp_bootstrap_type type;
47     uint8_t chan_list[14];
48     uint8_t num_chan;
49     uint8_t mac[6];
50     uint32_t key_len;
51     char *key;
52     uint32_t info_len;
53     char *info;
54 };
55 
56 struct esp_dpp_context_t {
57     struct dpp_bootstrap_params_t bootstrap_params;
58     struct dpp_authentication *dpp_auth;
59     int gas_dialog_token;
60     esp_supp_dpp_event_cb_t dpp_event_cb;
61     struct dpp_global *dpp_global;
62     wifi_config_t wifi_cfg;
63     int id;
64 };
65 
66 int esp_supp_rx_action(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel);
67 
68 #endif /* ESP_DPP_I_H */
69