RttcpipSetDefaultGateway
RttcpipSetDefaultGateway sets the IPv4 address of the default gateway associated with an interface.
Syntax
BOOL RttcpipSetDefaultGateway(
[in] NET_IFINDEX InterfaceIndex,
[in] char* Gateway
);
Parameters
[in] InterfaceIndex
The local index for a network interface.
[in] Gateway
A pointer to a buffer that holds 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 |
---|---|
WSAEALREADY |
A route is already in the tree. |
WSAEHOSTUNREACH |
There is no route to the host. |
WSAEINVAL |
One of these conditions occurred:
|
WSASYSNOTREADY |
Remarks
To remove the default gateway, pass a value of 0.0.0.0 in the buffer pointed to by parameter Gateway.
This API makes transient changes to the initial value. Once the TCP/IP Stack is stopped, the changes are not saved to the registry and the initial value is restored.
Requirements
Minimum supported version | Header | Library |
---|---|---|
eRTOS 1.0 SDK |
RttcpipApi.h |
RtTcpipApi.lib |
See also: