]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_Sockets.h
Update TCP to last release versions in preparation for kernel V10.3.0 release.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-Plus-TCP / include / FreeRTOS_Sockets.h
1 /*\r
2  * FreeRTOS+TCP 2.2.x Labs copy\r
3  * Copyright (C) 2017 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 #ifndef FREERTOS_SOCKETS_H\r
27 #define FREERTOS_SOCKETS_H\r
28 \r
29 #ifdef __cplusplus\r
30 extern "C" {\r
31 #endif\r
32 \r
33 /* Standard includes. */\r
34 #include <string.h>\r
35 \r
36 /* Application level configuration options. */\r
37 #include "FreeRTOSIPConfig.h"\r
38 \r
39 #ifndef FREERTOS_IP_CONFIG_H\r
40         #error FreeRTOSIPConfig.h has not been included yet\r
41 #endif\r
42 \r
43 /* Event bit definitions are required by the select functions. */\r
44 #include "event_groups.h"\r
45 \r
46 #ifndef INC_FREERTOS_H\r
47         #error FreeRTOS.h must be included before FreeRTOS_Sockets.h.\r
48 #endif\r
49 \r
50 #ifndef INC_TASK_H\r
51         #ifndef TASK_H /* For compatibility with older FreeRTOS versions. */\r
52                 #error The FreeRTOS header file task.h must be included before FreeRTOS_Sockets.h.\r
53         #endif\r
54 #endif\r
55 \r
56 /* Assigned to an Socket_t variable when the socket is not valid, probably\r
57 because it could not be created. */\r
58 #define FREERTOS_INVALID_SOCKET ( ( Socket_t ) ~0U )\r
59 \r
60 /* API function error values.  As errno is supported, the FreeRTOS sockets\r
61 functions return error codes rather than just a pass or fail indication. */\r
62 /* HT: Extended the number of error codes, gave them positive values and if possible\r
63 the corresponding found in errno.h\r
64 In case of an error, API's will still return negative numbers, e.g.\r
65   return -pdFREERTOS_ERRNO_EWOULDBLOCK;\r
66 in case an operation would block */\r
67 \r
68 /* The following defines are obsolete, please use -pdFREERTOS_ERRNO_Exxx */\r
69 \r
70 #define FREERTOS_SOCKET_ERROR   ( -1 )\r
71 #define FREERTOS_EWOULDBLOCK    ( - pdFREERTOS_ERRNO_EWOULDBLOCK )\r
72 #define FREERTOS_EINVAL                 ( - pdFREERTOS_ERRNO_EINVAL )\r
73 #define FREERTOS_EADDRNOTAVAIL  ( - pdFREERTOS_ERRNO_EADDRNOTAVAIL )\r
74 #define FREERTOS_EADDRINUSE             ( - pdFREERTOS_ERRNO_EADDRINUSE )\r
75 #define FREERTOS_ENOBUFS                ( - pdFREERTOS_ERRNO_ENOBUFS )\r
76 #define FREERTOS_ENOPROTOOPT    ( - pdFREERTOS_ERRNO_ENOPROTOOPT )\r
77 #define FREERTOS_ECLOSED                ( - pdFREERTOS_ERRNO_ENOTCONN )\r
78 \r
79 /* Values for the parameters to FreeRTOS_socket(), inline with the Berkeley\r
80 standard.  See the documentation of FreeRTOS_socket() for more information. */\r
81 #define FREERTOS_AF_INET                ( 2 )\r
82 #define FREERTOS_AF_INET6               ( 10 )\r
83 #define FREERTOS_SOCK_DGRAM             ( 2 )\r
84 #define FREERTOS_IPPROTO_UDP    ( 17 )\r
85 \r
86 #define FREERTOS_SOCK_STREAM    ( 1 )\r
87 #define FREERTOS_IPPROTO_TCP    ( 6 )\r
88 /* IP packet of type "Any local network"\r
89  * can be used in stead of TCP for testing with sockets in raw mode\r
90  */\r
91 #define FREERTOS_IPPROTO_USR_LAN  ( 63 )\r
92 \r
93 /* A bit value that can be passed into the FreeRTOS_sendto() function as part of\r
94 the flags parameter.  Setting the FREERTOS_ZERO_COPY in the flags parameter\r
95 indicates that the zero copy interface is being used.  See the documentation for\r
96 FreeRTOS_sockets() for more information. */\r
97 #define FREERTOS_ZERO_COPY              ( 1 )\r
98 \r
99 /* Values that can be passed in the option name parameter of calls to\r
100 FreeRTOS_setsockopt(). */\r
101 #define FREERTOS_SO_RCVTIMEO                    ( 0 )           /* Used to set the receive time out. */\r
102 #define FREERTOS_SO_SNDTIMEO                    ( 1 )           /* Used to set the send time out. */\r
103 #define FREERTOS_SO_UDPCKSUM_OUT                ( 2 )           /* Used to turn the use of the UDP checksum by a socket on or off.  This also doubles as part of an 8-bit bitwise socket option. */\r
104 #if( ipconfigSOCKET_HAS_USER_SEMAPHORE == 1 )\r
105         #define FREERTOS_SO_SET_SEMAPHORE       ( 3 )           /* Used to set a user's semaphore */\r
106 #endif\r
107 #define FREERTOS_SO_SNDBUF                              ( 4 )           /* Set the size of the send buffer (TCP only) */\r
108 #define FREERTOS_SO_RCVBUF                              ( 5 )           /* Set the size of the receive buffer (TCP only) */\r
109 \r
110 #if ipconfigUSE_CALLBACKS == 1\r
111         #define FREERTOS_SO_TCP_CONN_HANDLER    ( 6 )           /* Install a callback for (dis) connection events. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */\r
112         #define FREERTOS_SO_TCP_RECV_HANDLER    ( 7 )           /* Install a callback for receiving TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */\r
113         #define FREERTOS_SO_TCP_SENT_HANDLER    ( 8 )           /* Install a callback for sending TCP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */\r
114         #define FREERTOS_SO_UDP_RECV_HANDLER    ( 9 )           /* Install a callback for receiving UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */\r
115         #define FREERTOS_SO_UDP_SENT_HANDLER    ( 10 )          /* Install a callback for sending UDP data. Supply pointer to 'F_TCP_UDP_Handler_t' (see below) */\r
116 #endif /* ipconfigUSE_CALLBACKS */\r
117 \r
118 #define FREERTOS_SO_REUSE_LISTEN_SOCKET ( 11 )          /* When a listening socket gets connected, do not create a new one but re-use it */\r
119 #define FREERTOS_SO_CLOSE_AFTER_SEND    ( 12 )          /* As soon as the last byte has been transmitted, finalise the connection */\r
120 #define FREERTOS_SO_WIN_PROPERTIES              ( 13 )          /* Set all buffer and window properties in one call, parameter is pointer to WinProperties_t */\r
121 #define FREERTOS_SO_SET_FULL_SIZE               ( 14 )          /* Refuse to send packets smaller than MSS  */\r
122 \r
123 #define FREERTOS_SO_STOP_RX                             ( 15 )          /* Temporarily hold up reception, used by streaming client */\r
124 \r
125 #if( ipconfigUDP_MAX_RX_PACKETS > 0 )\r
126         #define FREERTOS_SO_UDP_MAX_RX_PACKETS  ( 16 )          /* This option helps to limit the maximum number of packets a UDP socket will buffer */\r
127 #endif\r
128 \r
129 #if( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK == 1 )\r
130         #define FREERTOS_SO_WAKEUP_CALLBACK     ( 17 )\r
131 #endif\r
132 \r
133 #define FREERTOS_SO_SET_LOW_HIGH_WATER  ( 18 )\r
134 \r
135 #define FREERTOS_NOT_LAST_IN_FRAGMENTED_PACKET  ( 0x80 )  /* For internal use only, but also part of an 8-bit bitwise value. */\r
136 #define FREERTOS_FRAGMENTED_PACKET                              ( 0x40 )  /* For internal use only, but also part of an 8-bit bitwise value. */\r
137 \r
138 /* Values for flag for FreeRTOS_shutdown(). */\r
139 #define FREERTOS_SHUT_RD                                ( 0 )           /* Not really at this moment, just for compatibility of the interface */\r
140 #define FREERTOS_SHUT_WR                                ( 1 )\r
141 #define FREERTOS_SHUT_RDWR                              ( 2 )\r
142 \r
143 /* Values for flag for FreeRTOS_recv(). */\r
144 #define FREERTOS_MSG_OOB                                ( 2 )           /* process out-of-band data */\r
145 #define FREERTOS_MSG_PEEK                               ( 4 )           /* peek at incoming message */\r
146 #define FREERTOS_MSG_DONTROUTE                  ( 8 )           /* send without using routing tables */\r
147 #define FREERTOS_MSG_DONTWAIT                   ( 16 )          /* Can be used with recvfrom(), sendto(), recv(), and send(). */\r
148 \r
149 typedef struct xWIN_PROPS {\r
150         /* Properties of the Tx buffer and Tx window */\r
151         int32_t lTxBufSize;     /* Unit: bytes */\r
152         int32_t lTxWinSize;     /* Unit: MSS */\r
153 \r
154         /* Properties of the Rx buffer and Rx window */\r
155         int32_t lRxBufSize;     /* Unit: bytes */\r
156         int32_t lRxWinSize;     /* Unit: MSS */\r
157 } WinProperties_t;\r
158 \r
159 typedef struct xLOW_HIGH_WATER {\r
160         /* Structure to pass for the 'FREERTOS_SO_SET_LOW_HIGH_WATER' option */\r
161         size_t uxLittleSpace;   /* Send a STOP when buffer space drops below X bytes */\r
162         size_t uxEnoughSpace;   /* Send a GO when buffer space grows above X bytes */\r
163 } LowHighWater_t;\r
164 \r
165 /* For compatibility with the expected Berkeley sockets naming. */\r
166 #define socklen_t uint32_t\r
167 \r
168 /* For this limited implementation, only two members are required in the\r
169 Berkeley style sockaddr structure. */\r
170 struct freertos_sockaddr\r
171 {\r
172         /* _HT_ On 32- and 64-bit architectures, the addition of the two uint8_t\r
173         fields doesn't make the structure bigger, due to alignment.\r
174         The fields are inserted as a preparation for IPv6. */\r
175 \r
176         /* sin_len and sin_family not used in the IPv4-only release. */\r
177         uint8_t sin_len;                /* length of this structure. */\r
178         uint8_t sin_family;             /* FREERTOS_AF_INET. */\r
179         uint16_t sin_port;\r
180         uint32_t sin_addr;\r
181 };\r
182 \r
183 #if ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN\r
184 \r
185         #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 )                              \\r
186                                                                                 ( ( ( ( uint32_t ) ( ucOctet3 ) ) << 24UL ) |           \\r
187                                                                                 ( ( ( uint32_t ) ( ucOctet2 ) ) << 16UL ) |                     \\r
188                                                                                 ( ( ( uint32_t ) ( ucOctet1 ) ) <<  8UL ) |                     \\r
189                                                                                 ( ( uint32_t ) ( ucOctet0 ) ) )\r
190 \r
191         #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer )                                                                    \\r
192                                                                 sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u",                       \\r
193                                                                         ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ),                  \\r
194                                                                         ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \\r
195                                                                         ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\\r
196                                                                         ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ) )\r
197 \r
198 #else /* ipconfigBYTE_ORDER */\r
199 \r
200         #define FreeRTOS_inet_addr_quick( ucOctet0, ucOctet1, ucOctet2, ucOctet3 )                              \\r
201                                                                                 ( ( ( ( uint32_t ) ( ucOctet0 ) ) << 24UL ) |           \\r
202                                                                                 ( ( ( uint32_t ) ( ucOctet1 ) ) << 16UL ) |                     \\r
203                                                                                 ( ( ( uint32_t ) ( ucOctet2 ) ) <<  8UL ) |                     \\r
204                                                                                 ( ( uint32_t ) ( ucOctet3 ) ) )\r
205 \r
206         #define FreeRTOS_inet_ntoa( ulIPAddress, pucBuffer )                                                                    \\r
207                                                                 sprintf( ( char * ) ( pucBuffer ), "%u.%u.%u.%u",                       \\r
208                                                                         ( ( unsigned ) ( ( ulIPAddress ) >> 24 ) ),                             \\r
209                                                                         ( ( unsigned ) ( ( ( ulIPAddress ) >> 16 ) & 0xffUL ) ),\\r
210                                                                         ( ( unsigned ) ( ( ( ulIPAddress ) >> 8 ) & 0xffUL ) ), \\r
211                                                                         ( ( unsigned ) ( ( ulIPAddress ) & 0xffUL ) ) )\r
212 \r
213 #endif /* ipconfigBYTE_ORDER */\r
214 \r
215 /* The socket type itself. */\r
216 struct xSOCKET;\r
217 typedef struct xSOCKET *Socket_t;\r
218 \r
219 /* The SocketSet_t type is the equivalent to the fd_set type used by the\r
220 Berkeley API. */\r
221 struct xSOCKET_SET;\r
222 typedef struct xSOCKET_SET *SocketSet_t;\r
223 \r
224 /**\r
225  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE\r
226  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:\r
227  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html\r
228  */\r
229 Socket_t FreeRTOS_socket( BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol );\r
230 int32_t FreeRTOS_recvfrom( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags, struct freertos_sockaddr *pxSourceAddress, socklen_t *pxSourceAddressLength );\r
231 int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t xTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, socklen_t xDestinationAddressLength );\r
232 BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );\r
233 \r
234 /* function to get the local address and IP port */\r
235 size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );\r
236 \r
237 /* Made available when ipconfigETHERNET_DRIVER_FILTERS_PACKETS is set to 1. */\r
238 BaseType_t xPortHasUDPSocket( uint16_t usPortNr );\r
239 \r
240 #if ipconfigUSE_TCP == 1\r
241 \r
242 BaseType_t FreeRTOS_connect( Socket_t xClientSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength );\r
243 BaseType_t FreeRTOS_listen( Socket_t xSocket, BaseType_t xBacklog );\r
244 BaseType_t FreeRTOS_recv( Socket_t xSocket, void *pvBuffer, size_t xBufferLength, BaseType_t xFlags );\r
245 BaseType_t FreeRTOS_send( Socket_t xSocket, const void *pvBuffer, size_t uxDataLength, BaseType_t xFlags );\r
246 Socket_t FreeRTOS_accept( Socket_t xServerSocket, struct freertos_sockaddr *pxAddress, socklen_t *pxAddressLength );\r
247 BaseType_t FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow);\r
248 \r
249 #if( ipconfigSUPPORT_SIGNALS != 0 )\r
250         /* Send a signal to the task which is waiting for a given socket. */\r
251         BaseType_t FreeRTOS_SignalSocket( Socket_t xSocket );\r
252 \r
253         /* Send a signal to the task which reads from this socket (FromISR\r
254         version). */\r
255         BaseType_t FreeRTOS_SignalSocketFromISR( Socket_t xSocket, BaseType_t *pxHigherPriorityTaskWoken );\r
256 #endif /* ipconfigSUPPORT_SIGNALS */\r
257 \r
258 /* Return the remote address and IP port. */\r
259 BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress );\r
260 \r
261 /* returns pdTRUE if TCP socket is connected */\r
262 BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket );\r
263 \r
264 /* returns the actual size of MSS being used */\r
265 BaseType_t FreeRTOS_mss( Socket_t xSocket );\r
266 \r
267 /* for internal use only: return the connection status */\r
268 BaseType_t FreeRTOS_connstatus( Socket_t xSocket );\r
269 \r
270 /* Returns the number of bytes that may be added to txStream */\r
271 BaseType_t FreeRTOS_maywrite( Socket_t xSocket );\r
272 \r
273 /*\r
274  * Two helper functions, mostly for testing\r
275  * rx_size returns the number of bytes available in the Rx buffer\r
276  * tx_space returns the free space in the Tx buffer\r
277  */\r
278 BaseType_t FreeRTOS_rx_size( Socket_t xSocket );\r
279 BaseType_t FreeRTOS_tx_space( Socket_t xSocket );\r
280 BaseType_t FreeRTOS_tx_size( Socket_t xSocket );\r
281 \r
282 /* Returns the number of outstanding bytes in txStream. */\r
283 /* The function FreeRTOS_outstanding() was already implemented\r
284 FreeRTOS_tx_size(). */\r
285 #define FreeRTOS_outstanding( xSocket ) FreeRTOS_tx_size( xSocket )\r
286 \r
287 /* Returns the number of bytes in the socket's rxStream. */\r
288 /* The function FreeRTOS_recvcount() was already implemented\r
289 FreeRTOS_rx_size(). */\r
290 #define FreeRTOS_recvcount( xSocket )   FreeRTOS_rx_size( xSocket )\r
291 \r
292 /*\r
293  * For advanced applications only:\r
294  * Get a direct pointer to the circular transmit buffer.\r
295  * '*pxLength' will contain the number of bytes that may be written.\r
296  */\r
297 uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength );\r
298 \r
299 #endif /* ipconfigUSE_TCP */\r
300 \r
301 /*\r
302  * Connect / disconnect handler for a TCP socket\r
303  * For example:\r
304  *              static void vMyConnectHandler (Socket_t xSocket, BaseType_t ulConnected)\r
305  *              {\r
306  *              }\r
307  *              F_TCP_UDP_Handler_t xHnd = { vMyConnectHandler };\r
308  *              FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_CONN_HANDLER, ( void * ) &xHnd, sizeof( xHnd ) );\r
309  */\r
310 \r
311 typedef void (* FOnConnected_t )( Socket_t /* xSocket */, BaseType_t /* ulConnected */ );\r
312 \r
313 /*\r
314  * Reception handler for a TCP socket\r
315  * A user-proved function will be called on reception of a message\r
316  * If the handler returns a positive number, the messages will not be stored\r
317  * For example:\r
318  *              static BaseType_t xOnTCPReceive( Socket_t xSocket, void * pData, size_t xLength )\r
319  *              {\r
320  *                      // handle the message\r
321  *                      return 1;\r
322  *              }\r
323  *              F_TCP_UDP_Handler_t xHand = { xOnTCPReceive };\r
324  *              FreeRTOS_setsockopt( sock, 0, FREERTOS_SO_TCP_RECV_HANDLER, ( void * ) &xHand, sizeof( xHand ) );\r
325  */\r
326 typedef BaseType_t (* FOnTCPReceive_t )( Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */ );\r
327 typedef void (* FOnTCPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );\r
328 \r
329 /*\r
330  * Reception handler for a UDP socket\r
331  * A user-proved function will be called on reception of a message\r
332  * If the handler returns a positive number, the messages will not be stored\r
333  */\r
334 typedef BaseType_t (* FOnUDPReceive_t ) (Socket_t /* xSocket */, void * /* pData */, size_t /* xLength */,\r
335         const struct freertos_sockaddr * /* pxFrom */, const struct freertos_sockaddr * /* pxDest */ );\r
336 typedef void (* FOnUDPSent_t )( Socket_t /* xSocket */, size_t /* xLength */ );\r
337 \r
338 \r
339 typedef union xTCP_UDP_HANDLER\r
340 {\r
341         FOnConnected_t  pxOnTCPConnected;       /* FREERTOS_SO_TCP_CONN_HANDLER */\r
342         FOnTCPReceive_t pxOnTCPReceive;         /* FREERTOS_SO_TCP_RECV_HANDLER */\r
343         FOnTCPSent_t    pxOnTCPSent;            /* FREERTOS_SO_TCP_SENT_HANDLER */\r
344         FOnUDPReceive_t pxOnUDPReceive;         /* FREERTOS_SO_UDP_RECV_HANDLER */\r
345         FOnUDPSent_t    pxOnUDPSent;            /* FREERTOS_SO_UDP_SENT_HANDLER */\r
346 } F_TCP_UDP_Handler_t;\r
347 \r
348 BaseType_t FreeRTOS_setsockopt( Socket_t xSocket, int32_t lLevel, int32_t lOptionName, const void *pvOptionValue, size_t xOptionLength );\r
349 BaseType_t FreeRTOS_closesocket( Socket_t xSocket );\r
350 uint32_t FreeRTOS_gethostbyname( const char *pcHostName );\r
351 uint32_t FreeRTOS_inet_addr( const char * pcIPAddress );\r
352 \r
353 /*\r
354  * For the web server: borrow the circular Rx buffer for inspection\r
355  * HTML driver wants to see if a sequence of 13/10/13/10 is available\r
356  */\r
357 const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket );\r
358 \r
359 void FreeRTOS_netstat( void );\r
360 \r
361 #if ipconfigSUPPORT_SELECT_FUNCTION == 1\r
362 \r
363         /* For FD_SET and FD_CLR, a combination of the following bits can be used: */\r
364 \r
365         typedef enum eSELECT_EVENT {\r
366                 eSELECT_READ    = 0x0001,\r
367                 eSELECT_WRITE   = 0x0002,\r
368                 eSELECT_EXCEPT  = 0x0004,\r
369                 eSELECT_INTR    = 0x0008,\r
370                 eSELECT_ALL             = 0x000F,\r
371                 /* Reserved for internal use: */\r
372                 eSELECT_CALL_IP = 0x0010,\r
373                 /* end */\r
374         } eSelectEvent_t;\r
375 \r
376         SocketSet_t FreeRTOS_CreateSocketSet( void );\r
377         void FreeRTOS_DeleteSocketSet( SocketSet_t xSocketSet );\r
378         void FreeRTOS_FD_SET( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToSet );\r
379         void FreeRTOS_FD_CLR( Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToClear );\r
380         EventBits_t FreeRTOS_FD_ISSET( Socket_t xSocket, SocketSet_t xSocketSet );\r
381         BaseType_t FreeRTOS_select( SocketSet_t xSocketSet, TickType_t xBlockTimeTicks );\r
382 \r
383 #endif /* ipconfigSUPPORT_SELECT_FUNCTION */\r
384 \r
385 #ifdef __cplusplus\r
386 } // extern "C"\r
387 #endif\r
388 \r
389 #endif /* FREERTOS_SOCKETS_H */\r
390 \r
391 \r
392 \r
393 \r
394 \r
395 \r
396 \r
397 \r
398 \r
399 \r
400 \r
401 \r
402 \r