]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_UDP_IP.h
Clarify license blurb at the top of the FreeRTOS+UDP and FreeRTOS+CLI source files.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-UDP / include / FreeRTOS_UDP_IP.h
1 /*\r
2  * FreeRTOS+UDP V1.0.0 (C) 2013 Real Time Engineers ltd.\r
3  *\r
4  * This file is part of the FreeRTOS+UDP distribution.  The FreeRTOS+UDP license\r
5  * terms are different to the FreeRTOS license terms.\r
6  *\r
7  * FreeRTOS+UDP uses a dual license model that allows the software to be used\r
8  * under a pure GPL open source license (as opposed to the modified GPL license\r
9  * under which FreeRTOS is distributed) or a commercial license.  Details of\r
10  * both license options follow:\r
11  *\r
12  * - Open source licensing -\r
13  * FreeRTOS+UDP is a free download and may be used, modified, evaluated and\r
14  * distributed without charge provided the user adheres to version two of the\r
15  * GNU General Public License (GPL) and does not remove the copyright notice or\r
16  * this text.  The GPL V2 text is available on the gnu.org web site, and on the\r
17  * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.\r
18  *\r
19  * - Commercial licensing -\r
20  * Businesses and individuals that for commercial or other reasons cannot comply\r
21  * with the terms of the GPL V2 license must obtain a commercial license before \r
22  * incorporating FreeRTOS+UDP into proprietary software for distribution in any \r
23  * form.  Commercial licenses can be purchased from http://shop.freertos.org/udp \r
24  * and do not require any source files to be changed.\r
25  *\r
26  * FreeRTOS+UDP is distributed in the hope that it will be useful.  You cannot\r
27  * use FreeRTOS+UDP unless you agree that you use the software 'as is'.\r
28  * FreeRTOS+UDP is provided WITHOUT ANY WARRANTY; without even the implied\r
29  * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
30  * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
31  * implied, expressed, or statutory.\r
32  *\r
33  * 1 tab == 4 spaces!\r
34  *\r
35  * http://www.FreeRTOS.org\r
36  * http://www.FreeRTOS.org/udp\r
37  *\r
38  */\r
39 \r
40 #ifndef FREERTOS_IP_H\r
41 #define FREERTOS_IP_H\r
42 \r
43 /* Use in FreeRTOSIPConfig.h. */\r
44 #define FREERTOS_LITTLE_ENDIAN  0\r
45 #define FREERTOS_BIG_ENDIAN             1\r
46 \r
47 /* Application level configuration options. */\r
48 #include "FreeRTOSIPConfig.h"\r
49 #include "FreeRTOSIPConfigDefaults.h"\r
50 #include "IPTraceMacroDefaults.h"\r
51 \r
52 /* The number of octets in the MAC and IP addresses respectively. */\r
53 #define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )\r
54 #define ipIP_ADDRESS_LENGTH_BYTES ( 4 )\r
55 \r
56 #include "pack_struct_start.h"\r
57 struct xMAC_ADDRESS\r
58 {\r
59         uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];\r
60 }\r
61 #include "pack_struct_end.h"\r
62 typedef struct xMAC_ADDRESS xMACAddress_t;\r
63 \r
64 typedef enum eNETWORK_EVENTS\r
65 {\r
66         eNetworkUp,             /* The network is configured. */\r
67         eNetworkDown    /* The network connection has been lost. */\r
68 } eIPCallbackEvent_t;\r
69 \r
70 typedef enum ePING_REPLY_STATUS\r
71 {\r
72         eSuccess = 0,           /* A correct reply has been received for an outgoing ping. */\r
73         eInvalidChecksum,       /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */\r
74         eInvalidData            /* A reply was received to an outgoing ping but the payload of the reply was not correct. */\r
75 } ePingReplyStatus_t;\r
76 \r
77 /* Endian related definitions. */\r
78 #if( ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN )\r
79 \r
80         uint16_t FreeRTOS_htons( uint16_t usIn );\r
81         uint32_t FreeRTOS_htonl( uint32_t ulIn );\r
82 \r
83 #else\r
84 \r
85         #define FreeRTOS_htons( x ) ( x )\r
86         #define FreeRTOS_htonl( x ) ( x )\r
87 \r
88 #endif /* ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN */\r
89 \r
90 #define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )\r
91 #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )\r
92 \r
93 /**\r
94  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE\r
95  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:\r
96  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/FreeRTOS_UDP_API_Functions.shtml\r
97  */\r
98 portBASE_TYPE 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
99 void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, portTickType xBlockTimeTicks );\r
100 void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );\r
101 portBASE_TYPE FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, portTickType xBlockTimeTicks );\r
102 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );\r
103 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );\r
104 void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );\r
105 uint8_t * FreeRTOS_GetMACAddress( void );\r
106 \r
107 #endif /* FREERTOS_IP_H */\r
108 \r
109 \r
110 \r
111 \r
112 \r
113 \r
114 \r
115 \r
116 \r
117 \r
118 \r
119 \r
120 \r