1 /*
2 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: Declare public API related to the action_oui called by north bound
22 * HDD/OSIF/LIM
23 */
24
25 #ifndef _WLAN_ACTION_OUI_UCFG_API_H_
26 #define _WLAN_ACTION_OUI_UCFG_API_H_
27
28 #include <qdf_status.h>
29 #include <qdf_types.h>
30 #include "wlan_action_oui_public_struct.h"
31 #include "wlan_action_oui_objmgr.h"
32
33 #ifdef WLAN_FEATURE_ACTION_OUI
34
35 /**
36 * ucfg_action_oui_init() - Register notification handlers.
37 *
38 * This function registers action_oui notification handlers which are
39 * invoked from psoc create/destroy handlers.
40 *
41 * Return: For successful registration - QDF_STATUS_SUCCESS,
42 * else QDF_STATUS error codes.
43 */
44 QDF_STATUS ucfg_action_oui_init(void);
45
46 /**
47 * ucfg_action_oui_deinit() - Unregister notification handlers.
48 *
49 * This function Unregisters action_oui notification handlers which are
50 * invoked from psoc create/destroy handlers.
51 *
52 * Return: None
53 */
54 void ucfg_action_oui_deinit(void);
55
56 /**
57 * ucfg_action_oui_psoc_enable() - Notify action oui psoc enable
58 * @psoc: psoc object
59 *
60 * Return: None
61 */
62 void ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc);
63
64 /**
65 * ucfg_action_oui_psoc_disable() - Notify action oui psoc disable
66 * @psoc: psoc object
67 *
68 * Return: None
69 */
70 void ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc);
71
72 /**
73 * ucfg_action_oui_parse() - Parse input string and extract extensions.
74 * @psoc: objmgr psoc object
75 * @in_str: input string to be parsed
76 * @action_id: action to which given string corresponds
77 *
78 * This is a wrapper function which invokes internal function
79 * action_oui_extract() to extract OUIs and related attributes.
80 *
81 * Return: For successful parse - QDF_STATUS_SUCCESS,
82 * else QDF_STATUS error codes.
83 */
84 QDF_STATUS
85 ucfg_action_oui_parse(struct wlan_objmgr_psoc *psoc,
86 const uint8_t *in_str,
87 enum action_oui_id action_id);
88
89 /**
90 * ucfg_action_oui_send() - Send action_oui and related attributes to Fw.
91 * @psoc: objmgr psoc object
92 *
93 * This is a wrapper function which invokes internal function
94 * action_oui_send() to send OUIs and related attributes to firmware.
95 *
96 * Return: For successful send - QDF_STATUS_SUCCESS,
97 * else QDF_STATUS error codes.
98 */
99 QDF_STATUS ucfg_action_oui_send(struct wlan_objmgr_psoc *psoc);
100
101 /**
102 * ucfg_action_oui_enabled() - State of action_oui component
103 * @psoc: psoc object
104 *
105 * Return: True if action oui is enabled
106 */
107 bool ucfg_action_oui_enabled(struct wlan_objmgr_psoc *psoc);
108
109 /**
110 * ucfg_action_oui_search() - Check for OUIs and related info in IE data.
111 * @psoc: objmgr psoc object
112 * @attr: pointer to structure containing type of action, beacon IE data etc.,
113 * @action_id: type of action to be checked
114 *
115 * This is a wrapper function which invokes internal function to search
116 * for OUIs and related info (specified from ini file) in vendor specific
117 * data of beacon IE for given action.
118 *
119 * Return: If search is successful return true else false.
120 */
121 bool ucfg_action_oui_search(struct wlan_objmgr_psoc *psoc,
122 struct action_oui_search_attr *attr,
123 enum action_oui_id action_id);
124
125 /**
126 * ucfg_action_oui_cleanup() - Remove all in existing oui entry.
127 * @psoc: objmgr psoc object
128 * @action_id: type of action to be removed
129 *
130 * This is a wrapper function which invokes internal function to remove
131 * all the existing oui entry.
132 *
133 * Return: QDF_STATUS_SUCCESS If remove is successful.
134 */
135 QDF_STATUS
136 ucfg_action_oui_cleanup(struct wlan_objmgr_psoc *psoc,
137 enum action_oui_id action_id);
138
139 /**
140 * ucfg_action_oui_send_by_id() - Send action oui for action id
141 * @psoc: objmgr psoc object
142 * @id: type of action to be sent
143 *
144 * This is a wrapper function which invokes internal function to send
145 * action oui entry to firmware.
146 *
147 * Return: QDF_STATUS_SUCCESS If sending is successful.
148 */
149 QDF_STATUS ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc *psoc,
150 enum action_oui_id id);
151
152 /**
153 * ucfg_action_oui_get_config() - Get current action INI config
154 * @psoc: objmgr psoc object
155 * @action_id: type of action to get
156 *
157 * Return: config string.
158 */
159 uint8_t *
160 ucfg_action_oui_get_config(struct wlan_objmgr_psoc *psoc,
161 enum action_oui_id action_id);
162 #else
163
164 /**
165 * ucfg_action_oui_init() - Register notification handlers.
166 *
167 * This function registers action_oui notification handlers which are
168 * invoked from psoc create/destroy handlers.
169 *
170 * Return: For successful registration - QDF_STATUS_SUCCESS,
171 * else QDF_STATUS error codes.
172 */
173 static inline
ucfg_action_oui_init(void)174 QDF_STATUS ucfg_action_oui_init(void)
175 {
176 return QDF_STATUS_SUCCESS;
177 }
178
179 /**
180 * ucfg_action_oui_deinit() - Unregister notification handlers.
181 *
182 * This function Unregisters action_oui notification handlers which are
183 * invoked from psoc create/destroy handlers.
184 *
185 * Return: None
186 */
187 static inline
ucfg_action_oui_deinit(void)188 void ucfg_action_oui_deinit(void)
189 {
190 }
191
192 /**
193 * ucfg_action_oui_psoc_enable() - Notify action oui psoc enable
194 * @psoc: psoc object
195 *
196 * Return: None
197 */
198 static inline
ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc * psoc)199 void ucfg_action_oui_psoc_enable(struct wlan_objmgr_psoc *psoc)
200 {
201 }
202
203 /**
204 * ucfg_action_oui_psoc_disable() - Notify action oui psoc disable
205 * @psoc: psoc object
206 *
207 * Return: None
208 */
209 static inline
ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc * psoc)210 void ucfg_action_oui_psoc_disable(struct wlan_objmgr_psoc *psoc)
211 {
212 }
213
214 /**
215 * ucfg_action_oui_parse() - Parse input string of action_id specified.
216 * @psoc: objmgr psoc object
217 * @in_str: input string to be parsed
218 * @action_id: action to which given string corresponds
219 *
220 * This is a wrapper function which invokes internal function
221 * action_oui_extract() to extract OUIs and related attributes.
222 *
223 * Return: For successful parse - QDF_STATUS_SUCCESS,
224 * else QDF_STATUS error codes.
225 */
226 static inline QDF_STATUS
ucfg_action_oui_parse(struct wlan_objmgr_psoc * psoc,const uint8_t * in_str,enum action_oui_id action_id)227 ucfg_action_oui_parse(struct wlan_objmgr_psoc *psoc,
228 const uint8_t *in_str,
229 enum action_oui_id action_id)
230 {
231 return QDF_STATUS_SUCCESS;
232 }
233
234 /**
235 * ucfg_action_oui_send() - Send action_oui and related attributes to Fw.
236 * @psoc: objmgr psoc object
237 *
238 * This is a wrapper function which invokes internal function
239 * action_oui_send() to send OUIs and related attributes to firmware.
240 *
241 * Return: For successful send - QDF_STATUS_SUCCESS,
242 * else QDF_STATUS error codes.
243 */
244 static inline
ucfg_action_oui_send(struct wlan_objmgr_psoc * psoc)245 QDF_STATUS ucfg_action_oui_send(struct wlan_objmgr_psoc *psoc)
246 {
247 return QDF_STATUS_SUCCESS;
248 }
249
250 /**
251 * ucfg_action_oui_enabled() - State of action_oui component
252 *
253 * Return: When action_oui component is present return true
254 * else return false.
255 */
ucfg_action_oui_enabled(void)256 static inline bool ucfg_action_oui_enabled(void)
257 {
258 return false;
259 }
260
261 /**
262 * ucfg_action_oui_search() - Check for OUIs and related info in IE data.
263 * @psoc: objmgr psoc object
264 * @attr: pointer to structure containing type of action, beacon IE data etc.,
265 * @action_id: type of action to be checked
266 *
267 * This is a wrapper function which invokes internal function to search
268 * for OUIs and related info (specified from ini file) in vendor specific
269 * data of beacon IE for given action.
270 *
271 * Return: If search is successful return true else false.
272 */
273 static inline
ucfg_action_oui_search(struct wlan_objmgr_psoc * psoc,struct action_oui_search_attr * attr,enum action_oui_id action_id)274 bool ucfg_action_oui_search(struct wlan_objmgr_psoc *psoc,
275 struct action_oui_search_attr *attr,
276 enum action_oui_id action_id)
277 {
278 return false;
279 }
280
281 /**
282 * ucfg_action_oui_cleanup() - Remove all of existing oui entry
283 * @psoc: objmgr psoc object
284 * @action_id: type of action to be removed
285 *
286 * This is a wrapper function which invokes internal function to remove
287 * all the existing oui entry.
288 *
289 * Return: QDF_STATUS_SUCCESS If remove is successful.
290 */
291 static inline
292 QDF_STATUS
ucfg_action_oui_cleanup(struct wlan_objmgr_psoc * psoc,enum action_oui_id action_id)293 ucfg_action_oui_cleanup(struct wlan_objmgr_psoc *psoc,
294 enum action_oui_id action_id)
295 {
296 return QDF_STATUS_SUCCESS;
297 }
298
299 /**
300 * ucfg_action_oui_send_by_id() - Send action oui for action id
301 * @psoc: objmgr psoc object
302 * @id: type of action to be sent
303 *
304 * This is a wrapper function which invokes internal function to send
305 * action oui entry to firmware.
306 *
307 * Return: QDF_STATUS_SUCCESS If sending is successful.
308 */
309 static inline
ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc * psoc,enum action_oui_id id)310 QDF_STATUS ucfg_action_oui_send_by_id(struct wlan_objmgr_psoc *psoc,
311 enum action_oui_id id)
312 {
313 return QDF_STATUS_SUCCESS;
314 }
315
316 /**
317 * ucfg_action_oui_get_config() - Get current action INI config
318 * @psoc: objmgr psoc object
319 * @action_id: type of action to get
320 *
321 * Return: config string.
322 */
323 static inline uint8_t *
ucfg_action_oui_get_config(struct wlan_objmgr_psoc * psoc,enum action_oui_id action_id)324 ucfg_action_oui_get_config(struct wlan_objmgr_psoc *psoc,
325 enum action_oui_id action_id)
326 {
327 return "";
328 }
329 #endif /* WLAN_FEATURE_ACTION_OUI */
330
331 #endif /* _WLAN_ACTION_OUI_UCFG_API_H_ */
332