tfAddDefaultGateway

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


int tfAddDefaultGateway (
ttUserInterface interfaceHandle,
ttUserIpAddress gatewayIpAddress,
int hops
);
Conditional parameter. See details in Parameters below.


Function Description

This function is used to add the default gateway for all interfaces.


Parameters

  • interfaceHandle
    Interface ID as returned by tfAddInterface().
  • gatewayIpAddress
    The default gateway IP address in network byte order.
  • hops
    A metric used to prioritize gateways. Default gateways with lower 'hops' values have higher priority. NOTE: This parameter is conditional and only present when TM_USE_STRONG_ESL is defined at compile time. For more information, please see Appendix C: Strong End System Model / Weak End System Model.


Returns

  • TM_ENOERROR
    Success.
  • TM_ENOBUFS
    Not enough buffers to allocate a routing entry.
  • TM_EALREADY
    A default gateway is already in the routing table.
  • TM_EHOSTUNREACH
    The gateway is not directly accessible.
  • TM_EINVAL
    One of the parameters is bad: the gatewayIpAddress is zero, or interfaceId refers to the loopback interface.


Table of Contents >> Programmer's Reference