setsourcefilter, getsourcefilter, setipv4sourcefilter, getipv4sourcefilter Subroutine

Purpose

Manage IP multicast source filters.

Library

Library (libc.a)

Syntax

#include <netinet/in.h> 
int setsourcefilter(int socket, uint32_t interface,
                        struct sockaddr *group, socklen_t grouplen,
                        uint32_t fmode, uint_t numsrc,
                        struct sockaddr_storage *slist);

   int getsourcefilter(int socket, uint32_t interface,
                        struct sockaddr *group, socklen_t grouplen,
                        uint32_t *fmode, uint_t *numsrc,
                        struct sockaddr_storage *slist);

    int setipv4sourcefilter(int socket, struct in_addr interface,
                            struct in_addr group, uint32_t fmode,
                            uint32_t numsrc, struct in_addr *slist);

    int getipv4sourcefilter(int socket, struct in_addr interface,
                            struct in_addr group, uint32_t *fmode,
                            uint32_t *numsrc, struct in_addr *slist);

Description

The setsourcefilter and setipv4sourcefilter subroutines allow a socket to join a multicast group on an interface while excluding (fmode = MCAST_EXCLUDE) messages or accepting (fmode = MCAST_INCLUDE) messages from a number of senders listed in the slist table. The number of elements in the slist is specified by numsrc.

The getsourcefilter and getipv4sourcefilter subroutines provide information on existing source filter for a socket on a given interface and for a given multicast group. fmode, numsrc and slist are pointers to parameters which will contain the information returned by the subroutine. fmode will point to the type of filter returned: MCAST_EXCLUDE or MCAST_INCLUDE. On input, numsrc points to the maximum number of senders that the application is expecting. If there are more sources than requested, the subroutine returns only the first numsrc sources in slist and numsrc is set to indicate the total number of sources. slist contains the table of excluded or included senders depending on the type of the filter. Memory pointed by fmode, numsrc and slist must be allocated by the application. In particular, slist must point to a memory zone able to contain numsrc elements.

The setipv4sourcefilter and getipv4sourcefilter can only be used for AF_INET sockets.

The setsourcefilter and getsourcefilter can be used for AF_INET and AF_INET6 sockets.

Parameters

For setsourcefilter and setipv4sourcefilter:
Item Description
socket Specifies the unique socket name
interface Specifies the local interface. For setipv4sourcefilter and getipv4sourcefilter an address configured on the interface must be specified. For setsourcefilter and getsourcefilter, the interface must be specified by its interface index.
group Specifies the multicast group
fmode Specifies if the elements contained in the slist must be excluded (MCAST_EXCLUDE) or included (MCAST_INCLUDE)
numsrc Specifies the number of elements in slist
slist Specifies the list of elements to exclude or include.
For getsourcefilter and getipv4sourcefilter:
Item Description
socket Specifies the unique socket name
interface Specifies the local interface. For setipv4sourcefilter and getipv4sourcefilter an address configured on the interface must be specified. For setsourcefilter and getsourcefilter the interface must be specified by its interface index.
group Specifies the multicast group
fmode Specifies a pointer to the type of element returned in slist. MCAST_EXCLUDE for a list of excluded elements MCAST_INCLUDE for a list of excluded elements.
numsrc On input, specifies the number of elements that can be returned in slist. On output, contains the total number of sources for this filter
slist Contains the list of elements returned.

Return Values

Upon successful completion, the subroutine returns 0.

If unsuccessful, the subroutine returns -1 and errno is set accordingly.