2 * FreeRTOS+UDP V1.0.4
\r
3 * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\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
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software. If you wish to use our Amazon
\r
14 * FreeRTOS name, please do so in a fair use way that does not cause confusion.
\r
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
23 * http://www.FreeRTOS.org
\r
24 * http://aws.amazon.com/freertos
\r
26 * 1 tab == 4 spaces!
\r
29 #ifndef FREERTOS_IP_H
\r
30 #define FREERTOS_IP_H
\r
32 /* Use in FreeRTOSIPConfig.h. */
\r
33 #define FREERTOS_LITTLE_ENDIAN 0
\r
34 #define FREERTOS_BIG_ENDIAN 1
\r
36 /* Application level configuration options. */
\r
37 #include "FreeRTOSIPConfig.h"
\r
38 #include "FreeRTOSIPConfigDefaults.h"
\r
39 #include "IPTraceMacroDefaults.h"
\r
41 /* The number of octets in the MAC and IP addresses respectively. */
\r
42 #define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )
\r
43 #define ipIP_ADDRESS_LENGTH_BYTES ( 4 )
\r
45 #include "pack_struct_start.h"
\r
48 uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];
\r
50 #include "pack_struct_end.h"
\r
51 typedef struct xMAC_ADDRESS xMACAddress_t;
\r
53 typedef enum eNETWORK_EVENTS
\r
55 eNetworkUp, /* The network is configured. */
\r
56 eNetworkDown /* The network connection has been lost. */
\r
57 } eIPCallbackEvent_t;
\r
59 typedef enum ePING_REPLY_STATUS
\r
61 eSuccess = 0, /* A correct reply has been received for an outgoing ping. */
\r
62 eInvalidChecksum, /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */
\r
63 eInvalidData /* A reply was received to an outgoing ping but the payload of the reply was not correct. */
\r
64 } ePingReplyStatus_t;
\r
66 /* Endian related definitions. */
\r
67 #if( ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN )
\r
69 uint16_t FreeRTOS_htons( uint16_t usIn );
\r
70 uint32_t FreeRTOS_htonl( uint32_t ulIn );
\r
74 #define FreeRTOS_htons( x ) ( x )
\r
75 #define FreeRTOS_htonl( x ) ( x )
\r
77 #endif /* ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN */
\r
79 #define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )
\r
80 #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )
\r
83 * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
\r
84 * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
\r
85 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/FreeRTOS_UDP_API_Functions.shtml
\r
87 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
88 void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, TickType_t xBlockTimeTicks );
\r
89 void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );
\r
90 BaseType_t FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, TickType_t xBlockTimeTicks );
\r
91 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );
\r
92 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );
\r
93 void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );
\r
94 uint8_t * FreeRTOS_GetMACAddress( void );
\r
96 #if ( ipconfigFREERTOS_PLUS_NABTO == 1 )
\r
97 BaseType_t xStartNabtoTask( void );
\r
100 #endif /* FREERTOS_IP_H */
\r