Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sn_config.h Source File

sn_config.h

00001 /*
00002  * Copyright (c) 2016 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef SN_CONFIG_H
00018 #define SN_CONFIG_H
00019 
00020 #ifdef MBED_CLIENT_USER_CONFIG_FILE
00021 #include MBED_CLIENT_USER_CONFIG_FILE
00022 #endif
00023 
00024 /**
00025 * \brief Configuration options (set of defines and values)
00026 *
00027 *  This lists set of compile-time options that needs to be used to enable
00028 *  or disable features selectively, and set the values for the mandatory
00029 *  parameters.
00030 */
00031 
00032 /**
00033  * \def SN_COAP_DUPLICATION_MAX_MSGS_COUNT
00034  * \brief For Message duplication detection
00035  * Init value for the maximum count of messages to be stored for duplication detection
00036  * Setting of this value to 0 will disable duplication check, also reduce use of ROM memory
00037  * Default is set to 0.
00038  */
00039 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
00040 #define SN_COAP_DUPLICATION_MAX_MSGS_COUNT MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
00041 #endif
00042 
00043 #ifndef SN_COAP_DUPLICATION_MAX_MSGS_COUNT
00044 #define SN_COAP_DUPLICATION_MAX_MSGS_COUNT              0
00045 #endif
00046 
00047 /**
00048  * \def SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
00049  * \brief For Message blockwising
00050  * Init value for the maximum payload size to be sent and received at one blockwise message
00051  * Setting of this value to 0 with SN_COAP_BLOCKWISE_ENABLED will disable this feature, and
00052  * also reduce use of ROM memory.
00053  * Note: This define is common for both received and sent Blockwise messages
00054  */
00055 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
00056 #define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
00057 #endif
00058 
00059 #ifndef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
00060 #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 */
00061 #endif
00062 
00063 /**
00064  * \def SN_COAP_DISABLE_RESENDINGS
00065  * \brief Disables resending feature. Resending feature should not be needed
00066  * when using CoAP with TCP transport for example. By default resendings are
00067  * enabled. Set to 1 to disable.
00068  */
00069 #ifdef SN_COAP_DISABLE_RESENDINGS
00070 #define ENABLE_RESENDINGS                               0   /** Disable resendings **/
00071 #else
00072 #define ENABLE_RESENDINGS                               1   /**< Enable / Disable resending from library in building */
00073 #endif
00074 
00075 /**
00076  * \def SN_COAP_RESENDING_QUEUE_SIZE_MSGS
00077  * \brief Sets the number of messages stored
00078  * in the resending queue. Default is 2
00079  */
00080 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
00081 #define SN_COAP_RESENDING_QUEUE_SIZE_MSGS MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
00082 #endif
00083 
00084 #ifndef SN_COAP_RESENDING_QUEUE_SIZE_MSGS
00085 #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 */
00086 #endif
00087 
00088 /**
00089  * \def DEFAULT_RESPONSE_TIMEOUT
00090  * \brief Sets the CoAP re-send interval in seconds.
00091  * By default is 10 seconds.
00092  */
00093 #ifndef DEFAULT_RESPONSE_TIMEOUT
00094 #define DEFAULT_RESPONSE_TIMEOUT                        10  /**< Default re-sending timeout as seconds */
00095 #endif
00096 
00097 /**
00098  * \def SN_COAP_RESENDING_QUEUE_SIZE_BYTES
00099  * \brief Sets the size of the re-sending buffer.
00100  * Setting this to 0 disables this feature.
00101  * By default, this feature is disabled.
00102  */
00103 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
00104 #define SN_COAP_RESENDING_QUEUE_SIZE_BYTES MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
00105 #endif
00106 
00107 #ifndef SN_COAP_RESENDING_QUEUE_SIZE_BYTES
00108 #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 */
00109 #endif
00110 
00111 /**
00112  * \def SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00113  * \brief Sets the maximum size (in bytes) that
00114  * mbed Client will allow to be handled while
00115  * receiving big payload in blockwise mode.
00116  * Application can set this value based on their
00117  * available storage capability.
00118  * By default, maximum size is UINT16_MAX, 65535 bytes.
00119  */
00120 #ifndef SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00121 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE               UINT16_MAX
00122 #endif
00123 
00124 /**
00125  * \def SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
00126  * \brief Sets the maximum payload size allowed before blockwising the message.
00127  * This option should only be used when using TCP and TLS as transport
00128  * with known maximum fragment size. This optimizes the number of messages
00129  * if it is possible to send larger than 1kB messages without blockwise transfer.
00130  * If payload length is larger than SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
00131  * it will be sent using blockwise transfer.
00132  * By default, this feature is disabled, 0 disables the feature, set to positive
00133  * value larger than SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE to enable.
00134  * Note that value should be less than transport layer maximum fragment size.
00135  * Note that value has no effect if blockwise transfer is disabled.
00136  */
00137 #ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
00138 #define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE           0
00139 #endif
00140 
00141 /**
00142  * \def SN_COAP_BLOCKWISE_ENABLED
00143  * \brief Enables the blockwise functionality in CoAP library also when blockwise payload
00144  * size is set to '0' in  SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE.
00145  */
00146 #ifndef SN_COAP_BLOCKWISE_ENABLED
00147 #define SN_COAP_BLOCKWISE_ENABLED                       0  /**< Enable blockwise */
00148 #endif
00149 
00150 /**
00151  * \def SN_COAP_RESENDING_MAX_COUNT
00152  * \brief Defines how many times CoAP library tries to re-send the CoAP packet.
00153  * By default value is 3.
00154  */
00155 #ifndef SN_COAP_RESENDING_MAX_COUNT
00156 #define SN_COAP_RESENDING_MAX_COUNT                     3
00157 #endif
00158 
00159 /**
00160  * \def SN_COAP_MAX_ALLOWED_RESENDING_COUNT
00161  * \brief Maximum allowed count of re-sending that can be set at runtime via
00162  * 'sn_coap_protocol_set_retransmission_parameters()' API.
00163  * By default value is 6.
00164  */
00165 #ifndef SN_COAP_MAX_ALLOWED_RESENDING_COUNT
00166 #define SN_COAP_MAX_ALLOWED_RESENDING_COUNT             6   /**< Maximum allowed count of re-sending */
00167 #endif
00168 
00169 /**
00170  * \def SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT
00171  * \brief Maximum allowed re-send interval in seconds that can be set at runtime via
00172  * 'sn_coap_protocol_set_retransmission_parameters()' API.
00173  * By default value is 40.
00174  */
00175 #ifndef SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT
00176 #define SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT            40  /**< Maximum allowed re-sending timeout */
00177 #endif
00178 
00179 /**
00180  * \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS
00181  * \brief Maximum allowed count of messages that can be stored into resend buffer at runtime via
00182  * 'sn_coap_protocol_set_retransmission_buffer()' API.
00183  * By default value is 6.
00184  */
00185 #ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS
00186 #define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS    6   /**< Maximum allowed number of saved re-sending messages */
00187 #endif
00188 
00189 /**
00190  * \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES
00191  * \brief Maximum size of messages in bytes that can be stored into resend buffer at runtime via
00192  * 'sn_coap_protocol_set_retransmission_buffer()' API.
00193  * By default value is 512.
00194  */
00195 #ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES
00196 #define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES   512 /**< Maximum allowed size of re-sending buffer */
00197 #endif
00198 
00199 /**
00200  * \def SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
00201  * \brief Maximum allowed number of saved messages for message duplicate searching
00202  * that can be set via 'sn_coap_protocol_set_duplicate_buffer_size' API.
00203  * By default value is 6.
00204  */
00205 #ifndef SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
00206 #define SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT   6
00207 #endif
00208 
00209 /**
00210  * \def SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
00211  * \brief Maximum time in seconds howe long message is kept for duplicate detection.
00212  * By default 60 seconds.
00213  */
00214 #ifndef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
00215 #define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED    60 /** RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time **/
00216 #endif
00217 
00218 /**
00219  * \def SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
00220  * \brief Maximum time in seconds how long (messages and payload) are be stored for blockwising.
00221  * Longer time will increase the memory consumption in lossy networks.
00222  * By default 60 seconds.
00223  */
00224 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
00225 #define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
00226 #endif
00227 
00228 #ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
00229 #define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED      60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
00230 #endif
00231 
00232 /**
00233  * \def SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
00234  * \brief Maximum size of blockwise message that can be received.
00235  * By default 65535 bytes.
00236  */
00237 #ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00238 #define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00239 #endif
00240 
00241 #ifndef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
00242 #define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE     UINT16_MAX
00243 #endif
00244 
00245 #endif // SN_CONFIG_H