Donald Meyers / Mbed OS evan
Committer:
djmeyers
Date:
Sat Mar 18 22:37:16 2017 +0000
Revision:
0:06ee5f8a484a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
djmeyers 0:06ee5f8a484a 1 /*
djmeyers 0:06ee5f8a484a 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
djmeyers 0:06ee5f8a484a 3 * SPDX-License-Identifier: Apache-2.0
djmeyers 0:06ee5f8a484a 4 * Licensed under the Apache License, Version 2.0 (the License); you may
djmeyers 0:06ee5f8a484a 5 * not use this file except in compliance with the License.
djmeyers 0:06ee5f8a484a 6 * You may obtain a copy of the License at
djmeyers 0:06ee5f8a484a 7 *
djmeyers 0:06ee5f8a484a 8 * http://www.apache.org/licenses/LICENSE-2.0
djmeyers 0:06ee5f8a484a 9 *
djmeyers 0:06ee5f8a484a 10 * Unless required by applicable law or agreed to in writing, software
djmeyers 0:06ee5f8a484a 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
djmeyers 0:06ee5f8a484a 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
djmeyers 0:06ee5f8a484a 13 * See the License for the specific language governing permissions and
djmeyers 0:06ee5f8a484a 14 * limitations under the License.
djmeyers 0:06ee5f8a484a 15 */
djmeyers 0:06ee5f8a484a 16 #ifndef M2MCONFIG_H
djmeyers 0:06ee5f8a484a 17 #define M2MCONFIG_H
djmeyers 0:06ee5f8a484a 18
djmeyers 0:06ee5f8a484a 19 /*! \file m2mconfig.h
djmeyers 0:06ee5f8a484a 20 * \brief File defining all system build time configuration used by mbed-client.
djmeyers 0:06ee5f8a484a 21 */
djmeyers 0:06ee5f8a484a 22
djmeyers 0:06ee5f8a484a 23 #include "mbed-client/m2mstring.h"
djmeyers 0:06ee5f8a484a 24
djmeyers 0:06ee5f8a484a 25 #include <stddef.h>
djmeyers 0:06ee5f8a484a 26
djmeyers 0:06ee5f8a484a 27 using namespace m2m;
djmeyers 0:06ee5f8a484a 28
djmeyers 0:06ee5f8a484a 29 /**
djmeyers 0:06ee5f8a484a 30 * \def MBED_CLIENT_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 31 *
djmeyers 0:06ee5f8a484a 32 * \brief Sets Reconnection count for mbed Client
djmeyers 0:06ee5f8a484a 33 * to attempt a reconnection re-tries until
djmeyers 0:06ee5f8a484a 34 * reaches the defined value either by the application
djmeyers 0:06ee5f8a484a 35 * or the default value set in Client.
djmeyers 0:06ee5f8a484a 36 * By default, the value is 3.
djmeyers 0:06ee5f8a484a 37 */
djmeyers 0:06ee5f8a484a 38 #undef MBED_CLIENT_RECONNECTION_COUNT /* 3 */
djmeyers 0:06ee5f8a484a 39
djmeyers 0:06ee5f8a484a 40 /**
djmeyers 0:06ee5f8a484a 41 * \def MBED_CLIENT_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 42 *
djmeyers 0:06ee5f8a484a 43 * \brief Sets Reconnection interval (in seconds) for
djmeyers 0:06ee5f8a484a 44 * mbed Client to attempt a reconnection re-tries.
djmeyers 0:06ee5f8a484a 45 * By default, the value is 5 seconds.
djmeyers 0:06ee5f8a484a 46 */
djmeyers 0:06ee5f8a484a 47 #undef MBED_CLIENT_RECONNECTION_INTERVAL /* 5 */
djmeyers 0:06ee5f8a484a 48
djmeyers 0:06ee5f8a484a 49 /**
djmeyers 0:06ee5f8a484a 50 * \def MBED_CLIENT_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 51 *
djmeyers 0:06ee5f8a484a 52 * \brief Keep alive time (in seconds) to send pings
djmeyers 0:06ee5f8a484a 53 * in case mbed Client is connected through TCP.
djmeyers 0:06ee5f8a484a 54 * By default, the value is 300 seconds.
djmeyers 0:06ee5f8a484a 55 */
djmeyers 0:06ee5f8a484a 56 #undef MBED_CLIENT_TCP_KEEPALIVE_TIME /* 300 */
djmeyers 0:06ee5f8a484a 57
djmeyers 0:06ee5f8a484a 58 /**
djmeyers 0:06ee5f8a484a 59 * \def MBED_CLIENT_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 60 *
djmeyers 0:06ee5f8a484a 61 * \brief Option whether to continue reconnection
djmeyers 0:06ee5f8a484a 62 * loop until connection is re-established or stop
djmeyers 0:06ee5f8a484a 63 * once the maximum re-try count is reached
djmeyers 0:06ee5f8a484a 64 * By default, the value is 1 to continue reconnection
djmeyers 0:06ee5f8a484a 65 * in loop, to stop the reconnection loop set value to 0.
djmeyers 0:06ee5f8a484a 66 */
djmeyers 0:06ee5f8a484a 67 #undef MBED_CLIENT_RECONNECTION_LOOP /* 1 */
djmeyers 0:06ee5f8a484a 68
djmeyers 0:06ee5f8a484a 69 /**
djmeyers 0:06ee5f8a484a 70 * \def MBED_CLIENT_EVENT_LOOP_SIZE
djmeyers 0:06ee5f8a484a 71 *
djmeyers 0:06ee5f8a484a 72 * \brief Defines the size of memory allocated for
djmeyers 0:06ee5f8a484a 73 * event loop (in bytes) for timer and network event
djmeyers 0:06ee5f8a484a 74 * handling of mbed Client.
djmeyers 0:06ee5f8a484a 75 * By default, this value is 1024 bytes.This memory is
djmeyers 0:06ee5f8a484a 76 * allocated from heap
djmeyers 0:06ee5f8a484a 77 */
djmeyers 0:06ee5f8a484a 78 #undef MBED_CLIENT_EVENT_LOOP_SIZE /* 1024 */
djmeyers 0:06ee5f8a484a 79
djmeyers 0:06ee5f8a484a 80 #ifdef YOTTA_CFG_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 81 #define MBED_CLIENT_RECONNECTION_COUNT YOTTA_CFG_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 82 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 83 #define MBED_CLIENT_RECONNECTION_COUNT MBED_CONF_MBED_CLIENT_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 84 #endif
djmeyers 0:06ee5f8a484a 85
djmeyers 0:06ee5f8a484a 86 #ifdef YOTTA_CFG_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 87 #define MBED_CLIENT_RECONNECTION_INTERVAL YOTTA_CFG_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 88 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 89 #define MBED_CLIENT_RECONNECTION_INTERVAL MBED_CONF_MBED_CLIENT_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 90 #endif
djmeyers 0:06ee5f8a484a 91
djmeyers 0:06ee5f8a484a 92 #ifdef YOTTA_CFG_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 93 #define MBED_CLIENT_TCP_KEEPALIVE_TIME YOTTA_CFG_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 94 #elif defined MBED_CONF_MBED_CLIENT_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 95 #define MBED_CLIENT_TCP_KEEPALIVE_TIME MBED_CONF_MBED_CLIENT_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 96 #endif
djmeyers 0:06ee5f8a484a 97
djmeyers 0:06ee5f8a484a 98 #ifdef YOTTA_CFG_DISABLE_BOOTSTRAP_FEATURE
djmeyers 0:06ee5f8a484a 99 #define MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE YOTTA_CFG_DISABLE_BOOTSTRAP_FEATURE
djmeyers 0:06ee5f8a484a 100 #elif defined MBED_CONF_MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE
djmeyers 0:06ee5f8a484a 101 #define MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE MBED_CONF_MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE
djmeyers 0:06ee5f8a484a 102 #endif
djmeyers 0:06ee5f8a484a 103
djmeyers 0:06ee5f8a484a 104 #ifdef YOTTA_CFG_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 105 #define MBED_CLIENT_RECONNECTION_LOOP YOTTA_CFG_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 106 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 107 #define MBED_CLIENT_RECONNECTION_LOOP MBED_CONF_MBED_CLIENT_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 108 #endif
djmeyers 0:06ee5f8a484a 109
djmeyers 0:06ee5f8a484a 110 #ifdef YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
djmeyers 0:06ee5f8a484a 111 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
djmeyers 0:06ee5f8a484a 112 #elif defined MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
djmeyers 0:06ee5f8a484a 113 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
djmeyers 0:06ee5f8a484a 114 #endif
djmeyers 0:06ee5f8a484a 115
djmeyers 0:06ee5f8a484a 116 #ifdef MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
djmeyers 0:06ee5f8a484a 117 #define MBED_CLIENT_EVENT_LOOP_SIZE MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
djmeyers 0:06ee5f8a484a 118 #endif
djmeyers 0:06ee5f8a484a 119
djmeyers 0:06ee5f8a484a 120 #if defined (__ICCARM__)
djmeyers 0:06ee5f8a484a 121 #define m2m_deprecated
djmeyers 0:06ee5f8a484a 122 #else
djmeyers 0:06ee5f8a484a 123 #define m2m_deprecated __attribute__ ((deprecated))
djmeyers 0:06ee5f8a484a 124 #endif
djmeyers 0:06ee5f8a484a 125
djmeyers 0:06ee5f8a484a 126 // This is valid for mbed-client-mbedtls
djmeyers 0:06ee5f8a484a 127 // For other SSL implementation there
djmeyers 0:06ee5f8a484a 128 // can be other
djmeyers 0:06ee5f8a484a 129
djmeyers 0:06ee5f8a484a 130 /*
djmeyers 0:06ee5f8a484a 131 *\brief A callback function for a random number
djmeyers 0:06ee5f8a484a 132 * required by the mbed-client-mbedtls module.
djmeyers 0:06ee5f8a484a 133 */
djmeyers 0:06ee5f8a484a 134 typedef uint32_t (*random_number_cb)(void) ;
djmeyers 0:06ee5f8a484a 135
djmeyers 0:06ee5f8a484a 136 /*
djmeyers 0:06ee5f8a484a 137 *\brief An entropy structure for an mbedtls entropy source.
djmeyers 0:06ee5f8a484a 138 * \param entropy_source_ptr The entropy function.
djmeyers 0:06ee5f8a484a 139 * \param p_source The function data.
djmeyers 0:06ee5f8a484a 140 * \param threshold A minimum required from the source before entropy is released
djmeyers 0:06ee5f8a484a 141 * (with mbedtls_entropy_func()) (in bytes).
djmeyers 0:06ee5f8a484a 142 * \param strong MBEDTLS_ENTROPY_SOURCE_STRONG = 1 or
djmeyers 0:06ee5f8a484a 143 * MBEDTSL_ENTROPY_SOURCE_WEAK = 0.
djmeyers 0:06ee5f8a484a 144 * At least one strong source needs to be added.
djmeyers 0:06ee5f8a484a 145 * Weaker sources (such as the cycle counter) can be used as
djmeyers 0:06ee5f8a484a 146 * a complement.
djmeyers 0:06ee5f8a484a 147 */
djmeyers 0:06ee5f8a484a 148 typedef struct mbedtls_entropy {
djmeyers 0:06ee5f8a484a 149 int (*entropy_source_ptr)(void *, unsigned char *,size_t , size_t *);
djmeyers 0:06ee5f8a484a 150 void *p_source;
djmeyers 0:06ee5f8a484a 151 size_t threshold;
djmeyers 0:06ee5f8a484a 152 int strong;
djmeyers 0:06ee5f8a484a 153 }entropy_cb;
djmeyers 0:06ee5f8a484a 154
djmeyers 0:06ee5f8a484a 155 #ifdef MBED_CLIENT_USER_CONFIG_FILE
djmeyers 0:06ee5f8a484a 156 #include MBED_CLIENT_USER_CONFIG_FILE
djmeyers 0:06ee5f8a484a 157 #endif
djmeyers 0:06ee5f8a484a 158
djmeyers 0:06ee5f8a484a 159 #ifndef MBED_CLIENT_RECONNECTION_COUNT
djmeyers 0:06ee5f8a484a 160 #define MBED_CLIENT_RECONNECTION_COUNT 3
djmeyers 0:06ee5f8a484a 161 #endif
djmeyers 0:06ee5f8a484a 162
djmeyers 0:06ee5f8a484a 163 #ifndef MBED_CLIENT_RECONNECTION_INTERVAL
djmeyers 0:06ee5f8a484a 164 #define MBED_CLIENT_RECONNECTION_INTERVAL 5
djmeyers 0:06ee5f8a484a 165 #endif
djmeyers 0:06ee5f8a484a 166
djmeyers 0:06ee5f8a484a 167 #ifndef MBED_CLIENT_TCP_KEEPALIVE_TIME
djmeyers 0:06ee5f8a484a 168 #define MBED_CLIENT_TCP_KEEPALIVE_TIME 300
djmeyers 0:06ee5f8a484a 169 #endif
djmeyers 0:06ee5f8a484a 170
djmeyers 0:06ee5f8a484a 171 #ifndef MBED_CLIENT_RECONNECTION_LOOP
djmeyers 0:06ee5f8a484a 172 #define MBED_CLIENT_RECONNECTION_LOOP 1
djmeyers 0:06ee5f8a484a 173 #endif
djmeyers 0:06ee5f8a484a 174
djmeyers 0:06ee5f8a484a 175 #ifndef MBED_CLIENT_EVENT_LOOP_SIZE
djmeyers 0:06ee5f8a484a 176 #define MBED_CLIENT_EVENT_LOOP_SIZE 1024
djmeyers 0:06ee5f8a484a 177 #endif
djmeyers 0:06ee5f8a484a 178
djmeyers 0:06ee5f8a484a 179 #ifndef SN_COAP_MAX_INCOMING_MESSAGE_SIZE
djmeyers 0:06ee5f8a484a 180 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE UINT16_MAX
djmeyers 0:06ee5f8a484a 181 #endif
djmeyers 0:06ee5f8a484a 182
djmeyers 0:06ee5f8a484a 183 #endif // M2MCONFIG_H