]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_UDP_IP.h
Roll up the minor changes checked into svn since V10.0.0 into new V10.0.1 ready for...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-UDP / include / FreeRTOS_UDP_IP.h
1 /*\r
2  * FreeRTOS+UDP V1.0.4\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://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 #ifndef FREERTOS_IP_H\r
29 #define FREERTOS_IP_H\r
30 \r
31 /* Use in FreeRTOSIPConfig.h. */\r
32 #define FREERTOS_LITTLE_ENDIAN  0\r
33 #define FREERTOS_BIG_ENDIAN             1\r
34 \r
35 /* Application level configuration options. */\r
36 #include "FreeRTOSIPConfig.h"\r
37 #include "FreeRTOSIPConfigDefaults.h"\r
38 #include "IPTraceMacroDefaults.h"\r
39 \r
40 /* The number of octets in the MAC and IP addresses respectively. */\r
41 #define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )\r
42 #define ipIP_ADDRESS_LENGTH_BYTES ( 4 )\r
43 \r
44 #include "pack_struct_start.h"\r
45 struct xMAC_ADDRESS\r
46 {\r
47         uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];\r
48 }\r
49 #include "pack_struct_end.h"\r
50 typedef struct xMAC_ADDRESS xMACAddress_t;\r
51 \r
52 typedef enum eNETWORK_EVENTS\r
53 {\r
54         eNetworkUp,             /* The network is configured. */\r
55         eNetworkDown    /* The network connection has been lost. */\r
56 } eIPCallbackEvent_t;\r
57 \r
58 typedef enum ePING_REPLY_STATUS\r
59 {\r
60         eSuccess = 0,           /* A correct reply has been received for an outgoing ping. */\r
61         eInvalidChecksum,       /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */\r
62         eInvalidData            /* A reply was received to an outgoing ping but the payload of the reply was not correct. */\r
63 } ePingReplyStatus_t;\r
64 \r
65 /* Endian related definitions. */\r
66 #if( ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN )\r
67 \r
68         uint16_t FreeRTOS_htons( uint16_t usIn );\r
69         uint32_t FreeRTOS_htonl( uint32_t ulIn );\r
70 \r
71 #else\r
72 \r
73         #define FreeRTOS_htons( x ) ( x )\r
74         #define FreeRTOS_htonl( x ) ( x )\r
75 \r
76 #endif /* ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN */\r
77 \r
78 #define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )\r
79 #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )\r
80 \r
81 /**\r
82  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE\r
83  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:\r
84  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/FreeRTOS_UDP_API_Functions.shtml\r
85  */\r
86 BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );\r
87 void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );\r
88 void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );\r
89 BaseType_t FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, TickType_t xBlockTimeTicks );\r
90 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );\r
91 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );\r
92 void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );\r
93 uint8_t * FreeRTOS_GetMACAddress( void );\r
94 \r
95 #if ( ipconfigFREERTOS_PLUS_NABTO == 1 )\r
96         BaseType_t xStartNabtoTask( void );\r
97 #endif\r
98 \r
99 #endif /* FREERTOS_IP_H */\r
100 \r
101 \r
102 \r
103 \r
104 \r
105 \r
106 \r
107 \r
108 \r
109 \r
110 \r
111 \r
112 \r