|
491 | 491 | } |
492 | 492 | #endif /* if ( ipconfigDNS_USE_CALLBACKS == 0 ) */ |
493 | 493 |
|
494 | | - #if ( ipconfigINCLUDE_FULL_INET_ADDR == 1 ) |
495 | | - |
496 | 494 | /** |
497 | 495 | * @brief See if pcHostName contains a valid IPv4 or IPv6 IP-address. |
498 | 496 | * @param[in] pcHostName: The name to be looked up |
|
501 | 499 | * be stored. |
502 | 500 | * @return Either 0 or an IP=address. |
503 | 501 | */ |
504 | | - static uint32_t prvPrepare_ReadIPAddress( const char * pcHostName, |
505 | | - BaseType_t xFamily, |
506 | | - struct freertos_addrinfo ** ppxAddressInfo ) |
507 | | - { |
508 | | - uint32_t ulIPAddress = 0U; |
| 502 | + static uint32_t prvPrepare_ReadIPAddress( const char * pcHostName, |
| 503 | + BaseType_t xFamily, |
| 504 | + struct freertos_addrinfo ** ppxAddressInfo ) |
| 505 | + { |
| 506 | + uint32_t ulIPAddress = 0U; |
509 | 507 |
|
510 | | - ( void ) xFamily; |
| 508 | + ( void ) xFamily; |
511 | 509 |
|
512 | | - /* Check if the hostname given is actually an IP-address. */ |
513 | | - #if ( ipconfigUSE_IPv6 != 0 ) |
514 | | - if( xFamily == FREERTOS_AF_INET6 ) |
515 | | - { |
516 | | - IPv6_Address_t xAddress_IPv6; |
517 | | - BaseType_t xResult; |
| 510 | + /* Check if the hostname given is actually an IP-address. */ |
| 511 | + #if ( ipconfigUSE_IPv6 != 0 ) |
| 512 | + if( xFamily == FREERTOS_AF_INET6 ) |
| 513 | + { |
| 514 | + IPv6_Address_t xAddress_IPv6; |
| 515 | + BaseType_t xResult; |
518 | 516 |
|
519 | | - /* ulIPAddress does not represent an IPv4 address here. It becomes non-zero when the look-up succeeds. */ |
520 | | - xResult = FreeRTOS_inet_pton6( pcHostName, xAddress_IPv6.ucBytes ); |
| 517 | + /* ulIPAddress does not represent an IPv4 address here. It becomes non-zero when the look-up succeeds. */ |
| 518 | + xResult = FreeRTOS_inet_pton6( pcHostName, xAddress_IPv6.ucBytes ); |
521 | 519 |
|
522 | | - if( xResult == 1 ) |
523 | | - { |
524 | | - /* This function returns either a valid IPv4 address, or |
525 | | - * in case of an IPv6 lookup, it will return a non-zero */ |
526 | | - ulIPAddress = 1U; |
| 520 | + if( xResult == 1 ) |
| 521 | + { |
| 522 | + /* This function returns either a valid IPv4 address, or |
| 523 | + * in case of an IPv6 lookup, it will return a non-zero */ |
| 524 | + ulIPAddress = 1U; |
527 | 525 |
|
528 | | - if( ppxAddressInfo != NULL ) |
529 | | - { |
530 | | - *( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET6, xAddress_IPv6.ucBytes ); |
531 | | - } |
| 526 | + if( ppxAddressInfo != NULL ) |
| 527 | + { |
| 528 | + *( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET6, xAddress_IPv6.ucBytes ); |
532 | 529 | } |
533 | 530 | } |
534 | | - else |
535 | | - #endif /* ipconfigUSE_IPv6 */ |
536 | | - { |
537 | | - ulIPAddress = FreeRTOS_inet_addr( pcHostName ); |
| 531 | + } |
| 532 | + else |
| 533 | + #endif /* ipconfigUSE_IPv6 */ |
| 534 | + { |
| 535 | + ulIPAddress = FreeRTOS_inet_addr( pcHostName ); |
538 | 536 |
|
539 | | - if( ( ulIPAddress != 0U ) && ( ppxAddressInfo != NULL ) ) |
540 | | - { |
541 | | - const uint8_t * ucBytes = ( uint8_t * ) &( ulIPAddress ); |
| 537 | + if( ( ulIPAddress != 0U ) && ( ppxAddressInfo != NULL ) ) |
| 538 | + { |
| 539 | + const uint8_t * ucBytes = ( uint8_t * ) &( ulIPAddress ); |
542 | 540 |
|
543 | | - *( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes ); |
544 | | - } |
| 541 | + *( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes ); |
545 | 542 | } |
546 | | - |
547 | | - return ulIPAddress; |
548 | 543 | } |
549 | | - #endif /* ( ipconfigINCLUDE_FULL_INET_ADDR == 1 ) */ |
| 544 | + |
| 545 | + return ulIPAddress; |
| 546 | + } |
550 | 547 | /*-----------------------------------------------------------*/ |
551 | 548 |
|
552 | 549 | #if ( ipconfigDNS_USE_CALLBACKS == 1 ) |
|
621 | 618 | { |
622 | 619 | /* If the supplied hostname is an IP address, put it in ppxAddressInfo |
623 | 620 | * and return. */ |
624 | | - #if ( ipconfigINCLUDE_FULL_INET_ADDR == 1 ) |
625 | | - { |
626 | | - ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo ); |
627 | | - } |
628 | | - #endif /* ipconfigINCLUDE_FULL_INET_ADDR == 1 */ |
| 621 | + ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo ); |
629 | 622 |
|
630 | 623 | /* If a DNS cache is used then check the cache before issuing another DNS |
631 | 624 | * request. */ |
|
0 commit comments