]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/abstractions/platform/freertos/include/platform/iot_network_freertos.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / 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 types include. */\r
39 #include "types/iot_platform_types.h"\r
40 \r
41 /* Platform network include. */\r
42 #include "platform/iot_network.h"\r
43 \r
44 /**\r
45  * @brief Provides a default value for an #IotNetworkConnectionFreeRTOS_t.\r
46  *\r
47  * All instances of #IotNetworkConnectionFreeRTOS_t should be initialized with\r
48  * this constant.\r
49  *\r
50  * @warning Failing to initialize an #IotNetworkConnectionFreeRTOS_t with this\r
51  * initializer may result in undefined behavior!\r
52  * @note This initializer may change at any time in future versions, but its\r
53  * name will remain the same.\r
54  */\r
55 #define IOT_NETWORK_CONNECTION_FREERTOS_INITIALIZER     { 0 }\r
56 \r
57 /**\r
58  * @brief Generic initializer for an #IotNetworkServerInfo_t.\r
59  *\r
60  * @note This initializer may change at any time in future versions, but its\r
61  * name will remain the same.\r
62  */\r
63 #define IOT_NETWORK_SERVER_INFO_FREERTOS_INITIALIZER    { 0 }\r
64 \r
65 /**\r
66  * @brief Generic initializer for an #IotNetworkCredentials_t.\r
67  *\r
68  * @note This initializer may change at any time in future versions, but its\r
69  * name will remain the same.\r
70  */\r
71 #define IOT_NETWORK_CREDENTIALS_FREERTOS_INITIALIZER    { 0 }\r
72 \r
73 /**\r
74  * @brief Provides a pointer to an #IotNetworkInterface_t that uses the functions\r
75  * declared in this file.\r
76  */\r
77 #define IOT_NETWORK_INTERFACE_FREERTOS                  ( &( IotNetworkFreeRTOS ) )\r
78 \r
79 /**\r
80  * @brief One-time initialization function for this network stack.\r
81  */\r
82 IotNetworkError_t IotNetworkFreeRTOS_Init( void );\r
83 \r
84 /**\r
85  * @brief One-time cleanup function for this network stack.\r
86  */\r
87 void IotNetworkFreeRTOS_Cleanup( void );\r
88 \r
89 /**\r
90  * @brief An implementation of #IotNetworkInterface_t::create for FreeRTOS+TCP\r
91  * sockets.\r
92  */\r
93 IotNetworkError_t IotNetworkFreeRTOS_Create( IotNetworkServerInfo_t pServerInfo,\r
94                                              IotNetworkCredentials_t pCredentialInfo,\r
95                                              IotNetworkConnection_t * pConnection );\r
96 \r
97 /**\r
98  * @brief An implementation of #IotNetworkInterface_t::setReceiveCallback for\r
99  * FreeRTOS+TCP sockets.\r
100  */\r
101 IotNetworkError_t IotNetworkFreeRTOS_SetReceiveCallback( IotNetworkConnection_t pConnection,\r
102                                                          IotNetworkReceiveCallback_t receiveCallback,\r
103                                                          void * pContext );\r
104 \r
105 /**\r
106  * @brief An implementation of #IotNetworkInterface_t::send for FreeRTOS+TCP\r
107  * sockets.\r
108  */\r
109 size_t IotNetworkFreeRTOS_Send( IotNetworkConnection_t pConnection,\r
110                                 const uint8_t * pMessage,\r
111                                 size_t messageLength );\r
112 \r
113 /**\r
114  * @brief An implementation of #IotNetworkInterface_t::receive for FreeRTOS+TCP\r
115  * sockets.\r
116  */\r
117 size_t IotNetworkFreeRTOS_Receive( IotNetworkConnection_t pConnection,\r
118                                    uint8_t * pBuffer,\r
119                                    size_t bytesRequested );\r
120 \r
121 /**\r
122  * @brief An implementation of #IotNetworkInterface::receiveUpto for FreeRTOS+TCP\r
123  * sockets.\r
124  */\r
125 size_t IotNetworkFreeRTOS_ReceiveUpto( IotNetworkConnection_t pConnection,\r
126                                        uint8_t * pBuffer,\r
127                                        size_t bufferSize );\r
128 \r
129 /**\r
130  * @brief An implementation of #IotNetworkInterface_t::close for FreeRTOS+TCP\r
131  * sockets.\r
132  */\r
133 IotNetworkError_t IotNetworkFreeRTOS_Close( IotNetworkConnection_t pConnection );\r
134 \r
135 /**\r
136  * @brief An implementation of #IotNetworkInterface_t::destroy for FreeRTOS+TCP\r
137  * sockets.\r
138  */\r
139 IotNetworkError_t IotNetworkFreeRTOS_Destroy( IotNetworkConnection_t pConnection );\r
140 \r
141 /**\r
142  * @cond DOXYGEN_IGNORE\r
143  * Doxygen should ignore this section.\r
144  *\r
145  * Declaration of a network interface struct using the functions in this file.\r
146  */\r
147 extern const IotNetworkInterface_t IotNetworkFreeRTOS;\r
148 /** @endcond */\r
149 \r
150 #endif /* ifndef _IOT_NETWORK_FREERTOS_H_ */\r