xref: /wlan-driver/qcacld-3.0/components/coap/dispatcher/inc/wlan_coap_public_structs.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 CoAP structure definitions
19  */
20 
21 #ifndef _WLAN_COAP_PUBLIC_STRUCTS_H_
22 #define _WLAN_COAP_PUBLIC_STRUCTS_H_
23 #include <qdf_types.h>
24 
25 /**
26  * struct coap_offload_reply_param - parameters to enable CoAP offload reply
27  * @vdev_id: vdev id
28  * @pattern_id: pattern id
29  * @cache_timeout: the cached packet expire timeout in ms
30  * @src_ip_v4: source IPv4 address for sending reply message
31  * @src_udp_port: source udp port for sending reply message
32  * @dest_ip_v4: destination IPv4 address to match received CoAP message
33  * @dest_ip_v4_is_bc: indicate whether the destination address is broadcast
34  * address or not
35  * @dest_udp_port: destination UDP port to match received CoAP message
36  * @verify_offset: UDP payload offset to match received CoAP message
37  * @verify_len: UDP payload length to match received CoAP message
38  * @verify: pointer to binary data to match received CoAP message
39  * @coapmsg_len: CoAP reply message length
40  * @coapmsg: pointer to CoAP reply message
41  */
42 struct coap_offload_reply_param {
43 	uint32_t vdev_id;
44 	uint32_t pattern_id;
45 	uint32_t cache_timeout;
46 	uint32_t src_ip_v4;
47 	uint16_t src_udp_port;
48 	uint32_t dest_ip_v4;
49 	bool dest_ip_v4_is_bc;
50 	uint16_t dest_udp_port;
51 	uint32_t verify_offset;
52 	uint32_t verify_len;
53 	uint8_t *verify;
54 	uint32_t coapmsg_len;
55 	uint8_t *coapmsg;
56 };
57 
58 /**
59  * struct coap_offload_periodic_tx_param - parameters to enable CoAP offload
60  * periodic transmitting
61  * @vdev_id: vdev id
62  * @pattern_id: pattern id
63  * @src_ip_v4: IPv4 address for sending CoAP message
64  * @src_udp_port: source udp port for sending CoAP message
65  * @dest_ip_v4: destination IPv4 address for sending CoAP message
66  * @dest_ip_v4_is_bc: indicate whether the destination address is broadcast
67  * address or not
68  * @dest_udp_port: destination UDP port for sending CoAP message
69  * @timeout: the periorid to send keepalive message in ms
70  * @coapmsg_len: keeplive CoAP message length
71  * @coapmsg: pointer to keeplive CoAP message
72  */
73 struct coap_offload_periodic_tx_param {
74 	uint32_t vdev_id;
75 	uint32_t pattern_id;
76 	uint32_t src_ip_v4;
77 	uint16_t src_udp_port;
78 	uint32_t dest_ip_v4;
79 	bool dest_ip_v4_is_bc;
80 	uint16_t dest_udp_port;
81 	uint32_t timeout;
82 	uint32_t coapmsg_len;
83 	uint8_t *coapmsg;
84 };
85 
86 /**
87  * struct coap_buf_node - CoAP message info entry
88  * @node: List entry element
89  * @tsf: TSF of the CoAP meesage
90  * @src_ip: source IPv4 address of the CoAP message
91  * @len: length of the payload
92  * @payload: pointer to buffer holding UDP payload of the CoAP message
93  */
94 struct coap_buf_node {
95 	qdf_list_node_t node;
96 	uint64_t tsf;
97 	uint32_t src_ip;
98 	uint32_t len;
99 	uint8_t *payload;
100 };
101 
102 /**
103  * struct coap_buf_info - info of the cached CoAP messages
104  * @vdev_id: vdev id
105  * @req_id: request id
106  * @more_info: flag to indicate whether there are more cached messages
107  * @info_list: list to hold cached CoAP messages
108  */
109 struct coap_buf_info {
110 	uint8_t vdev_id;
111 	uint32_t req_id;
112 	bool more_info;
113 	qdf_list_t info_list;
114 };
115 
116 /**
117  * typedef coap_cache_get_callback() - callback for getting cached CoAP messages
118  * @context: context for getting cached CoAP messages
119  * @info: pointer to info of the cached CoAP messages
120  */
121 typedef void (*coap_cache_get_callback)(void *context,
122 					struct coap_buf_info *info);
123 #endif
124