tfNgGetPrefixLen

Jump to: navigation, search

Table of Contents >> IPv6 Programmer's Reference


#include <trsocket.h>


int tfNgGetPrefixLen (
ttUserInterface interfaceHandle,
ttUser8Bit * prefixLenPtr,
int addrFamily,
unsigned int mHomeIndex
);


Function Description

Next Generation API replaces tfGetNetMask(). When addrFamily is set to AF_INET4, this API may be used to retrieve the prefix length for each IPv4 address manually configured on the interface by the user. When addrFamily is set to AF_INET6, this API may be used to retrieve the prefix length for auto-configured IPv6 addresses, as well as IPv6 addresses manually configured on the interface by the user. See the description of tfNgGetIpAddress() for information on what values of mHomeIndex correspond to auto-configured IPv6 addresses.


Parameters

  • interfaceHandle
    The device entry as returned by tfAddInterface()
  • prefixLenPtr
    Pointer to the prefix length of the IP address specified by addrFamily and mHomeIndex. The prefix length is the length (in bits) of the subnet prefix part of the IP address. For an IPv6 address, the prefix length is in the range of 0 to 128, and will typically be 64. For an IPv4 address, the prefix length is the number of most significant bits in the associated IPv4 netmask that are set to 1. The memory that this points to must be allocated by the caller, i.e. a local variable in the caller’s address space.
  • addrFamily
    The address family (i.e. AF_INET for IPv4, AF_INET6 for IPv6) of the address that you want to get the prefix length for.
  • mHomeIndex
    The index for this IP address for multihoming. Zero must be the first multihome index used.


Returns

  • TM_EINVAL
    Invalid value specified for prefixLenPtr.
  • TM_EAFNOSUPPORT
    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