]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries/abstractions/platform/include/types/iot_platform_types.h
Correct an err in queue.c introduced when previously updating behaviour when queue...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-IoT-Libraries / abstractions / platform / include / types / iot_platform_types.h
1 /*\r
2  * Amazon FreeRTOS Platform V1.0.0\r
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\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
11  *\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
14  *\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
21  *\r
22  * http://aws.amazon.com/freertos\r
23  * http://www.FreeRTOS.org\r
24  */\r
25 \r
26 /**\r
27  * @file iot_platform_types.h\r
28  * @brief Types of the platform layer.\r
29  */\r
30 \r
31 #ifndef IOT_PLATFORM_TYPES_H_\r
32 #define IOT_PLATFORM_TYPES_H_\r
33 \r
34 /* The config header is always included first. */\r
35 #include "iot_config.h"\r
36 \r
37 /* Linear containers (lists and queues) include for metrics types. */\r
38 #include "iot_linear_containers.h"\r
39 \r
40 /*------------------------- Thread management types -------------------------*/\r
41 \r
42 /**\r
43  * @brief A value representing the system default for new thread priority.\r
44  */\r
45 #ifndef IOT_THREAD_DEFAULT_PRIORITY\r
46     #define IOT_THREAD_DEFAULT_PRIORITY      0\r
47 #endif\r
48 \r
49 /**\r
50  * @brief A value representhing the system default for new thread stack size.\r
51  */\r
52 #ifndef IOT_THREAD_DEFAULT_STACK_SIZE\r
53     #define IOT_THREAD_DEFAULT_STACK_SIZE    0\r
54 #endif\r
55 \r
56 /**\r
57  * @ingroup platform_datatypes_handles\r
58  * @brief The type used to represent mutexes, configured with the type\r
59  * `_IotSystemMutex_t`.\r
60  *\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
64  * </span>\r
65  *\r
66  * Mutexes should only be released by the threads that take them.\r
67  *\r
68  * <b>Example</b> <br>\r
69  * To change the type of #IotMutex_t to `long`:\r
70  * @code{c}\r
71  * typedef long _IotSystemMutex_t;\r
72  * #include "iot_threads.h"\r
73  * @endcode\r
74  */\r
75 typedef _IotSystemMutex_t       IotMutex_t;\r
76 \r
77 /**\r
78  * @ingroup platform_datatypes_handles\r
79  * @brief The type used to represent semaphores, configured with the type\r
80  * `_IotSystemSemaphore_t`.\r
81  *\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
85  * </span>\r
86  *\r
87  * Semaphores must be counting, and any thread may take (wait on) or release\r
88  * (post to) a semaphore.\r
89  *\r
90  * <b>Example</b> <br>\r
91  * To change the type of #IotSemaphore_t to `long`:\r
92  * @code{c}\r
93  * typedef long _IotSystemSemaphore_t;\r
94  * #include "iot_threads.h"\r
95  * @endcode\r
96  */\r
97 typedef _IotSystemSemaphore_t   IotSemaphore_t;\r
98 \r
99 /**\r
100  * @brief Thread routine function.\r
101  *\r
102  * @param[in] void * The argument passed to the @ref\r
103  * platform_threads_function_createdetachedthread. For application use.\r
104  */\r
105 typedef void ( * IotThreadRoutine_t )( void * );\r
106 \r
107 /*-------------------------- Clock and timer types --------------------------*/\r
108 \r
109 /**\r
110  * @ingroup platform_datatypes_handles\r
111  * @brief The type used to represent timers, configured with the type\r
112  * `_IotSystemTimer_t`.\r
113  *\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
117  * </span>\r
118  *\r
119  * <b>Example</b> <br>\r
120  * To change the type of #IotTimer_t to `long`:\r
121  * @code{c}\r
122  * typedef long _IotSystemTimer_t;\r
123  * #include "iot_clock.h"\r
124  * @endcode\r
125  */\r
126 typedef _IotSystemTimer_t IotTimer_t;\r
127 \r
128 /*------------------------------ Metrics types ------------------------------*/\r
129 \r
130 /**\r
131  * @brief The length of the buffer used to store IP addresses for metrics.\r
132  *\r
133  * This is the length of the longest IPv6 address plus space for the port number\r
134  * and NULL terminator.\r
135  */\r
136 #define IOT_METRICS_IP_ADDRESS_LENGTH    54\r
137 \r
138 /**\r
139  * @brief Represents a TCP connection to a remote IPv4 server.\r
140  *\r
141  * A list of these is provided by @ref platform_metrics_function_gettcpconnections.\r
142  */\r
143 typedef struct IotMetricsTcpConnection\r
144 {\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
148 \r
149     /**\r
150      * @brief NULL-terminated IP address and port in text format.\r
151      *\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
154      */\r
155     char pRemoteAddress[ IOT_METRICS_IP_ADDRESS_LENGTH ];\r
156 } IotMetricsTcpConnection_t;\r
157 \r
158 #endif /* ifndef IOT_PLATFORM_TYPES_H_ */\r