]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries/abstractions/platform/freertos/include/platform/iot_network_freertos.h
Correct an err in queue.c introduced when previously updating behaviour when queue...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-IoT-Libraries / abstractions / platform / freertos / include / platform / iot_network_freertos.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_network_freertos.h\r
28  * @brief Declares the network stack functions specified in iot_network.h for\r
29  * FreeRTOS+TCP.\r
30  */\r
31 \r
32 #ifndef _IOT_NETWORK_FREERTOS_H_\r
33 #define _IOT_NETWORK_FREERTOS_H_\r
34 \r
35 /* Standard includes. */\r
36 #include <stdbool.h>\r
37 \r
38 /* Platform network include. */\r
39 #include "platform/iot_network.h"\r
40 \r
41 /**\r
42  * @brief Represents a network connection that uses FreeRTOS+TCP sockets.\r
43  *\r
44  * This is an incomplete type. In application code, only pointers to this type\r
45  * should be used.\r
46  */\r
47 typedef struct _networkConnection IotNetworkConnectionFreeRTOS_t;\r
48 \r
49 /**\r
50  * @brief Provides a default value for an #IotNetworkConnectionFreeRTOS_t.\r
51  *\r
52  * All instances of #IotNetworkConnectionFreeRTOS_t should be initialized with\r
53  * this constant.\r
54  *\r
55  * @warning Failing to initialize an #IotNetworkConnectionFreeRTOS_t with this\r
56  * initializer may result in undefined behavior!\r
57  * @note This initializer may change at any time in future versions, but its\r
58  * name will remain the same.\r
59  */\r
60 #define IOT_NETWORK_CONNECTION_FREERTOS_INITIALIZER     { 0 }\r
61 \r
62 /**\r
63  * @brief Generic initializer for an #IotNetworkServerInfo_t.\r
64  *\r
65  * @note This initializer may change at any time in future versions, but its\r
66  * name will remain the same.\r
67  */\r
68 #define IOT_NETWORK_SERVER_INFO_FREERTOS_INITIALIZER    { 0 }\r
69 \r
70 /**\r
71  * @brief Generic initializer for an #IotNetworkCredentials_t.\r
72  *\r
73  * @note This initializer may change at any time in future versions, but its\r
74  * name will remain the same.\r
75  */\r
76 #define IOT_NETWORK_CREDENTIALS_FREERTOS_INITIALIZER    { 0 }\r
77 \r
78 /**\r
79  * @brief Provides a pointer to an #IotNetworkInterface_t that uses the functions\r
80  * declared in this file.\r
81  */\r
82 #define IOT_NETWORK_INTERFACE_FREERTOS                  ( &( IotNetworkFreeRTOS ) )\r
83 \r
84 /**\r
85  * @brief An implementation of #IotNetworkInterface_t::create for FreeRTOS+TCP\r
86  * sockets.\r
87  */\r
88 IotNetworkError_t IotNetworkFreeRTOS_Create( void * pConnectionInfo,\r
89                                              void * pCredentialInfo,\r
90                                              void ** const pConnection );\r
91 \r
92 /**\r
93  * @brief An implementation of #IotNetworkInterface_t::setReceiveCallback for\r
94  * FreeRTOS+TCP sockets.\r
95  */\r
96 IotNetworkError_t IotNetworkFreeRTOS_SetReceiveCallback( void * pConnection,\r
97                                                          IotNetworkReceiveCallback_t receiveCallback,\r
98                                                          void * pContext );\r
99 \r
100 /**\r
101  * @brief An implementation of #IotNetworkInterface_t::send for FreeRTOS+TCP\r
102  * sockets.\r
103  */\r
104 size_t IotNetworkFreeRTOS_Send( void * pConnection,\r
105                                 const uint8_t * pMessage,\r
106                                 size_t messageLength );\r
107 \r
108 /**\r
109  * @brief An implementation of #IotNetworkInterface_t::receive for FreeRTOS+TCP\r
110  * sockets.\r
111  */\r
112 size_t IotNetworkFreeRTOS_Receive( void * pConnection,\r
113                                    uint8_t * pBuffer,\r
114                                    size_t bytesRequested );\r
115 \r
116 /**\r
117  * @brief An implementation of #IotNetworkInterface_t::close for FreeRTOS+TCP\r
118  * sockets.\r
119  */\r
120 IotNetworkError_t IotNetworkFreeRTOS_Close( void * pConnection );\r
121 \r
122 /**\r
123  * @brief An implementation of #IotNetworkInterface_t::destroy for FreeRTOS+TCP\r
124  * sockets.\r
125  */\r
126 IotNetworkError_t IotNetworkFreeRTOS_Destroy( void * pConnection );\r
127 \r
128 /**\r
129  * @cond DOXYGEN_IGNORE\r
130  * Doxygen should ignore this section.\r
131  *\r
132  * Declaration of a network interface struct using the functions in this file.\r
133  */\r
134 extern const IotNetworkInterface_t IotNetworkFreeRTOS;\r
135 /** @endcond */\r
136 \r
137 #endif /* ifndef _IOT_NETWORK_FREERTOS_H_ */\r