commit | author | age
|
d6b4a7
|
1 |
/* |
G |
2 |
* coreMQTT v2.1.1 |
|
3 |
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
|
4 |
* |
|
5 |
* SPDX-License-Identifier: MIT |
|
6 |
* |
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy of |
|
8 |
* this software and associated documentation files (the "Software"), to deal in |
|
9 |
* the Software without restriction, including without limitation the rights to |
|
10 |
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
|
11 |
* the Software, and to permit persons to whom the Software is furnished to do so, |
|
12 |
* subject to the following conditions: |
|
13 |
* |
|
14 |
* The above copyright notice and this permission notice shall be included in all |
|
15 |
* copies or substantial portions of the Software. |
|
16 |
* |
|
17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
19 |
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
20 |
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
21 |
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
22 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
23 |
*/ |
|
24 |
|
|
25 |
/** |
|
26 |
* @file core_mqtt_config_defaults.h |
|
27 |
* @brief This represents the default values for the configuration macros |
|
28 |
* for the MQTT library. |
|
29 |
* |
|
30 |
* @note This file SHOULD NOT be modified. If custom values are needed for |
|
31 |
* any configuration macro, a core_mqtt_config.h file should be provided to |
|
32 |
* the MQTT library to override the default values defined in this file. |
|
33 |
* To use the custom config file, the MQTT_DO_NOT_USE_CUSTOM_CONFIG preprocessor |
|
34 |
* macro SHOULD NOT be set. |
|
35 |
*/ |
|
36 |
|
|
37 |
#ifndef CORE_MQTT_CONFIG_DEFAULTS_H_ |
|
38 |
#define CORE_MQTT_CONFIG_DEFAULTS_H_ |
|
39 |
|
|
40 |
/* *INDENT-OFF* */ |
|
41 |
#ifdef __cplusplus |
|
42 |
extern "C" { |
|
43 |
#endif |
|
44 |
/* *INDENT-ON* */ |
|
45 |
|
|
46 |
/* MQTT_DO_NOT_USE_CUSTOM_CONFIG allows building the MQTT library |
|
47 |
* without a custom config. If a custom config is provided, the |
|
48 |
* MQTT_DO_NOT_USE_CUSTOM_CONFIG macro should not be defined. */ |
|
49 |
#ifndef MQTT_DO_NOT_USE_CUSTOM_CONFIG |
|
50 |
/* Include custom config file before other headers. */ |
|
51 |
#include "core_mqtt_config.h" |
|
52 |
#endif |
|
53 |
|
|
54 |
/* The macro definition for MQTT_DO_NOT_USE_CUSTOM_CONFIG is for Doxygen |
|
55 |
* documentation only. */ |
|
56 |
|
|
57 |
/** |
|
58 |
* @brief Define this macro to build the MQTT library without the custom config |
|
59 |
* file core_mqtt_config.h. |
|
60 |
* |
|
61 |
* Without the custom config, the MQTT library builds with |
|
62 |
* default values of config macros defined in core_mqtt_config_defaults.h file. |
|
63 |
* |
|
64 |
* If a custom config is provided, then MQTT_DO_NOT_USE_CUSTOM_CONFIG should not |
|
65 |
* be defined. |
|
66 |
*/ |
|
67 |
#ifdef DOXYGEN |
|
68 |
#define MQTT_DO_NOT_USE_CUSTOM_CONFIG |
|
69 |
#endif |
|
70 |
|
|
71 |
/** |
|
72 |
* @ingroup mqtt_constants |
|
73 |
* @brief Maximum number of vectors in subscribe and unsubscribe packet. |
|
74 |
*/ |
|
75 |
#ifndef MQTT_SUB_UNSUB_MAX_VECTORS |
|
76 |
#define MQTT_SUB_UNSUB_MAX_VECTORS ( 4U ) |
|
77 |
#endif |
|
78 |
|
|
79 |
/** |
|
80 |
* @brief The number of retries for receiving CONNACK. |
|
81 |
* |
|
82 |
* The MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT will be used only when the |
|
83 |
* timeoutMs parameter of #MQTT_Connect is passed as 0 . The transport |
|
84 |
* receive for CONNACK will be retried MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT |
|
85 |
* times before timing out. A value of 0 for this config will cause the |
|
86 |
* transport receive for CONNACK to be invoked only once. |
|
87 |
* |
|
88 |
* <b>Possible values:</b> Any positive 16 bit integer. <br> |
|
89 |
* <b>Default value:</b> `5` |
|
90 |
*/ |
|
91 |
#ifndef MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT |
|
92 |
/* Default value for the CONNACK receive retries. */ |
|
93 |
#define MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT ( 5U ) |
|
94 |
#endif |
|
95 |
|
|
96 |
/** |
|
97 |
* @brief Maximum number of milliseconds to wait for a ping response to a ping |
|
98 |
* request as part of the keep-alive mechanism. |
|
99 |
* |
|
100 |
* If a ping response is not received before this timeout, then |
|
101 |
* #MQTT_ProcessLoop will return #MQTTKeepAliveTimeout. |
|
102 |
* |
|
103 |
* @note If this value is more than half of the keep alive interval, and the |
|
104 |
* server does not receive the previous ping request, then it is likely that the |
|
105 |
* server will disconnect the client before #MQTTKeepAliveTimeout can be returned. |
|
106 |
* |
|
107 |
* @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function, |
|
108 |
* is supplied to the library, then the keep-alive mechanism is not supported by the |
|
109 |
* #MQTT_ProcessLoop API function. In that case, the value of #MQTT_PINGRESP_TIMEOUT_MS |
|
110 |
* is irrelevant to the behavior of the library. |
|
111 |
* |
|
112 |
* <b>Possible values:</b> Any positive integer up to SIZE_MAX. <br> |
|
113 |
* <b>Default value:</b> `5000` |
|
114 |
*/ |
|
115 |
#ifndef MQTT_PINGRESP_TIMEOUT_MS |
|
116 |
/* Wait 5 seconds by default for a ping response. */ |
|
117 |
#define MQTT_PINGRESP_TIMEOUT_MS ( 5000U ) |
|
118 |
#endif |
|
119 |
|
|
120 |
/** |
|
121 |
* @brief Maximum number of milliseconds of TX inactivity to wait |
|
122 |
* before initiating a PINGREQ |
|
123 |
* |
|
124 |
* @note If this value is less than the keep alive interval than |
|
125 |
* it will be used instead. |
|
126 |
* |
|
127 |
* <b>Possible values:</b> Any positive integer up to SIZE_MAX. <br> |
|
128 |
* <b>Default value:</b> '30000' |
|
129 |
*/ |
|
130 |
#ifndef PACKET_TX_TIMEOUT_MS |
|
131 |
#define PACKET_TX_TIMEOUT_MS ( 30000U ) |
|
132 |
#endif |
|
133 |
|
|
134 |
/** |
|
135 |
* @brief Maximum number of milliseconds of RX inactivity to wait |
|
136 |
* before initiating a PINGREQ |
|
137 |
* |
|
138 |
* <b>Possible values:</b> Any positive integer up to SIZE_MAX. <br> |
|
139 |
* <b>Default value:</b> '30000' |
|
140 |
* |
|
141 |
*/ |
|
142 |
#ifndef PACKET_RX_TIMEOUT_MS |
|
143 |
#define PACKET_RX_TIMEOUT_MS ( 30000U ) |
|
144 |
#endif |
|
145 |
|
|
146 |
/** |
|
147 |
* @brief The maximum duration between non-empty network reads while |
|
148 |
* receiving an MQTT packet via the #MQTT_ProcessLoop or #MQTT_ReceiveLoop |
|
149 |
* API functions. |
|
150 |
* |
|
151 |
* When an incoming MQTT packet is detected, the transport receive function |
|
152 |
* may be called multiple times until all of the expected number of bytes of the |
|
153 |
* packet are received. This timeout represents the maximum polling duration that |
|
154 |
* is allowed without any data reception from the network for the incoming packet. |
|
155 |
* |
|
156 |
* If the timeout expires, the #MQTT_ProcessLoop and #MQTT_ReceiveLoop functions |
|
157 |
* return #MQTTRecvFailed. |
|
158 |
* |
|
159 |
* @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function, |
|
160 |
* is supplied to the library, then #MQTT_RECV_POLLING_TIMEOUT_MS MUST be set to 0. |
|
161 |
* |
|
162 |
* <b>Possible values:</b> Any positive 32 bit integer. Recommended to use a |
|
163 |
* small timeout value. <br> |
|
164 |
* <b>Default value:</b> `10` |
|
165 |
* |
|
166 |
*/ |
|
167 |
#ifndef MQTT_RECV_POLLING_TIMEOUT_MS |
|
168 |
#define MQTT_RECV_POLLING_TIMEOUT_MS ( 10U ) |
|
169 |
#endif |
|
170 |
|
|
171 |
/** |
|
172 |
* @brief The maximum duration allowed to send an MQTT packet over the transport |
|
173 |
* interface. |
|
174 |
* |
|
175 |
* When sending an MQTT packet, the transport send or writev functions may be |
|
176 |
* called multiple times until all of the required number of bytes are sent. |
|
177 |
* This timeout represents the maximum duration that is allowed to send the MQTT |
|
178 |
* packet while calling the transport send or writev functions. |
|
179 |
* |
|
180 |
* If the timeout expires, #MQTTSendFailed will be returned by the public API |
|
181 |
* functions. |
|
182 |
* |
|
183 |
* @note If a dummy implementation of the #MQTTGetCurrentTimeFunc_t timer function, |
|
184 |
* is supplied to the library, then #MQTT_SEND_TIMEOUT_MS MUST be set to 0. |
|
185 |
* |
|
186 |
* <b>Possible values:</b> Any positive 32 bit integer. <br> |
|
187 |
* <b>Default value:</b> `20000` |
|
188 |
* |
|
189 |
*/ |
|
190 |
#ifndef MQTT_SEND_TIMEOUT_MS |
|
191 |
#define MQTT_SEND_TIMEOUT_MS ( 20000U ) |
|
192 |
#endif |
|
193 |
|
|
194 |
#ifdef MQTT_SEND_RETRY_TIMEOUT_MS |
|
195 |
#error MQTT_SEND_RETRY_TIMEOUT_MS is deprecated. Instead use MQTT_SEND_TIMEOUT_MS. |
|
196 |
#endif |
|
197 |
|
|
198 |
/* *INDENT-OFF* */ |
|
199 |
#ifdef __cplusplus |
|
200 |
} |
|
201 |
#endif |
|
202 |
/* *INDENT-ON* */ |
|
203 |
|
|
204 |
#endif /* ifndef CORE_MQTT_CONFIG_DEFAULTS_H_ */ |