setsourcefilter
Table of Contents >> IPv6 Programmer's Reference >> MLDv2
| #include <trsocket.h> |
| int setsourcefilter | ( |
| int sd, | |
| ttUser32Bit ifindex, | |
| struct sockaddr TM_FAR * group, | |
| unsigned int grouplen, | |
| ttUser32Bit fmode, | |
| unsigned int numsrc, | |
| struct sockaddr_storage TM_FAR * slist | |
| ); |
Function Description
This function API allows the user to set a source address filter list in either exclude mode or include mode for a given socket, interface, and multicast source address. Calling setsourcefilter() in include mode with numsrc set to zero is the same as dropping the multicast membership. This function supports IPv4 (IGMPv3) and IPv6 (MLDv2).
Parameters
- sd
- The socket descriptor.
- ifindex
- Index of the corresponding configured interface as returned by if_nametoindex(). Note that a zero index is valid if the user has either designated a default multicast interface for the socket via the IP_MULTICAST_IF or IPV6_MULTICAST_IF socket options, or designated a default multicast interface for the system via tfSetMcastInterface() or tf6SetMcastInterface().
- group
- Destination multicast group address (IPv4 or IPv6).
- grouplen
- The size of the structure pointed to by group.
- fmode
- Filter mode. Either MCAST_INCLUDE or MCAST_EXCLUDE.
- numsrc
- Number of source addresses in the slist array.
- slist
- Points to an array of IPv4 or IPv6 source addresses to include or exclude, based on the value of the fmode argument. The address family (AF_INET or AF_INET6) of all source addresses must match that of group.
Return Values
- TM_ENOERROR
- Success
- TM_SOCKET_ERROR
- Failure
| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor). |
Possible socket errors
- TM_EBADF
- The socket descriptor is invalid.
- TM_EINVAL
- The operation is not legal on the group. For example fmode contains a value other than MCAST_INCLUDE or MCAST_EXCLUDE.
- TM_EPROTOTYPE
- The socket is not of type SOCK_DGRAM or SOCK_RAW.
- TM_EADDRNOTAVAIL
- Address is invalid. Here are a few examples:
- No interface at the specified index.
- A source address is invalid.
- Trying to add a source on a local multicast group.
- The group address is not multicast.
- Trying to drop an un-joined multicast group (by setting numsrc to 0 in include mode for an un-joined multicast group).
- TM_ENOBUFS
- No memory for operation, most probably because the maximum number of filters has been reached.
- TM_EAFNOSUPPORT
- Address family mismatch or is not valid or is unsupported (IGMPv3 or MLDv2 must be present, depending on the address family).