/*\r
- * FreeRTOS+UDP V1.0.0 (C) 2013 Real Time Engineers ltd.\r
+ * FreeRTOS+UDP V1.0.4\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
- * FreeRTOS+UDP is an add-on component to FreeRTOS. It is not, in itself, part\r
- * of the FreeRTOS kernel. FreeRTOS+UDP is licensed separately from FreeRTOS,\r
- * and uses a different license to FreeRTOS. FreeRTOS+UDP uses a dual license\r
- * model, information on which is provided below:\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
*\r
- * - Open source licensing -\r
- * FreeRTOS+UDP is a free download and may be used, modified and distributed\r
- * without charge provided the user adheres to version two of the GNU General\r
- * Public license (GPL) and does not remove the copyright notice or this text.\r
- * The GPL V2 text is available on the gnu.org web site, and on the following\r
- * URL: http://www.FreeRTOS.org/gpl-2.0.txt\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software. If you wish to use our Amazon\r
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
*\r
- * - Commercial licensing -\r
- * Businesses and individuals who wish to incorporate FreeRTOS+UDP into\r
- * proprietary software for redistribution in any form must first obtain a\r
- * (very) low cost commercial license - and in-so-doing support the maintenance,\r
- * support and further development of the FreeRTOS+UDP product. Commercial\r
- * licenses can be obtained from http://shop.freertos.org and do not require any\r
- * source files to be changed.\r
- *\r
- * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot\r
- * use FreeRTOS+UDP unless you agree that you use the software 'as is'.\r
- * FreeRTOS+UDP is provided WITHOUT ANY WARRANTY; without even the implied\r
- * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
- * implied, expressed, or statutory.\r
- *\r
- * 1 tab == 4 spaces!\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
*\r
* http://www.FreeRTOS.org\r
- * http://www.FreeRTOS.org/udp\r
+ * http://aws.amazon.com/freertos\r
*\r
+ * 1 tab == 4 spaces!\r
*/\r
\r
/* Standard includes. */\r
/*\r
* Create the DNS message in the zero copy buffer passed in the first parameter.\r
*/\r
-static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const uint8_t *pcHostName, uint16_t usIdentifier );\r
+static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const char *pcHostName, uint16_t usIdentifier );\r
\r
/*\r
* Simple routine that jumps over the NAME field of a resource record.\r
\r
/*-----------------------------------------------------------*/\r
\r
-uint32_t FreeRTOS_gethostbyname( const uint8_t *pcHostName )\r
+uint32_t FreeRTOS_gethostbyname( const char *pcHostName )\r
{\r
static uint16_t usIdentifier = 0;\r
struct freertos_sockaddr xAddress;\r
uint32_t ulIPAddress = 0UL;\r
uint8_t *pucUDPPayloadBuffer;\r
static uint32_t ulAddressLength;\r
-portBASE_TYPE xAttempt;\r
+BaseType_t xAttempt;\r
int32_t lBytes;\r
size_t xPayloadLength;\r
-const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( ( const char * const ) pcHostName ) + sizeof( uint16_t ) + sizeof( uint16_t ) + 2; /* Two for the count of characters in the first subdomain part, and the string end byte */\r
+const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( pcHostName ) + sizeof( uint16_t ) + sizeof( uint16_t ) + 2; /* Two for the count of characters in the first subdomain part, and the string end byte */\r
\r
if( xDNSSocket == NULL )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const uint8_t *pcHostName, uint16_t usIdentifier )\r
+static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const char *pcHostName, uint16_t usIdentifier )\r
{\r
xDNSMessage_t *pxDNSMessageHeader;\r
uint8_t *pucStart, *pucByte;\r
pucByte = pucStart + 1;\r
\r
/* Copy in the host name. */\r
- strcpy( ( char * ) pucByte, ( const char * ) pcHostName );\r
+ strcpy( ( char * ) pucByte, pcHostName );\r
\r
/* Mark the end of the string. */\r
- pucByte += strlen( ( const char * ) pcHostName );\r
+ pucByte += strlen( pcHostName );\r
*pucByte = 0x00;\r
\r
/* Walk the string to replace the '.' characters with byte counts.\r
{\r
static xSocket_t xSocket = NULL;\r
struct freertos_sockaddr xAddress;\r
-portBASE_TYPE xReturn;\r
-portTickType xTimeoutTime = 200 / portTICK_RATE_MS;\r
+BaseType_t xReturn;\r
+TickType_t xTimeoutTime = 200 / portTICK_RATE_MS;\r
\r
/* This must be the first time this function has been called. Create\r
the socket. */\r
else\r
{\r
/* Set the send and receive timeouts. */\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xTimeoutTime, sizeof( portTickType ) );\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xTimeoutTime, sizeof( portTickType ) );\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xTimeoutTime, sizeof( TickType_t ) );\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xTimeoutTime, sizeof( TickType_t ) );\r
}\r
\r
return xSocket;\r