1 /**
2  * Copyright 2020 Espressif Systems (Shanghai) PTE LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ESP_COMMON_I_H
18 #define ESP_COMMON_I_H
19 
20 #include "utils/includes.h"
21 
22 struct wpa_funcs;
23 
24 #ifdef ROAMING_SUPPORT
25 struct ieee_mgmt_frame {
26 	u8 sender[ETH_ALEN];
27 	u8 channel;
28 	u32 rssi;
29 	size_t len;
30 	u8 payload[0];
31 };
32 
33 typedef struct {
34     uint32_t id;
35     uint32_t data;
36 } supplicant_event_t;
37 
38 #define SUPPLICANT_API_LOCK() xSemaphoreTakeRecursive(s_supplicant_api_lock, portMAX_DELAY)
39 #define SUPPLICANT_API_UNLOCK() xSemaphoreGiveRecursive(s_supplicant_api_lock)
40 
41 #define SUPPLICANT_TASK_STACK_SIZE (6144 + TASK_STACK_SIZE_ADD)
42 enum SIG_SUPPLICANT {
43 	SIG_SUPPLICANT_RX_ACTION,
44 	SIG_SUPPLICANT_SCAN_DONE,
45 	SIG_SUPPLICANT_DEL_TASK,
46 	SIG_SUPPLICANT_MAX,
47 };
48 
49 int esp_supplicant_post_evt(uint32_t evt_id, uint32_t data);
50 int esp_ieee80211_handle_rx_frm(u8 type, u8 *frame, size_t len, u8 *sender,
51 			    u32 rssi, u8 channel, u64 current_tsf);
52 void esp_set_rm_enabled_ie(void);
53 void esp_get_tx_power(uint8_t *tx_power);
54 void esp_supplicant_common_init(struct wpa_funcs *wpa_cb);
55 #else
56 
57 #include "esp_rrm.h"
58 #include "esp_wnm.h"
59 
esp_set_rm_enabled_ie(void)60 static inline void esp_set_rm_enabled_ie(void) {}
esp_ieee80211_handle_rx_frm(u8 type,u8 * frame,size_t len,u8 * sender,u32 rssi,u8 channel,u64 current_tsf)61 static inline int esp_ieee80211_handle_rx_frm(u8 type, u8 *frame, size_t len, u8 *sender,
62 			    u32 rssi, u8 channel, u64 current_tsf)
63 {
64 	return -1;
65 }
esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,void * cb_ctx)66 int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
67 				      void *cb_ctx)
68 {
69 	return -1;
70 }
71 
esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason,const char * btm_candidates,int cand_list)72 int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason,
73 					   const char *btm_candidates,
74 					   int cand_list)
75 {
76 	return -1;
77 }
78 
79 #endif
80 #endif
81