]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DNS.c
Update copyright date ready for tagging V10.1.0.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-UDP / FreeRTOS_DNS.c
index 57366eea11bb8064c794312972af798b4ad55a63..20d06cfae5be6581e1ba949080814862f356717c 100644 (file)
@@ -1,43 +1,28 @@
 /*\r
- * FreeRTOS+UDP V1.0.2 (C) 2013 Real Time Engineers ltd.\r
- * All rights reserved\r
+ * FreeRTOS+UDP V1.0.4\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
  *\r
- * This file is part of the FreeRTOS+UDP distribution.  The FreeRTOS+UDP license\r
- * terms are different to the FreeRTOS license terms.\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
- * FreeRTOS+UDP uses a dual license model that allows the software to be used \r
- * under a standard GPL open source license, or a commercial license.  The \r
- * standard GPL license (unlike the modified GPL license under which FreeRTOS \r
- * itself is distributed) requires that all software statically linked with \r
- * FreeRTOS+UDP is also distributed under the same GPL V2 license terms.  \r
- * Details of both license options follow:\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
  *\r
- * - Open source licensing -\r
- * FreeRTOS+UDP is a free download and may be used, modified, evaluated and\r
- * distributed without charge provided the user adheres to version two of the\r
- * GNU General Public License (GPL) and does not remove the copyright notice or\r
- * this text.  The GPL V2 text is available on the gnu.org web site, and on the\r
- * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.\r
- *\r
- * - Commercial licensing -\r
- * Businesses and individuals that for commercial or other reasons cannot comply\r
- * with the terms of the GPL V2 license must obtain a commercial license before \r
- * incorporating FreeRTOS+UDP into proprietary software for distribution in any \r
- * form.  Commercial licenses can be purchased from http://shop.freertos.org/udp \r
- * and do not require any 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
@@ -99,7 +84,7 @@ static xSocket_t prvCreateDNSSocket( void );
 /*\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
@@ -128,7 +113,7 @@ typedef struct xDNSMessage xDNSMessage_t;
 \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
@@ -136,10 +121,10 @@ static xSocket_t xDNSSocket = NULL;
 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
@@ -207,7 +192,7 @@ const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( ( const
 }\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
@@ -237,10 +222,10 @@ static const xDNSMessage_t xDefaultPartDNSHeader =
        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
@@ -384,8 +369,8 @@ static xSocket_t prvCreateDNSSocket( void )
 {\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
@@ -404,8 +389,8 @@ portTickType xTimeoutTime = 200 / portTICK_RATE_MS;
        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