/*\r
- * FreeRTOS+UDP V1.0.0 (C) 2013 Real Time Engineers ltd.\r
+ * FreeRTOS+UDP V1.0.3 (C) 2014 Real Time Engineers ltd.\r
+ * 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
+ * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license\r
+ * terms are different to the FreeRTOS license terms.\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
*\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
+ * 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 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
+ * 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
#define dhcpCLIENT_PORT 0x4400\r
#define dhcpSERVER_PORT 0x4300\r
#define dhcpCOOKIE 0x63538263\r
+ #define dhcpBROADCAST 0x0080\r
#else\r
#define dhcpCLIENT_PORT 0x0044\r
#define dhcpSERVER_PORT 0x0043\r
#define dhcpCOOKIE 0x63825363\r
+ #define dhcpBROADCAST 0x8000\r
#endif /* ipconfigBYTE_ORDER */\r
\r
#include "pack_struct_start.h"\r
eDHCPState = eNotUsingLeasedAddress;\r
xTimerStop( xDHCPTimer, ( portTickType ) 0 );\r
\r
- #if ipconfigFREERTOS_PLUS_NABTO == 1\r
- {\r
- vStartNabtoTask();\r
- }\r
- #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
-\r
#if ipconfigUSE_NETWORK_EVENT_HOOK == 1\r
{\r
vApplicationIPNetworkEventHook( eNetworkUp );\r
}\r
#endif\r
\r
+ /* Static configuration is being used, so the network is now up. */\r
+ #if ipconfigFREERTOS_PLUS_NABTO == 1\r
+ {\r
+ /* Return value is used in configASSERT() inside the\r
+ function. */\r
+ ( void ) xStartNabtoTask();\r
+ }\r
+ #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
+\r
/* Close socket to ensure packets don't queue on it. */\r
FreeRTOS_closesocket( xDHCPSocket );\r
xDHCPSocket = NULL;\r
*pulIPAddress = ulOfferedIPAddress;\r
eDHCPState = eLeasedAddress;\r
\r
- #if ipconfigFREERTOS_PLUS_NABTO == 1\r
- {\r
- vStartNabtoTask();\r
- }\r
- #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
-\r
#if ipconfigUSE_NETWORK_EVENT_HOOK == 1\r
{\r
vApplicationIPNetworkEventHook( eNetworkUp );\r
}\r
#endif\r
\r
+ /* Static configuration is being used, so the network is now\r
+ up. */\r
+ #if ipconfigFREERTOS_PLUS_NABTO == 1\r
+ {\r
+ /* Return value is used in configASSERT() inside the\r
+ function. */\r
+ ( void ) xStartNabtoTask();\r
+ }\r
+ #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
+\r
/* Close socket to ensure packets don't queue on it. */\r
FreeRTOS_closesocket( xDHCPSocket );\r
xDHCPSocket = NULL;\r
\r
if( xDHCPTimer == NULL )\r
{\r
- xDHCPTimer = xTimerCreate( ( const signed char * const ) "DHCP", dhcpINITIAL_TIMER_PERIOD, pdTRUE, ( void * ) eDHCPEvent, vIPFunctionsTimerCallback );\r
+ xDHCPTimer = xTimerCreate( "DHCP", dhcpINITIAL_TIMER_PERIOD, pdTRUE, ( void * ) eDHCPEvent, vIPFunctionsTimerCallback );\r
configASSERT( xDHCPTimer );\r
xTimerStart( xDHCPTimer, portMAX_DELAY );\r
}\r
(*1000) then ticks (/portTICK_RATE_MS). */\r
ulLeaseTime *= ( 1000UL / portTICK_RATE_MS );\r
\r
- /* Divide the lease time to ensure a renew \r
+ /* Divide the lease time to ensure a renew\r
request is sent before the lease actually\r
expires. */\r
ulLeaseTime >>= 1UL;\r
pxDHCPMessage->ucAddressType = dhcpADDRESS_TYPE_ETHERNET;\r
pxDHCPMessage->ucAddressLength = dhcpETHERNET_ADDRESS_LENGTH;\r
pxDHCPMessage->ulTransactionID = ulTransactionId;\r
- pxDHCPMessage->ulYourIPAddress_yiaddr = ulOfferedIPAddress;\r
pxDHCPMessage->ulDHCPCookie = dhcpCOOKIE;\r
+ pxDHCPMessage->usFlags = dhcpBROADCAST;\r
memcpy( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress[ 0 ] ), ( void * ) pxMACAddress, sizeof( xMACAddress_t ) );\r
\r
/* Copy in the const part of the options options. */\r