NOTE: This API has been deprecated from FreeRTOS V4.0.0
onwards. Please refer to
FreeRTOS_GetEndPointConfiguration()
for the new APIs supporting IPv6, Multiple Endpoints and Multiple interfaces. To use the deprecated APIs please set
ipconfigIPv4_BACKWARD_COMPATIBLE to 1 in the FreeRTOSIPConfig.h header file.
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 for the first IPv4 endpoint available in the list of endpoints.
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:
#include "FreeRTOS_sockets.h"
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
int8_t cBuffer[ 16 ];
if( eNetworkEvent == eNetworkUp )
{
FreeRTOS_GetAddressConfiguration( &ulIPAddress,
&ulNetMask,
&ulGatewayAddress,
&ulDNSServerAddress );
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
printf( "IP Address: %srn", cBuffer );
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
printf( "Subnet Mask: %srn", cBuffer );
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
printf( "Gateway IP Address: %srn", cBuffer );
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
printf( "DNS server IP Address: %srn", cBuffer );
}
}
Example use of the FreeRTOS_GetAddressConfiguration() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.