FreeRTOS_GetAddressConfiguration()

[FreeRTOS Embedded IP Stack API]

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 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+UDP sockets include */
#include “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: %srn”, cBuffer );

/* Convert the net mask to a string then print it out. */
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
printf( “Subnet Mask: %srn”, cBuffer );

/* Convert the IP address of the gateway to a string then print it out. */
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
printf( “Gateway IP Address: %srn”, 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: %srn”, cBuffer );
}
}

Example use of the FreeRTOS_GetAddressConfiguration() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

New Updates to MIT licensed IoT MQTT and POSIX libraries are now available. Includes demo projects.

View a recording of the “OTA Update Security and Reliability” webinar, presented by TI and AWS.

Careers

FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners
ARM Connected RTOS partner for all ARM microcontroller cores
Espressif ESP32
IAR Partner
Microchip Premier RTOS Partner
Renesas
STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0
Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers
OpenRTOS and SafeRTOS
Xilinx Microblaze and Zynq partner