getipv4sourcefilter() — Get source filter

Standards

Standards / Extensions C or C++ Dependencies
RFC3678 both z/OS® V1.9

Format

#define _OPEN_SYS_SOCK_EXT3
#include <netinet/in.h>

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

General description

This function allows applications to get a previously set multicast filtering state for a tuple consisting of socket, interface, and multicast group values.

A multicast filter is described by a filter mode, which is MCAST_INCLUDE or MCAST_EXCLUDE, and a list of source addresses which are filtered.

This function is IPv4-specific, must be used only on AF_INET sockets with an open socket of type SOCK_DGRAM or SOCK_RAW.

If the function is unable to obtain the required storage, control will not return to the caller. Instead the application will terminate due to an out of memory condition (if the reserve stack is available and the caller is not XPLINK), or it will terminate with an abend indicating that storage could not be obtained.

Argument
Description
s
Identifies the socket.
interface
Holds the local IP address of the interface.
group
Holds the IP multicast address of the group.
fmode
Points to an integer that will contain the filter mode on a successful return. The value of this field will be either MCAST_INCLUDE or MCAST_EXCLUDE, which are likewise defined in <netinet/in.h>.
numsrc
It is a pointer that on input, points to the number of source addresses that will fit in the slist array. On return, points to the total number of sources associated with the filter.
slist
Points to buffer into which an array of IP addresses of included or excluded (depending on the filter mode) sources will be written. If numsrc was 0 on input, a NULL pointer may be supplied.

Returned value

If successful, the function returns 0. Otherwise, it returns -1 and sets errno to one of the following values.

errno
Description
EADDRNOTAVAIL
The tuple consisting of socket, interface, and multicast group values does not exist, or the specified interface address is incorrect for this host, or the specified interface address is not multicast capable.
EBADF
s is not a valid socket descriptor.
EINVAL
Interface or group is not a valid IPv4 address, or the socket s has already requested multicast setsockopt options.
EPROTOTYPE
The socket s is not of type SOCK_DGRAM or SOCK_RAW.

Related information