]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DHCP.c
Fix mixed tabs and spaces in the latest TCP patches.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-TCP / FreeRTOS_DHCP.c
index eef8ec84814e121f13734f0b434d396d88bdaa9d..8e475bf73810e063e857bff29258660f94289bda 100644 (file)
@@ -359,19 +359,19 @@ BaseType_t xGivingUp = pdFALSE;
 \r
                                if( xDHCPData.xDHCPTxPeriod <= ipconfigMAXIMUM_DISCOVER_TX_PERIOD )\r
                                {\r
-                    xDHCPData.ulTransactionId = ipconfigRAND32( );\r
-\r
-                    if( 0 != xDHCPData.ulTransactionId )\r
-                    {\r
-                        xDHCPData.xDHCPTxTime = xTaskGetTickCount( );\r
-                        xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;\r
-                        prvSendDHCPDiscover( );\r
-                        FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );\r
-                    }\r
-                    else\r
-                    {\r
-                        FreeRTOS_debug_printf( ( "vDHCPProcess: failed to generate a random Transaction ID\n" ) );\r
-                    }\r
+                                       xDHCPData.ulTransactionId = ipconfigRAND32( );\r
+\r
+                                       if( 0 != xDHCPData.ulTransactionId )\r
+                                       {\r
+                                               xDHCPData.xDHCPTxTime = xTaskGetTickCount( );\r
+                                               xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;\r
+                                               prvSendDHCPDiscover( );\r
+                                               FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               FreeRTOS_debug_printf( ( "vDHCPProcess: failed to generate a random Transaction ID\n" ) );\r
+                                       }\r
                                }\r
                                else\r
                                {\r
@@ -592,23 +592,23 @@ TickType_t xTimeoutTime = ( TickType_t ) 0;
 static void prvInitialiseDHCP( void )\r
 {\r
        /* Initialise the parameters that will be set by the DHCP process. Per\r
-    https://www.ietf.org/rfc/rfc2131.txt, Transaction ID should be a random\r
-    value chosen by the client. */\r
-    xDHCPData.ulTransactionId = ipconfigRAND32();\r
-\r
-    /* Check for random number generator API failure. */\r
-    if( 0 != xDHCPData.ulTransactionId )\r
-    {\r
-           xDHCPData.xUseBroadcast = 0;\r
-           xDHCPData.ulOfferedIPAddress = 0UL;\r
-           xDHCPData.ulDHCPServerAddress = 0UL;\r
-           xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
-\r
-           /* Create the DHCP socket if it has not already been created. */\r
-           prvCreateDHCPSocket();\r
-           FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
-           vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
-    }\r
+       https://www.ietf.org/rfc/rfc2131.txt, Transaction ID should be a random\r
+       value chosen by the client. */\r
+       xDHCPData.ulTransactionId = ipconfigRAND32();\r
+\r
+       /* Check for random number generator API failure. */\r
+       if( 0 != xDHCPData.ulTransactionId )\r
+       {\r
+               xDHCPData.xUseBroadcast = 0;\r
+               xDHCPData.ulOfferedIPAddress = 0UL;\r
+               xDHCPData.ulDHCPServerAddress = 0UL;\r
+               xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
+\r
+               /* Create the DHCP socket if it has not already been created. */\r
+               prvCreateDHCPSocket();\r
+               FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
+               vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
+       }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -633,13 +633,13 @@ const uint32_t ulMandatoryOptions = 2ul; /* DHCP server address, and the correct
 \r
                /* Sanity check. */\r
                if( ( lBytes >= sizeof( DHCPMessage_t ) ) &&\r
-            ( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&\r
+                       ( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&\r
                        ( pxDHCPMessage->ucOpcode == ( uint8_t ) dhcpREPLY_OPCODE ) &&\r
                        ( pxDHCPMessage->ulTransactionID == FreeRTOS_htonl( xDHCPData.ulTransactionId ) ) )\r
                {\r
-                       if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ), \r
-                        ( void * ) ipLOCAL_MAC_ADDRESS, \r
-                        sizeof( MACAddress_t ) ) == 0 )\r
+                       if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ),\r
+                                               ( void * ) ipLOCAL_MAC_ADDRESS,\r
+                                               sizeof( MACAddress_t ) ) == 0 )\r
                        {\r
                                /* None of the essential options have been processed yet. */\r
                                ulProcessed = 0ul;\r
@@ -665,36 +665,36 @@ const uint32_t ulMandatoryOptions = 2ul; /* DHCP server address, and the correct
                                                continue;\r
                                        }\r
 \r
-                    /* Stop if the response is malformed. */\r
-                    if( pucByte < pucLastByte - 1 )\r
-                    {\r
-                        ucLength = pucByte[ 1 ];\r
-                        pucByte += 2;\r
-\r
-                        if( pucByte >= pucLastByte - ucLength )\r
-                        {\r
-                            break;\r
-                        }\r
-                    }\r
-                    else\r
-                    {\r
-                        break;\r
-                    }                    \r
+                                       /* Stop if the response is malformed. */\r
+                                       if( pucByte < pucLastByte - 1 )\r
+                                       {\r
+                                               ucLength = pucByte[ 1 ];\r
+                                               pucByte += 2;\r
+\r
+                                               if( pucByte >= pucLastByte - ucLength )\r
+                                               {\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               break;\r
+                                       }\r
 \r
                                        /* In most cases, a 4-byte network-endian parameter follows,\r
                                        just get it once here and use later. */\r
-                    if( ucLength >= sizeof( ulParameter ) )\r
-                    {\r
-                                       memcpy( ( void * ) &( ulParameter ), \r
-                                ( void * ) pucByte, \r
-                                ( size_t ) sizeof( ulParameter ) );\r
-                    }\r
-                    else\r
-                    {\r
-                        ulParameter = 0;\r
-                    }\r
-\r
-                    /* Option-specific handling. */\r
+                                       if( ucLength >= sizeof( ulParameter ) )\r
+                                       {\r
+                                               memcpy( ( void * ) &( ulParameter ),\r
+                                                               ( void * ) pucByte,\r
+                                                               ( size_t ) sizeof( ulParameter ) );\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               ulParameter = 0;\r
+                                       }\r
+\r
+                                       /* Option-specific handling. */\r
                                        switch( ucOptionCode )\r
                                        {\r
                                                case dhcpMESSAGE_TYPE_OPTION_CODE       :\r