[ ]
 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT Contact / Enquiries


FreeRTOS+TCP is still in the lab
FreeRTOS+TCP is already used in commercial products and we encourage you to try it yourself. Be aware however that we are still refining its design, and the source code and documentation do not yet meet Real Time Engineers Ltd's strict quality standards.
Please use the forum for support, feedback and ideas, or contact us directly if you have a specific business interest.

FreeRTOS_GetAddressConfiguration()

[FreeRTOS+TCP API Reference]

FreeRTOS_sockets.h
void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress,
                                       uint32_t *pulNetMask,
                                       uint32_t *pulGatewayAddress,
                                       uint32_t *pulDNSServerAddress );
		

Obtains the network address configuration from the TCP/IP stack.

Parameters:

pulIPAddress   Used to return the IP address being used by the IP stack.

The IP address is represented as a 32-bit number in network byte order.

pulNetMask   Used to return the net mask being used by the IP stack.

The net mask is represented as a 32-bit number in network byte order.

pulGatewayAddress   Used to return the IP address of the gateway being used by the IP stack.

The IP address is represented as a 32-bit number in network byte order.

pulDNSServerAddress   Used to return the IP address of the DNS server being used by the IP stack.

The IP address is represented as a 32-bit number in network byte order.

Example usage:


/* FreeRTOS+TCP sockets include. */
#define "FreeRTOS_sockets.h"

void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
int8_t cBuffer[ 16 ];

    if( eNetworkEvent == eNetworkUp )
    {
        /* The network is up and configured.  Print out the configuration
        obtained from the DHCP server. */
        FreeRTOS_GetAddressConfiguration( &ulIPAddress,
                                          &ulNetMask,
                                          &ulGatewayAddress,
                                          &ulDNSServerAddress );

        /* Convert the IP address to a string then print it out. */
        FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
        printf( "IP Address: %s\r\n", cBuffer );

        /* Convert the net mask to a string then print it out. */
        FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
        printf( "Subnet Mask: %s\r\n", cBuffer );

        /* Convert the IP address of the gateway to a string then print it out. */
        FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
        printf( "Gateway IP Address: %s\r\n", cBuffer );

        /* Convert the IP address of the DNS server to a string then print it out. */
        FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
        printf( "DNS server IP Address: %s\r\n", cBuffer );
    }
}
						
Example use of the FreeRTOS_GetAddressConfiguration() API function


[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS Labs Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.