2 * Amazon FreeRTOS Platform V1.0.0
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://aws.amazon.com/freertos
\r
23 * http://www.FreeRTOS.org
\r
27 * @file iot_platform_types.h
\r
28 * @brief Types of the platform layer.
\r
31 #ifndef IOT_PLATFORM_TYPES_H_
\r
32 #define IOT_PLATFORM_TYPES_H_
\r
34 /* The config header is always included first. */
\r
35 #include "iot_config.h"
\r
37 /* Linear containers (lists and queues) include for metrics types. */
\r
38 #include "iot_linear_containers.h"
\r
40 /*------------------------- Thread management types -------------------------*/
\r
43 * @brief A value representing the system default for new thread priority.
\r
45 #ifndef IOT_THREAD_DEFAULT_PRIORITY
\r
46 #define IOT_THREAD_DEFAULT_PRIORITY 0
\r
50 * @brief A value representhing the system default for new thread stack size.
\r
52 #ifndef IOT_THREAD_DEFAULT_STACK_SIZE
\r
53 #define IOT_THREAD_DEFAULT_STACK_SIZE 0
\r
57 * @ingroup platform_datatypes_handles
\r
58 * @brief The type used to represent mutexes, configured with the type
\r
59 * `_IotSystemMutex_t`.
\r
61 * <span style="color:red;font-weight:bold">
\r
62 * `_IotSystemMutex_t` will be automatically configured during build and generally
\r
63 * does not need to be defined.
\r
66 * Mutexes should only be released by the threads that take them.
\r
68 * <b>Example</b> <br>
\r
69 * To change the type of #IotMutex_t to `long`:
\r
71 * typedef long _IotSystemMutex_t;
\r
72 * #include "iot_threads.h"
\r
75 typedef _IotSystemMutex_t IotMutex_t;
\r
78 * @ingroup platform_datatypes_handles
\r
79 * @brief The type used to represent semaphores, configured with the type
\r
80 * `_IotSystemSemaphore_t`.
\r
82 * <span style="color:red;font-weight:bold">
\r
83 * `_IotSystemSemaphore_t` will be automatically configured during build and
\r
84 * generally does not need to be defined.
\r
87 * Semaphores must be counting, and any thread may take (wait on) or release
\r
88 * (post to) a semaphore.
\r
90 * <b>Example</b> <br>
\r
91 * To change the type of #IotSemaphore_t to `long`:
\r
93 * typedef long _IotSystemSemaphore_t;
\r
94 * #include "iot_threads.h"
\r
97 typedef _IotSystemSemaphore_t IotSemaphore_t;
\r
100 * @brief Thread routine function.
\r
102 * @param[in] void * The argument passed to the @ref
\r
103 * platform_threads_function_createdetachedthread. For application use.
\r
105 typedef void ( * IotThreadRoutine_t )( void * );
\r
107 /*-------------------------- Clock and timer types --------------------------*/
\r
110 * @ingroup platform_datatypes_handles
\r
111 * @brief The type used to represent timers, configured with the type
\r
112 * `_IotSystemTimer_t`.
\r
114 * <span style="color:red;font-weight:bold">
\r
115 * `_IotSystemTimer_t` will be automatically configured during build and generally
\r
116 * does not need to be defined.
\r
119 * <b>Example</b> <br>
\r
120 * To change the type of #IotTimer_t to `long`:
\r
122 * typedef long _IotSystemTimer_t;
\r
123 * #include "iot_clock.h"
\r
126 typedef _IotSystemTimer_t IotTimer_t;
\r
128 /*------------------------------ Metrics types ------------------------------*/
\r
131 * @brief The length of the buffer used to store IP addresses for metrics.
\r
133 * This is the length of the longest IPv6 address plus space for the port number
\r
134 * and NULL terminator.
\r
136 #define IOT_METRICS_IP_ADDRESS_LENGTH 54
\r
139 * @brief Represents a TCP connection to a remote IPv4 server.
\r
141 * A list of these is provided by @ref platform_metrics_function_gettcpconnections.
\r
143 typedef struct IotMetricsTcpConnection
\r
145 IotLink_t link; /**< @brief List link member. */
\r
146 void * pNetworkContext; /**< @brief Context that may be used by metrics or Defender. */
\r
147 size_t addressLength; /**< @brief The length of the address stored in #IotMetricsTcpConnection_t.pRemoteAddress. */
\r
150 * @brief NULL-terminated IP address and port in text format.
\r
152 * IPv4 addresses will be in the format `xxx.xxx.xxx.xxx:port`.
\r
153 * IPv6 addresses will be in the format `[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:port`.
\r
155 char pRemoteAddress[ IOT_METRICS_IP_ADDRESS_LENGTH ];
\r
156 } IotMetricsTcpConnection_t;
\r
158 #endif /* ifndef IOT_PLATFORM_TYPES_H_ */
\r