|
17 | 17 | #ifndef SN_CONFIG_H
|
18 | 18 | #define SN_CONFIG_H
|
19 | 19 |
|
| 20 | +#ifdef MBED_CLIENT_USER_CONFIG_FILE |
| 21 | +#include MBED_CLIENT_USER_CONFIG_FILE |
| 22 | +#endif |
| 23 | + |
20 | 24 | /**
|
21 | 25 | * \brief Configuration options (set of defines and values)
|
22 | 26 | *
|
|
30 | 34 | * \brief For Message duplication detection
|
31 | 35 | * Init value for the maximum count of messages to be stored for duplication detection
|
32 | 36 | * Setting of this value to 0 will disable duplication check, also reduce use of ROM memory
|
33 |
| - * Default is set to 1. |
| 37 | + * Default is set to 0. |
34 | 38 | */
|
35 |
| -#undef SN_COAP_DUPLICATION_MAX_MSGS_COUNT /* 1 */ |
| 39 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT |
| 40 | +#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT |
| 41 | +#endif |
| 42 | + |
| 43 | +#ifndef SN_COAP_DUPLICATION_MAX_MSGS_COUNT |
| 44 | +#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT 0 |
| 45 | +#endif |
36 | 46 |
|
37 | 47 | /**
|
38 | 48 | * \def SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
|
42 | 52 | * also reduce use of ROM memory.
|
43 | 53 | * Note: This define is common for both received and sent Blockwise messages
|
44 | 54 | */
|
45 |
| -#undef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* 0 */ // < Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 |
| 55 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE |
| 56 | +#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE |
| 57 | +#endif |
| 58 | + |
| 59 | +#ifndef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE |
| 60 | +#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */ |
| 61 | +#endif |
46 | 62 |
|
47 | 63 | /**
|
48 | 64 | * \def SN_COAP_DISABLE_RESENDINGS
|
49 | 65 | * \brief Disables resending feature. Resending feature should not be needed
|
50 | 66 | * when using CoAP with TCP transport for example. By default resendings are
|
51 | 67 | * enabled. Set to 1 to disable.
|
52 | 68 | */
|
53 |
| -#undef SN_COAP_DISABLE_RESENDINGS /* 0 */ // < Default re-sending are not disabled. Set to 1 to disable re-sendings |
| 69 | +#ifdef SN_COAP_DISABLE_RESENDINGS |
| 70 | +#define ENABLE_RESENDINGS 0 /** Disable resendings **/ |
| 71 | +#else |
| 72 | +#define ENABLE_RESENDINGS 1 /**< Enable / Disable resending from library in building */ |
| 73 | +#endif |
54 | 74 |
|
55 | 75 | /**
|
56 | 76 | * \def SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
57 | 77 | * \brief Sets the number of messages stored
|
58 | 78 | * in the resending queue. Default is 2
|
59 | 79 | */
|
60 |
| -#undef SN_COAP_RESENDING_QUEUE_SIZE_MSGS /* 2 */ // < Default re-sending queue size - defines how many messages can be stored. Setting this to 0 disables feature |
| 80 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS |
| 81 | +#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS |
| 82 | +#endif |
| 83 | + |
| 84 | +#ifndef SN_COAP_RESENDING_QUEUE_SIZE_MSGS |
| 85 | +#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS 2 /**< Default re-sending queue size - defines how many messages can be stored. Setting this to 0 disables feature */ |
| 86 | +#endif |
61 | 87 |
|
62 | 88 | /**
|
63 | 89 | * \def DEFAULT_RESPONSE_TIMEOUT
|
64 | 90 | * \brief Sets the CoAP re-send interval in seconds.
|
65 | 91 | * By default is 10 seconds.
|
66 | 92 | */
|
67 |
| -#undef DEFAULT_RESPONSE_TIMEOUT |
| 93 | +#ifndef DEFAULT_RESPONSE_TIMEOUT |
| 94 | +#define DEFAULT_RESPONSE_TIMEOUT 10 /**< Default re-sending timeout as seconds */ |
| 95 | +#endif |
68 | 96 |
|
69 | 97 | /**
|
70 | 98 | * \def SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
71 | 99 | * \brief Sets the size of the re-sending buffer.
|
72 | 100 | * Setting this to 0 disables this feature.
|
73 | 101 | * By default, this feature is disabled.
|
74 | 102 | */
|
75 |
| -#undef SN_COAP_RESENDING_QUEUE_SIZE_BYTES /* 0 */ // Default re-sending queue size - defines size of the re-sending buffer. Setting this to 0 disables feature |
| 103 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES |
| 104 | +#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES |
| 105 | +#endif |
| 106 | + |
| 107 | +#ifndef SN_COAP_RESENDING_QUEUE_SIZE_BYTES |
| 108 | +#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES 0 /**< Default re-sending queue size - defines size of the re-sending buffer. Setting this to 0 disables feature */ |
| 109 | +#endif |
76 | 110 |
|
77 | 111 | /**
|
78 | 112 | * \def SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
|
83 | 117 | * available storage capability.
|
84 | 118 | * By default, maximum size is UINT16_MAX, 65535 bytes.
|
85 | 119 | */
|
86 |
| -#undef SN_COAP_MAX_INCOMING_MESSAGE_SIZE /* UINT16_MAX */ |
| 120 | +#ifndef SN_COAP_MAX_INCOMING_MESSAGE_SIZE |
| 121 | +#define SN_COAP_MAX_INCOMING_MESSAGE_SIZE UINT16_MAX |
| 122 | +#endif |
87 | 123 |
|
88 | 124 | /**
|
89 | 125 | * \def SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
|
98 | 134 | * Note that value should be less than transport layer maximum fragment size.
|
99 | 135 | * Note that value has no effect if blockwise transfer is disabled.
|
100 | 136 | */
|
101 |
| -#undef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE /* 0 */ |
| 137 | +#ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE |
| 138 | +#define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE 0 |
| 139 | +#endif |
102 | 140 |
|
103 | 141 | /**
|
104 | 142 | * \def SN_COAP_BLOCKWISE_ENABLED
|
105 | 143 | * \brief Enables the blockwise functionality in CoAP library also when blockwise payload
|
106 | 144 | * size is set to '0' in SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE.
|
107 | 145 | */
|
108 |
| -#undef SN_COAP_BLOCKWISE_ENABLED /* 0 */ |
| 146 | +#ifndef SN_COAP_BLOCKWISE_ENABLED |
| 147 | +#define SN_COAP_BLOCKWISE_ENABLED 0 /**< Enable blockwise */ |
| 148 | +#endif |
109 | 149 |
|
110 | 150 | /**
|
111 | 151 | * \def SN_COAP_RESENDING_MAX_COUNT
|
112 | 152 | * \brief Defines how many times CoAP library tries to re-send the CoAP packet.
|
113 | 153 | * By default value is 3.
|
114 | 154 | */
|
115 |
| -#undef SN_COAP_RESENDING_MAX_COUNT /* 3 */ |
| 155 | +#ifndef SN_COAP_RESENDING_MAX_COUNT |
| 156 | +#define SN_COAP_RESENDING_MAX_COUNT 3 |
| 157 | +#endif |
116 | 158 |
|
117 | 159 | /**
|
118 | 160 | * \def SN_COAP_MAX_ALLOWED_RESENDING_COUNT
|
119 | 161 | * \brief Maximum allowed count of re-sending that can be set at runtime via
|
120 | 162 | * 'sn_coap_protocol_set_retransmission_parameters()' API.
|
121 | 163 | * By default value is 6.
|
122 | 164 | */
|
123 |
| -#undef SN_COAP_MAX_ALLOWED_RESENDING_COUNT /* 6 */ |
| 165 | +#ifndef SN_COAP_MAX_ALLOWED_RESENDING_COUNT |
| 166 | +#define SN_COAP_MAX_ALLOWED_RESENDING_COUNT 6 /**< Maximum allowed count of re-sending */ |
| 167 | +#endif |
124 | 168 |
|
125 | 169 | /**
|
126 | 170 | * \def SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT
|
127 | 171 | * \brief Maximum allowed re-send interval in seconds that can be set at runtime via
|
128 | 172 | * 'sn_coap_protocol_set_retransmission_parameters()' API.
|
129 | 173 | * By default value is 40.
|
130 | 174 | */
|
131 |
| -#undef SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT /* 40 */ |
| 175 | +#ifndef SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT |
| 176 | +#define SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT 40 /**< Maximum allowed re-sending timeout */ |
| 177 | +#endif |
132 | 178 |
|
133 | 179 | /**
|
134 | 180 | * \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS
|
135 | 181 | * \brief Maximum allowed count of messages that can be stored into resend buffer at runtime via
|
136 | 182 | * 'sn_coap_protocol_set_retransmission_buffer()' API.
|
137 | 183 | * By default value is 6.
|
138 | 184 | */
|
139 |
| -#undef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS /* 6 */ |
| 185 | +#ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS |
| 186 | +#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS 6 /**< Maximum allowed number of saved re-sending messages */ |
| 187 | +#endif |
140 | 188 |
|
141 | 189 | /**
|
142 | 190 | * \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES
|
143 | 191 | * \brief Maximum size of messages in bytes that can be stored into resend buffer at runtime via
|
144 | 192 | * 'sn_coap_protocol_set_retransmission_buffer()' API.
|
145 | 193 | * By default value is 512.
|
146 | 194 | */
|
147 |
| -#undef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES /* 512 */ |
| 195 | +#ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES |
| 196 | +#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES 512 /**< Maximum allowed size of re-sending buffer */ |
| 197 | +#endif |
148 | 198 |
|
149 | 199 | /**
|
150 | 200 | * \def SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
|
151 | 201 | * \brief Maximum allowed number of saved messages for message duplicate searching
|
152 | 202 | * that can be set via 'sn_coap_protocol_set_duplicate_buffer_size' API.
|
153 | 203 | * By default value is 6.
|
154 | 204 | */
|
155 |
| -#undef SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT |
| 205 | +#ifndef SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT |
| 206 | +#define SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT 6 |
| 207 | +#endif |
156 | 208 |
|
157 | 209 | /**
|
158 | 210 | * \def SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
|
159 | 211 | * \brief Maximum time in seconds howe long message is kept for duplicate detection.
|
160 | 212 | * By default 60 seconds.
|
161 | 213 | */
|
162 |
| -#undef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED |
| 214 | +#ifndef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED |
| 215 | +#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED 60 /** RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time **/ |
| 216 | +#endif |
163 | 217 |
|
164 | 218 | /**
|
165 | 219 | * \def SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
166 | 220 | * \brief Maximum time in seconds how long (messages and payload) are be stored for blockwising.
|
167 | 221 | * Longer time will increase the memory consumption in lossy networks.
|
168 | 222 | * By default 60 seconds.
|
169 | 223 | */
|
170 |
| -#undef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED |
| 224 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED |
| 225 | +#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED |
| 226 | +#endif |
| 227 | + |
| 228 | +#ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED |
| 229 | +#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */ |
| 230 | +#endif |
171 | 231 |
|
172 | 232 | /**
|
173 | 233 | * \def SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
174 | 234 | * \brief Maximum size of blockwise message that can be received.
|
175 | 235 | * By default 65535 bytes.
|
176 | 236 | */
|
177 |
| -#undef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE |
| 237 | +#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE |
| 238 | +#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE |
| 239 | +#endif |
178 | 240 |
|
179 |
| -#ifdef MBED_CLIENT_USER_CONFIG_FILE |
180 |
| -#include MBED_CLIENT_USER_CONFIG_FILE |
| 241 | +#ifndef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE |
| 242 | +#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE UINT16_MAX |
181 | 243 | #endif
|
182 | 244 |
|
183 | 245 | #endif // SN_CONFIG_H
|
0 commit comments