tfNgAddStaticRoute

Jump to: navigation, search

Table of Contents >> IPv6 Programmer's Reference


#include <trsocket.h>


int tfNgAddStaticRoute (
ttUserInterface interfaceHandle,
const struct sockaddr_storage * destIpAddrPtr,
int prefixLen,
const struct sockaddr_storage * gatewayPtr,
int hops
);


Function Description

This function is used to add a route for the interface. It allows packets for a different network to be routed to the interface. This API replaces tfAddStaticRoute().


Parameters

  • interfaceHandle
    The interface ID to use to add this routing entry.
  • destIpAddrPtr
    A pointer to the sockaddr_storage structure describing the route destination.
  • gatewayPtr
    A pointer to the sockaddr_storage structure describing the gateway.
  • hops
    A metric used to rank routing entries. An entry with lower hops has a higher priority. This is typically the number of routers between the source and destination.
  • prefixLen
    The length (in bits) of the subnet prefix part of the address specified by destIpAddrPtr. For an IPv6 address, the value specified must be in the range of 0 to 128, and will typically be 64. For an IPv4 address, the value specified is the number of most significant bits in the associated IPv4 netmask that are set to 1.


Returns

  • TM_EINVAL
    Invalid value specified for prefixLen.
  • TM_EAFNOSUPPORT
    destIpAddrPtr->addrFamily or gatewayPtr->addrFamily was set to an invalid value for address family; valid values are AF_INET and AF_INET6.


Table of Contents >> IPv6 Programmer's Reference