setipv4sourcefilter

Jump to: navigation, search

Table of Contents >> Programmer's Reference >> IGMPv3


#include <trsocket.h>


int setipv4sourcefilter (
int sd,
struct in_addr interfaceAddr,
struct in_addr group,
ttUser32Bit fmode,
ttUser32Bit numsrc,
struct in_addr * 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 setipv4sourcefilter() in include mode with 'numsrc' set to zero is the same as dropping the multicast membership.


Parameters

  • sd
    The socket descriptor.
  • interfaceAddr
    Local IPv4 address of the corresponding configured interface. Note that a zero ip address is valid if the user has either designated a default multicast interface for the socket via the IP_MULTICAST_IF socket option, or designated a default multicast interface for the system vi atfSetMcastInterface().
  • group
    Destination multicast group address.
  • 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 source addresses to include or exclude based on the value of the 'fmode' argument.


Return Values

  • TM_ENOERROR
    Success
  • TM_SOCKET_ERROR
    Failure


Note Note: 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:
  • The interface address is not a valid configured address.
  • 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.


Table of Contents >> Programmer's Reference >> IGMPv3