xref: /wlan-driver/qcacld-3.0/components/coap/core/inc/wlan_coap_main.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /*
18  * DOC: contains declarations for CoAP core functions
19  */
20 
21 #ifndef _WLAN_COAP_MAIN_H_
22 #define _WLAN_COAP_MAIN_H_
23 
24 #ifdef WLAN_FEATURE_COAP
25 #include "wlan_objmgr_vdev_obj.h"
26 
27 #define coap_err(params...) \
28 	QDF_TRACE_ERROR(QDF_MODULE_ID_COAP, params)
29 #define coap_info(params...) \
30 	QDF_TRACE_INFO(QDF_MODULE_ID_COAP, params)
31 #define coap_debug(params...) \
32 	QDF_TRACE_DEBUG(QDF_MODULE_ID_COAP, params)
33 
34 /**
35  * struct wlan_coap_comp_priv - CoAP component private structure
36  * @req_id: cache get request id
37  * @cache_get_cbk: Callback function to be called with the cache get result
38  * @cache_get_context: context to be used by the caller to associate the get
39  * cache request with the response
40  */
41 struct wlan_coap_comp_priv {
42 	uint32_t req_id;
43 	coap_cache_get_callback cache_get_cbk;
44 	void *cache_get_context;
45 };
46 
47 static inline struct wlan_coap_comp_priv *
wlan_get_vdev_coap_obj(struct wlan_objmgr_vdev * vdev)48 wlan_get_vdev_coap_obj(struct wlan_objmgr_vdev *vdev)
49 {
50 	return wlan_objmgr_vdev_get_comp_private_obj(vdev,
51 						     WLAN_UMAC_COMP_COAP);
52 }
53 
54 /*
55  * wlan_coap_init() - CoAP module initialization API
56  *
57  * Return: QDF_STATUS
58  */
59 QDF_STATUS wlan_coap_init(void);
60 
61 /*
62  * wlan_coap_init() - CoAP module deinitialization API
63  *
64  * Return: QDF_STATUS
65  */
66 QDF_STATUS wlan_coap_deinit(void);
67 
68 /**
69  * wlan_coap_enable(): API to enable CoAP component
70  * @psoc: pointer to psoc
71  *
72  * This API is invoked from dispatcher psoc enable.
73  * This API will register CoAP related WMI event handlers.
74  *
75  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
76  */
77 QDF_STATUS wlan_coap_enable(struct wlan_objmgr_psoc *psoc);
78 
79 /**
80  * wlan_coap_disable(): API to disable CoAP component
81  * @psoc: pointer to psoc
82  *
83  * This API is invoked from dispatcher psoc disable.
84  * This API will unregister CoAP related WMI event handlers.
85  *
86  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
87  */
88 QDF_STATUS wlan_coap_disable(struct wlan_objmgr_psoc *psoc);
89 
90 /**
91  * wlan_coap_offload_reply_enable() - private API to enable CoAP offload reply
92  * @vdev: pointer to vdev object
93  * @param: parameters of CoAP offload reply
94  *
95  * Return: status of operation
96  */
97 QDF_STATUS
98 wlan_coap_offload_reply_enable(struct wlan_objmgr_vdev *vdev,
99 			       struct coap_offload_reply_param *param);
100 
101 /**
102  * wlan_coap_offload_reply_disable() - private API to disable CoAP offload reply
103  * @vdev: pointer to vdev object
104  * @req_id: request id
105  * @cbk: callback function to be called with the cache info
106  * @context: context to be used by the caller to associate the disable request
107  *
108  * Return: status of operation
109  */
110 QDF_STATUS
111 wlan_coap_offload_reply_disable(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
112 				coap_cache_get_callback cbk, void *context);
113 
114 /**
115  * wlan_coap_offload_periodic_tx_enable() - private API to enable CoAP offload
116  * periodic transmitting
117  * @vdev: pointer to vdev object
118  * @param: parameters of CoAP periodic transmit
119  *
120  * Return: status of operation
121  */
122 QDF_STATUS
123 wlan_coap_offload_periodic_tx_enable(struct wlan_objmgr_vdev *vdev,
124 			struct coap_offload_periodic_tx_param *param);
125 
126 /**
127  * wlan_coap_offload_periodic_tx_disable() - private API to disable CoAP
128  * offload periodic transmitting
129  * @vdev: pointer to vdev object
130  * @req_id: request id
131  *
132  * Return: status of operation
133  */
134 QDF_STATUS
135 wlan_coap_offload_periodic_tx_disable(struct wlan_objmgr_vdev *vdev,
136 				      uint32_t req_id);
137 
138 /**
139  * wlan_coap_offload_cache_get() - private API to get CoAP offload cache
140  * @vdev: pointer to vdev object
141  * @req_id: request id
142  * @cbk: callback function to be called with the cache get result
143  * @context: context to be used by the caller to associate the get
144  * cache request with the response
145  *
146  * Return: status of operation
147  */
148 QDF_STATUS
149 wlan_coap_offload_cache_get(struct wlan_objmgr_vdev *vdev, uint32_t req_id,
150 			    coap_cache_get_callback cbk, void *context);
151 #endif
152 #endif
153