xref: /CoreMQTT-Agent-v1.1.0/test/unit-test/config/core_mqtt_config.h (revision c76bf4a7fea24d4200a48aa22cf91767b59c7dae)
1 /*
2  * coreMQTT Agent v1.1.0
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /**
24  * @file core_mqtt_config.h
25  * @brief This represents the default values for the configuration macros
26  * for the MQTT library.
27  *
28  * @note This file SHOULD NOT be modified. If custom values are needed for
29  * any configuration macro, a core_mqtt_config.h file should be provided to
30  * the MQTT library to override the default values defined in this file.
31  * To use the custom config file, the MQTT_DO_NOT_USE_CUSTOM_CONFIG preprocessor
32  * macro SHOULD NOT be set.
33  */
34 
35 #ifndef CORE_MQTT_CONFIG_H_
36 #define CORE_MQTT_CONFIG_H_
37 
38 /* The macro definition for MQTT_DO_NOT_USE_CUSTOM_CONFIG is for Doxygen
39  * documentation only. */
40 
41 /**
42  * @brief Define this macro to build the MQTT library without the custom config
43  * file core_mqtt_config.h.
44  *
45  * Without the custom config, the MQTT library builds with
46  * default values of config macros defined in core_mqtt_config_defaults.h file.
47  *
48  * If a custom config is provided, then MQTT_DO_NOT_USE_CUSTOM_CONFIG should not
49  * be defined.
50  */
51 #ifdef DOXYGEN
52     #define MQTT_DO_NOT_USE_CUSTOM_CONFIG
53 #endif
54 
55 /**
56  * @brief Determines the maximum number of MQTT PUBLISH messages, pending
57  * acknowledgment at a time, that are supported for incoming and outgoing
58  * direction of messages, separately.
59  *
60  * QoS 1 and 2 MQTT PUBLISHes require acknowledgment from the server before
61  * they can be completed. While they are awaiting the acknowledgment, the
62  * client must maintain information about their state. The value of this
63  * macro sets the limit on how many simultaneous PUBLISH states an MQTT
64  * context maintains, separately, for both incoming and outgoing direction of
65  * PUBLISHes.
66  *
67  * @note The MQTT context maintains separate state records for outgoing
68  * and incoming PUBLISHes, and thus, 2 * MQTT_STATE_ARRAY_MAX_COUNT amount
69  * of memory is statically allocated for the state records.
70  *
71  * <b>Possible values:</b> Any positive 32 bit integer. <br>
72  * <b>Default value:</b> `10`
73  */
74 /* Default value for the maximum acknowledgment pending PUBLISH messages. */
75 #define MQTT_STATE_ARRAY_MAX_COUNT    ( 10U )
76 
77 
78 /**
79  * @brief The number of retries for receiving CONNACK.
80  *
81  * The MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT will be used only when the
82  * timeoutMs parameter of #MQTT_Connect is passed as 0 . The transport
83  * receive for CONNACK will be retried MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT
84  * times before timing out. A value of 0 for this config will cause the
85  * transport receive for CONNACK  to be invoked only once.
86  *
87  * <b>Possible values:</b> Any positive 16 bit integer. <br>
88  * <b>Default value:</b> `5`
89  */
90 
91 /* Default value for the CONNACK receive retries. */
92 #define MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT    ( 5U )
93 
94 
95 /**
96  * @brief Number of milliseconds to wait for a ping response to a ping
97  * request as part of the keep-alive mechanism.
98  *
99  * If a ping response is not received before this timeout, then
100  * #MQTT_ProcessLoop will return #MQTTKeepAliveTimeout.
101  *
102  * @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function,
103  * is supplied to the library, then the keep-alive mechanism is not supported by the
104  * #MQTT_ProcessLoop API function. In that case, the value of #MQTT_PINGRESP_TIMEOUT_MS
105  * is irrelevant to the behavior of the library.
106  *
107  * <b>Possible values:</b> Any positive integer up to SIZE_MAX. <br>
108  * <b>Default value:</b> `500`
109  */
110 
111 /* Wait 0.5 seconds by default for a ping response. */
112 #define MQTT_PINGRESP_TIMEOUT_MS    ( 500U )
113 
114 
115 /**
116  * @brief The maximum duration between non-empty network reads while
117  * receiving an MQTT packet via the #MQTT_ProcessLoop or #MQTT_ReceiveLoop
118  * API functions.
119  *
120  * When an incoming MQTT packet is detected, the transport receive function
121  * may be called multiple times until all of the expected number of bytes of the
122  * packet are received. This timeout represents the maximum polling duration that
123  * is allowed without any data reception from the network for the incoming packet.
124  *
125  * If the timeout expires, the #MQTT_ProcessLoop and #MQTT_ReceiveLoop functions
126  * return #MQTTRecvFailed.
127  *
128  * @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function,
129  * is supplied to the library, then #MQTT_RECV_POLLING_TIMEOUT_MS MUST be set to 0.
130  *
131  * <b>Possible values:</b> Any positive 32 bit integer. Recommended to use a
132  * small timeout value. <br>
133  * <b>Default value:</b> `10`
134  *
135  */
136 #define MQTT_RECV_POLLING_TIMEOUT_MS    ( 10U )
137 
138 
139 /**
140  * @brief The maximum duration between non-empty network transmissions while
141  * sending an MQTT packet via the #MQTT_ProcessLoop or #MQTT_ReceiveLoop
142  * API functions.
143  *
144  * When sending an MQTT packet, the transport send function may be called multiple
145  * times until all of the required number of bytes are sent.
146  * This timeout represents the maximum duration that is allowed for no data
147  * transmission over the network through the transport send function.
148  *
149  * If the timeout expires, the #MQTT_ProcessLoop and #MQTT_ReceiveLoop functions
150  * return #MQTTSendFailed.
151  *
152  * @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function,
153  * is supplied to the library, then #MQTT_SEND_RETRY_TIMEOUT_MS MUST be set to 0.
154  *
155  * <b>Possible values:</b> Any positive 32 bit integer. Recommended to use a small
156  * timeout value. <br>
157  * <b>Default value:</b> `10`
158  *
159  */
160 
161 #define MQTT_SEND_RETRY_TIMEOUT_MS    ( 10U )
162 
163 
164 /**
165  * @brief Macro that is called in the MQTT library for logging "Error" level
166  * messages.
167  *
168  * To enable error level logging in the MQTT library, this macro should be mapped to the
169  * application-specific logging implementation that supports error logging.
170  *
171  * @note This logging macro is called in the MQTT library with parameters wrapped in
172  * double parentheses to be ISO C89/C90 standard compliant. For a reference
173  * POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
174  * logging-stack in demos folder of the
175  * [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C).
176  *
177  * <b>Default value</b>: Error logging is turned off, and no code is generated for calls
178  * to the macro in the MQTT library on compilation.
179  */
180 #define LogError( message )
181 
182 
183 /**
184  * @brief Macro that is called in the MQTT library for logging "Warning" level
185  * messages.
186  *
187  * To enable warning level logging in the MQTT library, this macro should be mapped to the
188  * application-specific logging implementation that supports warning logging.
189  *
190  * @note This logging macro is called in the MQTT library with parameters wrapped in
191  * double parentheses to be ISO C89/C90 standard compliant. For a reference
192  * POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
193  * logging-stack in demos folder of the
194  * [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
195  *
196  * <b>Default value</b>: Warning logs are turned off, and no code is generated for calls
197  * to the macro in the MQTT library on compilation.
198  */
199 #define LogWarn( message )
200 
201 
202 /**
203  * @brief Macro that is called in the MQTT library for logging "Info" level
204  * messages.
205  *
206  * To enable info level logging in the MQTT library, this macro should be mapped to the
207  * application-specific logging implementation that supports info logging.
208  *
209  * @note This logging macro is called in the MQTT library with parameters wrapped in
210  * double parentheses to be ISO C89/C90 standard compliant. For a reference
211  * POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
212  * logging-stack in demos folder of the
213  * [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
214  *
215  * <b>Default value</b>: Info logging is turned off, and no code is generated for calls
216  * to the macro in the MQTT library on compilation.
217  */
218 #define LogInfo( message )
219 
220 /**
221  * @brief Macro that is called in the MQTT library for logging "Debug" level
222  * messages.
223  *
224  * To enable debug level logging from MQTT library, this macro should be mapped to the
225  * application-specific logging implementation that supports debug logging.
226  *
227  * @note This logging macro is called in the MQTT library with parameters wrapped in
228  * double parentheses to be ISO C89/C90 standard compliant. For a reference
229  * POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
230  * logging-stack in demos folder of the
231  * [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
232  *
233  * <b>Default value</b>: Debug logging is turned off, and no code is generated for calls
234  * to the macro in the MQTT library on compilation.
235  */
236 
237 #define LogDebug( message )
238 
239 
240 #endif /* ifndef CORE_MQTT_CONFIG_DEFAULTS_H_ */
241