tf6SockaddrSetScopeId

Jump to: navigation, search

Table of Contents >> IPv6 Programmer's Reference


#include <trsocket.h>


int tf6SockaddrSetScopeId (
ttUserInterface interfaceHandle,
struct sockaddr_storage * ipAddrPtr
);


Function Description

This function only supports IPv6. This function only supports IPv6.

In some cases you may need to set the scope ID of a local scope unicast IPv6 address to associate it with the specific interface that you want to use it with. For example, if you want to send packets to a link-local or site-local unicast IPv6 destination address, you need to associate the local scope destination address with the specific outgoing interface you want to send those packets on, and this is done via the scope ID. In that case, you can call tf6SockaddrSetScopeId() to set the scope ID of the address. This function may be called for other IPv6 addresses besides local scope unicast IPv6 addresses, in which case it will return a scope ID of 0.



Parameters

  • interfaceHandle
    Interface handle of the interface to associate with the local scope IPv6 address.
  • ipAddrPtr
    Pointer to the IPv6 address that you want to set the scope ID for. The memory that this points to must be allocated by the caller, i.e. a local variable in the caller's address space. On successful return, the sockaddr_in6.sin6_scope_id field of this address is set to the scope ID.


Returns

  • 0
    Success.
  • TM_EINVAL
    ipAddrPtr was NULL.
  • TM_EAFNOSUPPORT
    The specified destination IP address (pointed to by destIpAddrPtr) was not an IPv6 address, i.e. inIpAddrPtr->addrFamily != AF_INET6.


Table of Contents >> IPv6 Programmer's Reference