FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:37:05 2017 +0000
Revision:
0:dbad57390bd1
Initial commit

Who changed what in which revision?

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