RttcpipGetDefaultGateway

RttcpipGetDefaultGateway gets the IPv4 address of the default gateway associated with an interface.

Syntax

Copy
BOOL RttcpipGetDefaultGateway(
  [in]     NET_IFINDEX InterfaceIndex, 
  [out]    char* Gateway
);

Parameters

[in] InterfaceIndex

The local index for a network interface.

[out] Gateway

A null-terminated string representing the IPv4 address of the default gateway in dotted-quad notation.

Return Value

If this function succeeds, it returns TRUE. If this function fails, it returns FALSE. To get more information, call the GetLastError function.

Possible error codes:

Error code

Meaning

WSAEINVAL

One of these conditions occurred:

  • Parameter InterfaceIndex doesn’t correspond to an existing interface.
  • Parameter Gateway is NULL.

WSASYSNOTREADY

The TCP/IP Stack is not running.

Remarks

The value of Parameter Gateway must be at least RTTCPIP_IP_STRING_MAX_LENGTH.

If there is no default gateway, this function returns 0.0.0.0

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

RttcpipApi.h

RtTcpipApi.lib

See also: