IpSetAdapterGateway
Valid for: CANoe DE • CANoe4SW DEFunction Syntax
long IpSetAdapterGateway (dword ifIndex, dword ipv4address); // form 1long IpSetAdapterGateway (dword ifIndex, byte ipv6Address[]); // form 2long IpSetAdapterGateway (dword ifIndex, IP_Address address); // form 3
Description
The function sets the default gateway address. There can only be one default gateway. An old default gateway address will be overwritten. The default gateway has to be in one of the subnets configured in the network stack, otherwise the network stack will not be able to find a route to the gateway. To remove the gateway, set the address 0.0.0.0 (IPv4) or :: (IPv6). Note: The function is dependent on the selected stack. This functionality cannot be used in connection with the operating system TCP/IP stack.Parameters
- ifIndex: The 1-based network interface index. Although you set the default gateway on a defined interface, it is valid for the whole network stack. All adapter addresses including the local loopback address are taken into account in the stack of the operating system. The order depends on how the operating system lists the adapters. All assigned addresses including the VLAN addresses are taken into account in the CANoe DE product stack.
- ipv4address: The numerical IPv4 address for the gateway.
- ipv6Address: The IPv6 address for the gateway in a 16 byte array.
- address: IP address for the gateway.
Return Values
- 0: The function completed successfully.
- 1: The function is not supported on the selected TCP/IP stack.
- WSA_INVALID_PARAMETER (87): The specified network interface index was invalid.
- SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code.